-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explain how to integrate with AssertJ soft assertions in README
- Loading branch information
1 parent
c105d67
commit 6f2812b
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
...de/cronn/assertions/validationfile/sample/ValidationFileWithSoftAssertionsSampleTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.cronn.assertions.validationfile.sample; | ||
|
||
import org.assertj.core.api.SoftAssertions; | ||
import org.assertj.core.api.junit.jupiter.InjectSoftAssertions; | ||
import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import de.cronn.assertions.validationfile.junit5.JUnit5ValidationFileAssertions; | ||
|
||
@Disabled("Enable to demonstrate how soft assertions work") | ||
@ExtendWith(SoftAssertionsExtension.class) | ||
class ValidationFileWithSoftAssertionsSampleTest implements JUnit5ValidationFileAssertions { | ||
|
||
@InjectSoftAssertions | ||
private SoftAssertions softly; | ||
|
||
@Override | ||
public FailedAssertionHandler failedAssertionHandler() { | ||
return callable -> softly.check(callable::call); | ||
} | ||
|
||
@Test | ||
void testSoftAssertions() throws Exception { | ||
assertWithFileWithSuffix("actual1", "file1"); | ||
assertWithFileWithSuffix("actual2", "file2"); | ||
} | ||
|
||
} |