@Test public void convertValue() { ReportEntry reportEntry = new ReportEntry("report.key", ReportEntryType.DURATION, "3842000"); JsonElement json = converter.convertValue(reportEntry); JsonElement expectedJson = new JsonParser().parse("{milliseconds: 3842000, humanReadable: \"1h 04m 02s\"}"); assertEquals(expectedJson, json); }
@Override public JsonElement convertValue(ReportEntry reportEntry) { long duration = Long.valueOf(reportEntry.getValue().toString()); JsonObject durationJson = new JsonObject(); durationJson.addProperty("milliseconds", duration); durationJson.addProperty("humanReadable", DurationFormatUtils.formatDuration(duration, "Hh mm'm' ss's'")); return durationJson; }
DurationReportValueJsonConverter implements ReportValueJsonConverter { @Override public JsonElement convertValue(ReportEntry reportEntry) { long duration = Long.valueOf(reportEntry.getValue().toString()); JsonObject durationJson = new JsonObject(); durationJson.addProperty("milliseconds", duration); durationJson.addProperty("humanReadable", DurationFormatUtils.formatDuration(duration, "Hh mm'm' ss's'")); return durationJson; } }
DurationReportValueJsonConverter implements ReportValueJsonConverter { @Override public JsonElement convertValue(ReportEntry reportEntry) { long duration = Long.valueOf(reportEntry.getValue().toString()); JsonObject durationJson = new JsonObject(); durationJson.addProperty("milliseconds", duration); durationJson.addProperty("humanReadable", DurationFormatUtils.formatDuration(duration, "Hh mm'm' ss's'")); return durationJson; }  }
DurationReportValueJsonConverter implements ReportValueJsonConverter { @Override public JsonElement convertValue(ReportEntry reportEntry) { long duration = Long.valueOf(reportEntry.getValue().toString()); JsonObject durationJson = new JsonObject(); durationJson.addProperty("milliseconds", duration); durationJson.addProperty("humanReadable", DurationFormatUtils.formatDuration(duration, "Hh mm'm' ss's'")); return durationJson; }  @Override boolean isApplicable(ReportEntryType reportEntryType); @Override JsonElement convertValue(ReportEntry reportEntry); }
DurationReportValueJsonConverter implements ReportValueJsonConverter { @Override public JsonElement convertValue(ReportEntry reportEntry) { long duration = Long.valueOf(reportEntry.getValue().toString()); JsonObject durationJson = new JsonObject(); durationJson.addProperty("milliseconds", duration); durationJson.addProperty("humanReadable", DurationFormatUtils.formatDuration(duration, "Hh mm'm' ss's'")); return durationJson; }  @Override boolean isApplicable(ReportEntryType reportEntryType); @Override JsonElement convertValue(ReportEntry reportEntry);  }