|
57 | 57 | import java.util.stream.Stream; |
58 | 58 |
|
59 | 59 | import org.assertj.core.api.Condition; |
| 60 | +import org.jetbrains.annotations.NotNull; |
60 | 61 | import org.jspecify.annotations.Nullable; |
61 | 62 | import org.junit.jupiter.api.AfterAll; |
62 | 63 | import org.junit.jupiter.api.AfterEach; |
@@ -558,10 +559,10 @@ void failsWithMeaningfulErrorWhenTooFewArgumentsProvidedForFieldInjection() { |
558 | 559 | var results = executeTestsForClass(NotEnoughArgumentsForFieldsTestCase.class); |
559 | 560 |
|
560 | 561 | results.containerEvents().assertThatEvents() // |
561 | | - .haveExactly(1, finishedWithFailure(message( |
| 562 | + .haveExactly(1, finishedWithFailure(message(withPlatformSpecificLineSeparator( |
562 | 563 | """ |
563 | 564 | Configuration error: @ParameterizedClass has 2 required parameters (due to field injection) but there was 1 argument provided. |
564 | | - Note: the provided arguments were [1]"""))); |
| 565 | + Note: the provided arguments were [1]""")))); |
565 | 566 | } |
566 | 567 | } |
567 | 568 |
|
@@ -737,12 +738,12 @@ void failsForLifecycleMethodWithInvalidParameters() { |
737 | 738 |
|
738 | 739 | var results = executeTestsForClass(LifecycleMethodWithInvalidParametersTestCase.class); |
739 | 740 |
|
740 | | - var expectedMessage = """ |
741 | | - 2 configuration errors: |
742 | | - - parameter 'value' with index 0 is incompatible with the parameter declared on the parameterized class: \ |
743 | | - expected type 'int' but found 'long' |
744 | | - - parameter 'anotherValue' with index 1 must not be annotated with @ConvertWith"""// |
745 | | - .replace("\n", System.lineSeparator()); // use platform-specific line separators |
| 741 | + var expectedMessage = withPlatformSpecificLineSeparator( |
| 742 | + """ |
| 743 | + 2 configuration errors: |
| 744 | + - parameter 'value' with index 0 is incompatible with the parameter declared on the parameterized class: \ |
| 745 | + expected type 'int' but found 'long' |
| 746 | + - parameter 'anotherValue' with index 1 must not be annotated with @ConvertWith"""); |
746 | 747 |
|
747 | 748 | var failedResult = getFirstTestExecutionResult(results.containerEvents().failed()); |
748 | 749 | assertThat(failedResult.getThrowable().orElseThrow()) // |
@@ -805,6 +806,10 @@ void lifecycleMethodsMustNotBeDeclaredInRegularTestClasses() { |
805 | 806 | } |
806 | 807 | } |
807 | 808 |
|
| 809 | + private static @NotNull String withPlatformSpecificLineSeparator(String textBlock) { |
| 810 | + return textBlock.replace("\n", System.lineSeparator()); |
| 811 | + } |
| 812 | + |
808 | 813 | // ------------------------------------------------------------------- |
809 | 814 |
|
810 | 815 | private static Stream<String> invocationDisplayNames(EngineExecutionResults results) { |
|
0 commit comments