Skip to content

Commit 9da3c13

Browse files
author
yevhenii-nadtochii
committed
Update text in test assertions
1 parent a9ae178 commit 9da3c13

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

model/src/test/kotlin/io/spine/validation/MaxPolicySpec.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ internal class MaxPolicySpec : CompilationErrorTest() {
5050
assertCompilationFails(MaxWithEmptyValue::class) { field ->
5151
shouldContain(MAX)
5252
shouldContain(field.qualifiedName)
53-
shouldContain("because it is empty")
53+
shouldContain("the value is empty")
5454
}
5555
}

model/src/test/kotlin/io/spine/validation/MinPolicySpec.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ internal class MinPolicySpec : CompilationErrorTest() {
5050
assertCompilationFails(MinWithEmptyValue::class) { field ->
5151
shouldContain(MIN)
5252
shouldContain(field.qualifiedName)
53-
shouldContain("because it is empty")
53+
shouldContain("the value is empty")
5454
}
5555
}

model/src/test/kotlin/io/spine/validation/RangePolicySpec.kt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ internal class RangePolicySpec : CompilationErrorTest() {
4646
assertCompilationFails(message) { field ->
4747
shouldContain(field.type.name)
4848
shouldContain(field.qualifiedName)
49-
shouldContain("is not supported")
49+
shouldContain("a filed of an unsupported type")
5050
}
5151

5252
@MethodSource("io.spine.validation.RangePolicyTestEnv#messagesWithInvalidDelimiters")
5353
@ParameterizedTest(name = "with an invalid delimiter in `{0}`")
5454
fun withInvalidDelimiter(message: KClass<out Message>) =
5555
assertCompilationFails(message) { field ->
5656
shouldContain(field.qualifiedName)
57-
shouldContain("The lower and upper bounds should be separated")
57+
shouldContain("the lower and upper bounds must be separated either with")
5858
}
5959

6060
@MethodSource("io.spine.validation.RangePolicyTestEnv#messagesWithOverflowValues")
@@ -72,69 +72,69 @@ internal class RangePolicySpec : CompilationErrorTest() {
7272
assertCompilationFails(message) { field ->
7373
shouldContain(field.qualifiedName)
7474
shouldContain(value)
75-
shouldContain("should be less than the upper")
75+
shouldContain("must be less than the upper bound")
7676
}
7777

7878
@Test
7979
fun `with an invalid opening symbol`() =
8080
assertCompilationFails(RangeInvalidOpening::class) { field ->
8181
shouldContain(field.qualifiedName)
82-
shouldContain("The lower bound should begin either")
82+
shouldContain("the lower bound must begin either with")
8383
}
8484

8585
@Test
8686
fun `with an invalid closing symbol`() =
8787
assertCompilationFails(RangeInvalidClosing::class) { field ->
8888
shouldContain(field.qualifiedName)
89-
shouldContain("The upper bound should end either")
89+
shouldContain("the upper bound must end either with")
9090
}
9191

9292
@Test
9393
fun `with integer number specified for lower bound of 'float' field`() =
9494
assertCompilationFails(RangeInvalidLowerFloat::class) { field ->
9595
shouldContain(field.qualifiedName)
96-
shouldContain("could not parse the `0` bound value")
97-
shouldContain("make sure the provided value is a floating-point number")
96+
shouldContain("Value: `0`")
97+
shouldContain("a floating-point number is required for this field type")
9898
}
9999

100100
@Test
101101
fun `with integer number specified for upper bound of 'float' field`() =
102102
assertCompilationFails(RangeInvalidUpperFloat::class) { field ->
103103
shouldContain(field.qualifiedName)
104-
shouldContain("could not parse the `15` bound value")
105-
shouldContain("make sure the provided value is a floating-point number")
104+
shouldContain("Value: `15`")
105+
shouldContain("a floating-point number is required for this field type")
106106
}
107107

108108
@Test
109109
fun `with integer number specified for lower bound of 'double' field`() =
110110
assertCompilationFails(RangeInvalidLowerDouble::class) { field ->
111111
shouldContain(field.qualifiedName)
112-
shouldContain("could not parse the `0` bound value")
113-
shouldContain("make sure the provided value is a floating-point number")
112+
shouldContain("Value: `0`")
113+
shouldContain("a floating-point number is required for this field type")
114114
}
115115

116116
@Test
117117
fun `with integer number specified for upper bound of 'double' field`() =
118118
assertCompilationFails(RangeInvalidUpperDouble::class) { field ->
119119
shouldContain(field.qualifiedName)
120-
shouldContain("could not parse the `15` bound value")
121-
shouldContain("make sure the provided value is a floating-point number")
120+
shouldContain("Value: `15`")
121+
shouldContain("a floating-point number is required for this field type")
122122
}
123123

124124
@Test
125125
fun `with floating-point number specified for lower bound of 'int32' field`() =
126126
assertCompilationFails(RangeInvalidLowerInt::class) { field ->
127127
shouldContain(field.qualifiedName)
128-
shouldContain("could not parse the `0.0` bound value")
129-
shouldContain("make sure the provided value is an integer number")
128+
shouldContain("Value: `0.0`") // The bound value.
129+
shouldContain("an integer number is required for this field type")
130130
}
131131

132132
@Test
133133
fun `with floating-point number specified for upper bound of 'int32' field`() =
134134
assertCompilationFails(RangeInvalidUpperInt::class) { field ->
135135
shouldContain(field.qualifiedName)
136-
shouldContain("could not parse the `15.0` bound value")
137-
shouldContain("make sure the provided value is an integer number")
136+
shouldContain("Value: `15.0`") // The bound value.
137+
shouldContain("an integer number is required for this field type")
138138
}
139139

140140
@Test
@@ -151,33 +151,33 @@ internal class RangePolicySpec : CompilationErrorTest() {
151151
assertCompilationFails(RangeWithNonExistingFieldBound::class) { field ->
152152
shouldContain(RANGE)
153153
shouldContain(field.qualifiedName)
154-
shouldContain("`timestamp.minutes`")
155-
shouldContain("make sure the provided field path is valid")
154+
shouldContain("Field path: `timestamp.minutes`")
155+
shouldContain("make sure the field path refers to a valid field")
156156
}
157157

158158
@Test
159159
fun `with a non-numeric field as a bound`() =
160160
assertCompilationFails(RangeWithNonNumericFieldBound::class) { field ->
161161
shouldContain(RANGE)
162162
shouldContain(field.qualifiedName)
163-
shouldContain("cannot use `error.type` field")
164-
shouldContain("Only singular numeric fields are supported")
163+
shouldContain("Field path: `error.type`")
164+
shouldContain("the specified field is not of a numeric type")
165165
}
166166

167167
@Test
168168
fun `with a repeated field as a bound`() =
169169
assertCompilationFails(RangeWithRepeatedFieldBound::class) { field ->
170170
shouldContain(RANGE)
171171
shouldContain(field.qualifiedName)
172-
shouldContain("cannot use `error_code` field")
173-
shouldContain("Only singular numeric fields are supported")
172+
shouldContain("Field path: `error_code`")
173+
shouldContain("the specified field is not of a numeric type")
174174
}
175175

176176
@Test
177177
fun `with self as a bound`() =
178178
assertCompilationFails(RangeWithSelfReferencing::class) { field ->
179179
shouldContain(RANGE)
180180
shouldContain(field.qualifiedName)
181-
shouldContain("self-referencing is prohibited")
181+
shouldContain("self-referencing is not allowed")
182182
}
183183
}

0 commit comments

Comments
 (0)