public class JUnit5Reporter extends 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(ApprovalFiles files)
A
Reporter is called whenever a difference is found while comparing the output of a Program Under Tests and the existing approved files linked to the tests. |
public void mismatch(ApprovalFiles files)
ReporterA Reporter is called whenever a difference is found while comparing the output of a Program Under Tests and the existing approved files linked to the tests. That method is the one which will be called by the framework, specifying the approved and received files which present differences.
It is then used to implement the behavior to execute for dealing with that mismatch between both files.
mismatch in interface Reporterfiles - the ApprovalFiles which holds the approved file (which contains the data reviewed and approved by the developer) and the temporary received file (which contains the data generated by the Program Under Tests)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–2019 Write Them First!. All rights reserved.