File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed
runtime/src/test/kotlin/io/spine/validate
validating/src/testFixtures/kotlin/io/spine/validation/assertions Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ internal class EnclosedMessageValidationSpec : ValidationOfConstraintTest() {
98
98
validate(msg)
99
99
100
100
val violation = singleViolation()
101
- violation.message.format () shouldContain " is invalid"
101
+ violation.message.formatUnsafe () shouldContain " is invalid"
102
102
assertFieldPathIs(
103
103
violation,
104
104
ENCLOSED_FIELD_NAME
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ import com.google.protobuf.Message
31
31
import io.kotest.matchers.collections.shouldBeEmpty
32
32
import io.kotest.matchers.collections.shouldHaveSize
33
33
import io.kotest.matchers.shouldBe
34
+ import io.kotest.matchers.string.shouldContain
35
+ import io.kotest.matchers.string.shouldNotBeEmpty
36
+ import io.kotest.matchers.string.shouldNotContain
34
37
import io.spine.validate.Validate.violationsOf
35
38
import org.junit.jupiter.api.Assertions.assertDoesNotThrow
36
39
import org.junit.jupiter.api.assertThrows
@@ -152,11 +155,7 @@ abstract class ValidationOfConstraintTest {
152
155
153
156
private fun assertHasCorrectFormat (violation : ConstraintViolation ? ) {
154
157
val template = violation!! .message.withPlaceholders
155
- val placeholders = violation.message.placeholderValueMap
156
- assertThat(template).isNotEmpty()
157
- assertDoesNotThrow {
158
- checkPlaceholdersHasValue(template, placeholders)
159
- }
158
+ template.shouldNotBeEmpty()
160
159
}
161
160
162
161
private fun assertHasFieldPath (violation : ConstraintViolation ? ) {
Original file line number Diff line number Diff line change @@ -37,7 +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.format
40
+ import io.spine.validate.formatUnsafe
41
41
import org.junit.jupiter.api.Assertions.assertDoesNotThrow
42
42
import org.junit.jupiter.api.Assertions.assertThrows
43
43
import org.junit.jupiter.api.Assertions.fail
@@ -90,7 +90,7 @@ fun assertViolation(
90
90
.contains(field)
91
91
92
92
val violation = violations.atField(field)
93
- violation.message.format () shouldContain errorMessagePart
93
+ violation.message.formatUnsafe () shouldContain errorMessagePart
94
94
}
95
95
96
96
/* *
You can’t perform that action at this time.
0 commit comments