public class JUnit5Reporter extends java.lang.Object implements Reporter
This reporter will only be available if it is able to find JUnit5 classes in the current classpath.
If it actually is available, it will allow to throw the same exceptions that JUnit 5 would send while being called for mismatches. This allows to use Approvals-Java right from your JUnit 5 Unit Tests, in some @Test methods, and fail the tests if mismatches are found.
This reporter actually uses reflection to throw the same exceptions JUnit would use.
| Constructor and Description |
|---|
JUnit5Reporter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAvailable()
Checks if the
JUNIT5_ASSERTIONS JUnit 5 class we need is present in the classpath. |
void |
mismatch(java.nio.file.Path approved,
java.nio.file.Path received)
Method called in case a mismatch is found.
|
public void mismatch(java.nio.file.Path approved,
java.nio.file.Path received)
Method called in case a mismatch is found.
mismatch in interface Reporterapproved - The Path to the approved file (which contains the data reviewed and approved by the developer)received - The Path to the temporary received file (which contains the data generated by the Program Under Tests)java.lang.AssertionError - if an actual mismatch is found. That is the exception which would be thrown by JUnit5.java.lang.RuntimeException - if something went wrong with reflection calls to JUnit framework (which should not happen if you checked isAvailable() first) happen if you checked isAvailable() first)Reporter.mismatch(Path, Path)public boolean isAvailable()
Checks if the JUNIT5_ASSERTIONS JUnit 5 class we need is present in the classpath. If so, we assume that JUnit 5 is part of the classpath and that we can use this reporter.
isAvailable in interface ReporterCopyright © 2018 Write Them First!. All rights reserved.