-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathPostgresqlArraysDomainIntegrationSpec.groovy
More file actions
120 lines (90 loc) · 3.28 KB
/
Copy pathPostgresqlArraysDomainIntegrationSpec.groovy
File metadata and controls
120 lines (90 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package net.kaleidos.hibernate.array
import spock.lang.Specification
import spock.lang.Unroll
import test.array.*
class PostgresqlArraysDomainIntegrationSpec extends Specification {
@Unroll
void 'save a domain class with an integer array value #numbers'() {
setup:
def testInt = new TestInteger(integerNumbers: numbers)
when:
testInt.save(flush: true)
then:
testInt.hasErrors() == false
testInt.integerNumbers?.length == numbers?.size()
where:
numbers << [null, [], [5], [3, -1], [-9, 4, -123, 0]]
}
@Unroll
void 'save a domain class with a long array value #numbers'() {
setup:
def testLong = new TestLong(longNumbers: numbers)
when:
testLong.save(flush: true)
then:
testLong.hasErrors() == false
testLong.longNumbers?.length == numbers?.size()
where:
numbers << [null, [], [5L], [3L, -1L], [-9L, 4L, -123L, 0L]]
}
@Unroll
void 'save a domain class with a Float array value #numbers'() {
setup:
def testFloat = new TestFloat(floatNumbers: numbers)
when:
testFloat.save(flush: true)
then:
testFloat.hasErrors() == false
testFloat.floatNumbers?.length == numbers?.size()
where:
numbers << [null, [], [5f], [3f, -1f], [-9f, 4f, -123f, 0f]]
}
@Unroll
void 'save a domain class with a Double array value #numbers'() {
setup:
def testDouble = new TestDouble(doubleNumbers: numbers)
when:
testDouble.save(flush: true)
then:
testDouble.hasErrors() == false
testDouble.doubleNumbers?.length == numbers?.size()
where:
numbers << [null, [], [5d], [3d, -1d], [-9d, 4d, -123d, 0d]]
}
@Unroll
void 'save a domain class with an string array value #strings'() {
setup:
def testString = new TestString(stringArray: strings)
when:
testString.save(flush: true)
then:
testString.hasErrors() == false
testString.stringArray?.length == strings?.size()
where:
strings << [null, [], ["string 1"], ["string 1", "string 2"], ["string 1", "string 2", "string 3"]]
}
@Unroll
void 'save a domain class with an enum array value #days'() {
setup:
def testEnum = new TestEnum(days: days)
when:
testEnum.save(flush: true)
then:
testEnum.hasErrors() == false
testEnum.days?.length == days?.size()
where:
days << [null, [], [TestEnum.Day.MONDAY], [TestEnum.Day.SUNDAY, TestEnum.Day.SATURDAY], [TestEnum.Day.WEDNESDAY, TestEnum.Day.THURSDAY, TestEnum.Day.TUESDAY]]
}
@Unroll
void 'save a domain class with an citext array value #citext'() {
setup:
def testCitext = new TestCitext(citextArray: citext)
when:
testCitext.save(flush: true)
then:
testCitext.hasErrors() == false
testCitext.citextArray?.length == citext?.size()
where:
citext << [null, [], ["string 1"], ["string 1", "string 2"], ["string 1", "string 2", "string 3"]]
}
}