File tree 3 files changed +8
-4
lines changed
java/src/main/kotlin/io/spine/validation/java
validating/src/testFixtures/kotlin/io/spine/validation/assertions
vanilla/src/test/kotlin/io/spine/validation/java
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import io.kotest.matchers.string.shouldContain
37
37
import io.spine.type.toJson
38
38
import io.spine.validate.ConstraintViolation
39
39
import io.spine.validate.ValidationException
40
+ import io.spine.validate.text.format
40
41
import org.junit.jupiter.api.Assertions.assertDoesNotThrow
41
42
import org.junit.jupiter.api.Assertions.assertThrows
42
43
import org.junit.jupiter.api.Assertions.fail
@@ -89,8 +90,7 @@ fun assertViolation(
89
90
.contains(field)
90
91
91
92
val violation = violations.atField(field)
92
-
93
- violation.msgFormat shouldContain errorMessagePart
93
+ violation.message.format() shouldContain errorMessagePart
94
94
}
95
95
96
96
/* *
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import com.google.protobuf.Message
31
31
import io.spine.testing.TestValues.randomString
32
32
import io.spine.validate.NonValidated
33
33
import io.spine.validate.Validate.violationsOf
34
+ import io.spine.validate.text.format
34
35
import io.spine.validation.java.given.Fish
35
36
import io.spine.validation.java.given.Meal
36
37
import io.spine.validation.java.given.Sauce
@@ -50,7 +51,7 @@ internal class IsRequiredSpec {
50
51
val violations = violationsOf(message)
51
52
assertThat(violations)
52
53
.hasSize(1 )
53
- assertThat(violations[0 ]!! .msgFormat )
54
+ assertThat(violations[0 ]!! .message.format() )
54
55
.contains(" choice" )
55
56
}
56
57
Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ internal class DistributingGenerator(
98
98
addModifiers(Modifier .PRIVATE )
99
99
returns(violationsType)
100
100
addCode(body)
101
- }.toString()
101
+ }
102
+ .toString() // `MethodSpec` cannot be directly added to `CodeBloc`.
103
+ .replace(" $" , " $$" ) // We need to escape `$` symbols,
104
+ // which can be present in error templates.
102
105
103
106
return otherMembers.toBuilder()
104
107
.add(groupingMethod)
You can’t perform that action at this time.
0 commit comments