### Question:
EMFMetricFormatter implements MetricFormatter { @Override public String formatSegment(final Segment segment) { int errorRate = segment.isError() ? 1 : 0; int faultRate = segment.isFault() ? 1 : 0; int throttleRate = segment.isThrottle() ? 1 : 0; int okRate = (errorRate + faultRate + throttleRate) > 0 ? 0 : 1; double duration = (segment.getEndTime() - segment.getStartTime()) * 1000; long endTimeMillis = (long) (segment.getEndTime() * 1000); String json = String.format(EMF_FORMAT, endTimeMillis, duration, errorRate, faultRate, throttleRate, okRate, segment.getTraceId().toString(), segment.getOrigin(), segment.getName()); if (logger.isDebugEnabled()) { logger.debug("Formatted segment " + segment.getName() + " as EMF: " + json); } return json; }  @Override String formatSegment(final Segment segment);  }### Answer:
@Test void testJsonFormat() { String json = formatter.formatSegment(testSegment); Assertions.assertEquals(EXPECTED_JSON, json); }
@Test void jsonContainsNoNewlines() { String json = formatter.formatSegment(testSegment); Assertions.assertFalse(json.contains("\n")); }