private 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 (systemPropertyResolver.propertyDefined("pact.verification.reports")) { reportingEnabled = true; reportDirectory = systemPropertyResolver.resolveValue("pact.verification.reportDir:" + reportDirectory); reports = systemPropertyResolver.resolveValue("pact.verification.reports:").split(","); } if (reportingEnabled) { File reportDir = new File(reportDirectory); reportDir.mkdirs(); verifier.setReporters(Arrays.stream(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; }).collect(Collectors.toList())); } }
VerifierReporter reporter = ReporterManager.createReporter(reportType); reporter.setReportDir(reportDir); reporter.setReportFile(new File(reportDir, name + " - " + description + reporter.getExt())); return reporter;
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()); } }