@@ -7,6 +7,7 @@ package io.openapiprocessor.core.writer.java
7
7
8
8
import io.kotest.core.spec.IsolationMode
9
9
import io.kotest.core.spec.style.StringSpec
10
+ import io.kotest.matchers.collections.shouldBeEmpty
10
11
import io.kotest.matchers.shouldBe
11
12
import io.openapiprocessor.core.model.datatypes.*
12
13
import io.openapiprocessor.core.support.datatypes.ListDataType
@@ -35,7 +36,7 @@ class BeanValidationFactorySpec: StringSpec({
35
36
val io = info.inout
36
37
io.dataTypeValue shouldBe " @Valid Foo[]"
37
38
io.imports shouldBe setOf(BeanValidation .VALID .import)
38
- io.annotations shouldBe emptySet ()
39
+ io.annotations.shouldBeEmpty ()
39
40
}
40
41
41
42
" does not apply @Valid to 'array' with simple items" {
@@ -46,13 +47,13 @@ class BeanValidationFactorySpec: StringSpec({
46
47
47
48
val prop = info.prop
48
49
prop.dataTypeValue shouldBe " String[]"
49
- prop.imports shouldBe emptySet ()
50
- prop.annotations shouldBe emptySet ()
50
+ prop.imports.shouldBeEmpty ()
51
+ prop.annotations.shouldBeEmpty ()
51
52
52
53
val io = info.inout
53
54
io.dataTypeValue shouldBe " String[]"
54
- io.imports shouldBe emptySet ()
55
- io.annotations shouldBe emptySet ()
55
+ io.imports.shouldBeEmpty ()
56
+ io.annotations.shouldBeEmpty ()
56
57
}
57
58
58
59
" applies @Valid to mapped collection with object items" {
@@ -66,12 +67,12 @@ class BeanValidationFactorySpec: StringSpec({
66
67
val prop = info.prop
67
68
prop.dataTypeValue shouldBe " List<@Valid Foo>"
68
69
prop.imports shouldBe setOf(BeanValidation .VALID .import)
69
- prop.annotations shouldBe emptySet ()
70
+ prop.annotations.shouldBeEmpty ()
70
71
71
72
val io = info.inout
72
73
io.dataTypeValue shouldBe " List<@Valid Foo>"
73
74
io.imports shouldBe setOf(BeanValidation .VALID .import)
74
- io.annotations shouldBe emptySet ()
75
+ io.annotations.shouldBeEmpty ()
75
76
}
76
77
77
78
" does not apply @Valid to mapped collection with simple items" {
@@ -82,13 +83,13 @@ class BeanValidationFactorySpec: StringSpec({
82
83
83
84
val prop = info.prop
84
85
prop.dataTypeValue shouldBe " List<String>"
85
- prop.imports shouldBe emptySet ()
86
- prop.annotations shouldBe emptySet ()
86
+ prop.imports.shouldBeEmpty ()
87
+ prop.annotations.shouldBeEmpty ()
87
88
88
89
val io = info.inout
89
90
io.dataTypeValue shouldBe " List<String>"
90
- io.imports shouldBe emptySet ()
91
- io.annotations shouldBe emptySet ()
91
+ io.imports.shouldBeEmpty ()
92
+ io.annotations.shouldBeEmpty ()
92
93
}
93
94
94
95
" applies @Pattern to String" {
@@ -105,7 +106,7 @@ class BeanValidationFactorySpec: StringSpec({
105
106
val io = info.inout
106
107
io.dataTypeValue shouldBe """ ${BeanValidation .PATTERN .annotation} (regexp = "regex") String"""
107
108
io.imports shouldBe setOf(BeanValidation .PATTERN .import)
108
- io.annotations shouldBe emptySet ()
109
+ io.annotations.shouldBeEmpty ()
109
110
}
110
111
111
112
" applies @Pattern to String with escaping" {
@@ -122,7 +123,7 @@ class BeanValidationFactorySpec: StringSpec({
122
123
val io = info.inout
123
124
io.dataTypeValue shouldBe """ ${BeanValidation .PATTERN .annotation} (regexp = "\\.\\\\") String"""
124
125
io.imports shouldBe setOf(BeanValidation .PATTERN .import)
125
- io.annotations shouldBe emptySet ()
126
+ io.annotations.shouldBeEmpty ()
126
127
}
127
128
128
129
" does apply validation annotations to 'collection' item" {
@@ -146,7 +147,7 @@ class BeanValidationFactorySpec: StringSpec({
146
147
io.imports shouldBe setOf(
147
148
BeanValidation .NOT_NULL .import,
148
149
BeanValidation .SIZE .import)
149
- io.annotations shouldBe emptySet ()
150
+ io.annotations.shouldBeEmpty ()
150
151
}
151
152
152
153
" does apply validation annotations to 'collection' model items" {
@@ -172,7 +173,7 @@ class BeanValidationFactorySpec: StringSpec({
172
173
io.imports shouldBe setOf(
173
174
BeanValidation .NOT_NULL .import,
174
175
BeanValidation .VALID .import)
175
- io.annotations shouldBe emptySet ()
176
+ io.annotations.shouldBeEmpty ()
176
177
}
177
178
178
179
" does apply validation annotations to 'array' item" {
@@ -194,7 +195,7 @@ class BeanValidationFactorySpec: StringSpec({
194
195
io.dataTypeValue shouldBe " @NotNull String[]"
195
196
io.imports shouldBe setOf(
196
197
BeanValidation .NOT_NULL .import)
197
- io.annotations shouldBe emptySet ()
198
+ io.annotations.shouldBeEmpty ()
198
199
}
199
200
200
201
" does apply validation annotations to 'array' model items" {
@@ -221,7 +222,7 @@ class BeanValidationFactorySpec: StringSpec({
221
222
io.imports shouldBe setOf(
222
223
BeanValidation .NOT_NULL .import,
223
224
BeanValidation .VALID .import)
224
- io.annotations shouldBe emptySet ()
225
+ io.annotations.shouldBeEmpty ()
225
226
}
226
227
227
228
" applies @Email to String" {
@@ -238,6 +239,6 @@ class BeanValidationFactorySpec: StringSpec({
238
239
val io = info.inout
239
240
io.dataTypeValue shouldBe """ ${BeanValidation .EMAIL .annotation} String"""
240
241
io.imports shouldBe setOf(BeanValidation .EMAIL .import)
241
- io.annotations shouldBe emptySet ()
242
+ io.annotations.shouldBeEmpty ()
242
243
}
243
244
})
0 commit comments