use of au.com.dius.pact.provider.junit.VerificationReports in project pact-jvm by DiUS.
the class BaseTarget method setupReporters.
protected void setupReporters(ProviderVerifier verifier, String name, String description) {
String reportDirectory = "target/pact/reports";
String[] reports = new String[] {};
boolean reportingEnabled = false;
VerificationReports verificationReports = testClass.getAnnotation(VerificationReports.class);
if (verificationReports != null) {
reportingEnabled = true;
reportDirectory = verificationReports.reportDir();
reports = verificationReports.value();
} else if (valueResolver.propertyDefined("pact.verification.reports")) {
reportingEnabled = true;
reportDirectory = valueResolver.resolveValue("pact.verification.reportDir:" + reportDirectory);
reports = valueResolver.resolveValue("pact.verification.reports:").split(",");
}
if (reportingEnabled) {
File reportDir = new File(reportDirectory);
reportDir.mkdirs();
verifier.setReporters(Seq.of(reports).filter(r -> !r.isEmpty()).map(r -> {
VerifierReporter reporter = ReporterManager.createReporter(r.trim());
reporter.setReportDir(reportDir);
reporter.setReportFile(new File(reportDir, name + " - " + description + reporter.getExt()));
return reporter;
}).toList());
}
}
Aggregations