diff --git a/java-tests/runtime/src/test/kotlin/io/spine/validate/EnclosedMessageValidationSpec.kt b/java-tests/runtime/src/test/kotlin/io/spine/validate/EnclosedMessageValidationSpec.kt index 670dcef0..343d40f1 100644 --- a/java-tests/runtime/src/test/kotlin/io/spine/validate/EnclosedMessageValidationSpec.kt +++ b/java-tests/runtime/src/test/kotlin/io/spine/validate/EnclosedMessageValidationSpec.kt @@ -98,7 +98,7 @@ internal class EnclosedMessageValidationSpec : ValidationOfConstraintTest() { validate(msg) val violation = singleViolation() - violation.message.format() shouldContain "is invalid" + violation.message.formatUnsafe() shouldContain "is invalid" assertFieldPathIs( violation, ENCLOSED_FIELD_NAME diff --git a/java-tests/runtime/src/test/kotlin/io/spine/validate/ValidationOfConstraintTest.kt b/java-tests/runtime/src/test/kotlin/io/spine/validate/ValidationOfConstraintTest.kt index 8a025eca..ed6abbb5 100644 --- a/java-tests/runtime/src/test/kotlin/io/spine/validate/ValidationOfConstraintTest.kt +++ b/java-tests/runtime/src/test/kotlin/io/spine/validate/ValidationOfConstraintTest.kt @@ -31,6 +31,9 @@ import com.google.protobuf.Message import io.kotest.matchers.collections.shouldBeEmpty import io.kotest.matchers.collections.shouldHaveSize import io.kotest.matchers.shouldBe +import io.kotest.matchers.string.shouldContain +import io.kotest.matchers.string.shouldNotBeEmpty +import io.kotest.matchers.string.shouldNotContain import io.spine.validate.Validate.violationsOf import org.junit.jupiter.api.Assertions.assertDoesNotThrow import org.junit.jupiter.api.assertThrows @@ -152,11 +155,7 @@ abstract class ValidationOfConstraintTest { private fun assertHasCorrectFormat(violation: ConstraintViolation?) { val template = violation!!.message.withPlaceholders - val placeholders = violation.message.placeholderValueMap - assertThat(template).isNotEmpty() - assertDoesNotThrow { - checkPlaceholdersHasValue(template, placeholders) - } + template.shouldNotBeEmpty() } private fun assertHasFieldPath(violation: ConstraintViolation?) { diff --git a/java-tests/validating/src/testFixtures/kotlin/io/spine/validation/assertions/Assertions.kt b/java-tests/validating/src/testFixtures/kotlin/io/spine/validation/assertions/Assertions.kt index a35e322c..939cbdde 100644 --- a/java-tests/validating/src/testFixtures/kotlin/io/spine/validation/assertions/Assertions.kt +++ b/java-tests/validating/src/testFixtures/kotlin/io/spine/validation/assertions/Assertions.kt @@ -37,7 +37,7 @@ import io.kotest.matchers.string.shouldContain import io.spine.type.toJson import io.spine.validate.ConstraintViolation import io.spine.validate.ValidationException -import io.spine.validate.format +import io.spine.validate.formatUnsafe import org.junit.jupiter.api.Assertions.assertDoesNotThrow import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Assertions.fail @@ -90,7 +90,7 @@ fun assertViolation( .contains(field) val violation = violations.atField(field) - violation.message.format() shouldContain errorMessagePart + violation.message.formatUnsafe() shouldContain errorMessagePart } /**