JobReport implements Serializable { @Override public String toString() { String baseReport = MessageFormat.format(REPORT_FORMAT, jobName, status, parameters.getBatchSize(), Utils.formatErrorThreshold(parameters.getErrorThreshold()), parameters.isJmxMonitoring(), parameters.isBatchScanningEnabled(), Utils.formatTime(metrics.getStartTime()), Utils.formatTime(metrics.getEndTime()), Utils.formatDuration(metrics.getDuration()), metrics.getReadCount(), metrics.getWriteCount(), metrics.getFilterCount(), metrics.getErrorCount()); final StringBuilder sb = new StringBuilder(baseReport); for (Map.Entry<String, Object> customMetric : metrics.getCustomMetrics().entrySet()) { sb.append(Utils.LINE_SEPARATOR).append("\t") .append(customMetric.getKey()).append(" = ").append(customMetric.getValue()); } return sb.toString(); }  String getJobName(); JobParameters getParameters(); JobMetrics getMetrics(); JobStatus getStatus(); Throwable getLastError(); void setJobName(String jobName); void setParameters(JobParameters parameters); void setMetrics(JobMetrics metrics); void setStatus(JobStatus status); void setLastError(Throwable lastError); Properties getSystemProperties(); void setSystemProperties(Properties systemProperties); @Override String toString();  }
@Test public void testFormatReport() { String expectedReport = "Job Report:" + LINE_SEPARATOR + "===========" + LINE_SEPARATOR + "Name: job" + LINE_SEPARATOR + "Status: COMPLETED" + LINE_SEPARATOR + "Parameters:" + LINE_SEPARATOR + "\tBatch size = 100" + LINE_SEPARATOR + "\tError threshold = N/A" + LINE_SEPARATOR + "\tJmx monitoring = false" + LINE_SEPARATOR + "\tBatch scanning = false" + LINE_SEPARATOR + "Metrics:" + LINE_SEPARATOR + "\tStart time = 2020-01-20T10:15:20" + LINE_SEPARATOR + "\tEnd time = 2020-01-20T10:15:30" + LINE_SEPARATOR + "\tDuration = 10sec 0ms" + LINE_SEPARATOR + "\tRead count = 0" + LINE_SEPARATOR + "\tWrite count = 0" + LINE_SEPARATOR + "\tFilter count = 0" + LINE_SEPARATOR + "\tError count = 0" + LINE_SEPARATOR + "\tnbFoos = 1"; String formattedReport = report.toString(); assertThat(formattedReport).isEqualTo(expectedReport); }