### Question:
DefaultFormatter implements Formatter { public static String formatEntry(Entry<Key,Value> entry, boolean showTimestamps) { DateFormat timestampFormat = null; if (showTimestamps) { timestampFormat = formatter.get(); } return formatEntry(entry, timestampFormat); }  @Override void initialize(Iterable<Entry<Key,Value>> scanner, FormatterConfig config); @Override boolean hasNext(); @Override String next(); @Override void remove(); static String formatEntry(Entry<Key,Value> entry, boolean showTimestamps); static String formatEntry(Entry<Key,Value> entry, DateFormat timestampFormat); String formatEntry(Entry<Key,Value> entry); static String formatEntry(Entry<Key,Value> entry, FormatterConfig config); static StringBuilder appendText(StringBuilder sb, Text t, int shownLength); Iterator<Entry<Key,Value>> getScannerIterator();  }### Answer:
@Test public void testFormatEntry() { final long timestamp = 0; Map<Key,Value> map = new TreeMap<>(); map.put(new Key("a", "ab", "abc", timestamp), new Value("abcd")); FormatterConfig config; String answer; config = new FormatterConfig(); df = new DefaultFormatter(); df.initialize(map.entrySet(), config); answer = df.next(); assertEquals("a ab:abc []\tabcd", answer); config.setPrintTimestamps(true); df = new DefaultFormatter(); df.initialize(map.entrySet(), config); answer = df.next(); assertEquals("a ab:abc [] " + timestamp + "\tabcd", answer); config.setPrintTimestamps(true).setShownLength(1); df = new DefaultFormatter(); df.initialize(map.entrySet(), config); answer = df.next(); assertEquals("a a:a [] " + timestamp + "\ta", answer); config.setPrintTimestamps(true).doNotLimitShowLength() .setDateFormatSupplier(DateFormatSupplier.createSimpleFormatSupplier("YYYY")); df = new DefaultFormatter(); df.initialize(map.entrySet(), config); answer = df.next(); assertEquals("a ab:abc [] 1970\tabcd", answer); config.setPrintTimestamps(true).doNotLimitShowLength() .setDateFormatSupplier(DateFormatSupplier.createSimpleFormatSupplier("HH", UTC)); df = new DefaultFormatter(); df.initialize(map.entrySet(), config); answer = df.next(); assertEquals("a ab:abc [] 00\tabcd", answer); config.setPrintTimestamps(true).doNotLimitShowLength() .setDateFormatSupplier(DateFormatSupplier.createSimpleFormatSupplier("HH", EST)); df = new DefaultFormatter(); df.initialize(map.entrySet(), config); answer = df.next(); assertEquals("a ab:abc [] 19\tabcd", answer); }