Last active
November 6, 2015 09:44
-
-
Save Rene-Frerichs/bbc07e44f514e6d1e5fe to your computer and use it in GitHub Desktop.
AssertJ SoftAssertion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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