AssertJ SoftAssertion
@Rule | |
public JUnitSoftAssertions softly = new JUnitSoftAssertions(); | |
String openKnowledge = "offen, kundig, gut!"; | |
@Test | |
public void exampleNormalAssertion() { | |
assertThat(openKnowledge).startsWith("kundig").endsWith("offen"); | |
// -> java.lang.AssertionError: Expecting: <"offen, kundig, gut!"> to start with: <"kundig"> | |
} | |
@Test | |
public void exampleSoftAssertion() { | |
softly.assertThat(openKnowledge).startsWith("kundig").endsWith("offen"); | |
// -> java.lang.AssertionError: Expecting: <"offen, kundig, gut!"> to start with: <"kundig"> | |
// -> java.lang.AssertionError: Expecting: <"offen, kundig, gut!"> to end with: <"offen"> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment