FMeasureTableRenderer { private FMeasureTableRenderer() { } private  FMeasureTableRenderer(); static FMeasureTableRenderer create(); FMeasureTableRenderer setNameFieldLength(int nameFieldLength); String render(Map<String, FMeasureCounts> fMeasureCounts); FMeasureTableRenderer sortByErrorCountDescending(); static final Function<FMeasureCounts, Float> ERROR_COUNT; static final Ordering<Map.Entry<String, FMeasureCounts>> BY_ERROR_COUNT_DESCENDING; }
@Test public void testFMeasureTableRenderer() { final FMeasureTableRenderer renderer = FMeasureTableRenderer.create(); final Map<String, FMeasureCounts> data = ImmutableMap.of( "foo", FMeasureCounts.from(1, 2, 3), "bar", FMeasureCounts.from(4, 5, 6)); final String expected = "Name TP FP FN P R F1\n" + "===============================================================================\n" + "bar 4.0 5.0 6.0 44.44 40.00 42.11\n" + "foo 1.0 2.0 3.0 33.33 25.00 28.57\n"; final String result = renderer.render(data); assertEquals(expected, result); }