From e54f48cdb03ec5b9fc1c73582b8f5fbb4de875ce Mon Sep 17 00:00:00 2001 From: Richard Richter Date: Tue, 4 May 2021 10:41:19 +0200 Subject: [PATCH] TestMonitor.java: javadoc fixes --- .../midpoint/tools/testng/TestMonitor.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/test-ng/src/main/java/com/evolveum/midpoint/tools/testng/TestMonitor.java b/tools/test-ng/src/main/java/com/evolveum/midpoint/tools/testng/TestMonitor.java index 92ba1d7ebdd..10e4486f82f 100644 --- a/tools/test-ng/src/main/java/com/evolveum/midpoint/tools/testng/TestMonitor.java +++ b/tools/test-ng/src/main/java/com/evolveum/midpoint/tools/testng/TestMonitor.java @@ -36,7 +36,7 @@ public class TestMonitor { * Name of a system property that specifies file name prefix for report. * If system property is null, report is dumped to standard output. * Specified file name prefix can be absolute or relative from working directory, - * e.g. {@code target/perf-report}. + * e.g. `target/perf-report`. */ public static final String PERF_REPORT_PREFIX_PROPERTY_NAME = "mp.perf.report.prefix"; @@ -48,15 +48,16 @@ public class TestMonitor { /** * Collection of report sections that will be formatted using {@link #dumpReport(String)}. - * which can be extended in two ways: - * + * This can be extended in one of these ways: + * + * * Directly by using {@link #addReportSection(String)} and then filling the returned + * {@link TestReportSection}. + * * Using {@link #addReportCallback(ReportCallback)} which can be registered beforehand. */ private final List reportSections = new ArrayList<>(); /** - * + * Callbacks that are called during the report dump, see {@link #addReportCallback)}. */ private final List reportCallbacks = new ArrayList<>(); @@ -95,6 +96,12 @@ public Split stopwatchStart(String name, String description) { return stopwatch(name, description).start(); } + /** + * This registers the callback that will be executed during the report dump and can be used + * to add new sections. + * The advantage of callback is that it can be prepared during the initialization of the test + * monitor without the need to change the point where the dump occurs (some `@After...` method). + */ public TestMonitor addReportCallback(ReportCallback reportCallback) { reportCallbacks.add(reportCallback); return this; @@ -122,7 +129,7 @@ public void dumpReport(String testName) { new FileOutputStream(filename)))) { dumpReport(reportMetadata, out); } catch (FileNotFoundException e) { - System.out.println("Creating report file failed with: " + e.toString()); + System.out.println("Creating report file failed with: " + e); System.out.println("Falling back to stdout dump:"); dumpReportToStdout(reportMetadata); }