use of org.assertj.core.api.AutoCloseableSoftAssertions in project assertj-core by joel-costigliola.
the class AutoClosableSoftAssertionsLineNumberTest method should_print_line_numbers_of_failed_assertions.
@Test
public void should_print_line_numbers_of_failed_assertions() {
try {
AutoCloseableSoftAssertions softly = new AutoCloseableSoftAssertions();
softly.assertThat(1).isLessThan(0).isLessThan(1);
softly.close();
fail("Should not reach here");
} catch (SoftAssertionError e) {
assertThat(e).hasMessageContaining(format("1) %n" + "Expecting:%n" + " <1>%n" + "to be less than:%n" + " <0> %n" + "at AutoClosableSoftAssertionsLineNumberTest.should_print_line_numbers_of_failed_assertions(AutoClosableSoftAssertionsLineNumberTest.java:34)%n" + "2) %n" + "Expecting:%n" + " <1>%n" + "to be less than:%n" + " <1> %n" + "at AutoClosableSoftAssertionsLineNumberTest.should_print_line_numbers_of_failed_assertions(AutoClosableSoftAssertionsLineNumberTest.java:35)"));
}
}
Aggregations