Skip to content

Commit f9f1f77

Browse files
committed
Simplify assertion in MethodArgumentsProviderTests.ErrorCases
See #4943
1 parent 65e231c commit f9f1f77

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MethodArgumentsProviderTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,11 +667,11 @@ void throwsExceptionWhenExternalFactoryMethodHasInvalidReturnType() {
667667
var exception = assertThrows(PreconditionViolationException.class,
668668
() -> provideArguments(TestCase.class, false, factoryMethod).toArray());
669669

670-
assertThat(exception.getMessage())//
671-
.containsSubsequence("Could not find valid factory method [" + factoryMethod + "] for test class [",
672-
testClass + "]", //
673-
"but found the following invalid candidate: ",
674-
"static java.lang.Object " + factoryClass + ".factoryWithInvalidReturnType()");
670+
assertThat(exception).hasMessage("""
671+
Could not find valid factory method [%s] for test class [%s] \
672+
but found the following invalid candidate: \
673+
static java.lang.Object %s.factoryWithInvalidReturnType()\
674+
""".formatted(factoryMethod, testClass, factoryClass));
675675
}
676676

677677
@Test

0 commit comments

Comments
 (0)