### Question:
CompactFormatter extends java.util.logging.Formatter { public String formatLevel(final LogRecord record) { return record.getLevel().getLocalizedName(); } CompactFormatter();  CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord record); String formatMessage(final Throwable t); String formatLevel(final LogRecord record); String formatSource(final LogRecord record); String formatLoggerName(final LogRecord record); String formatThrown(final LogRecord record); String formatBackTrace(LogRecord record);  }### Answer:
@Test public void testFormatLevel() { CompactFormatter cf = new CompactFormatter(); LogRecord record = new LogRecord(Level.SEVERE, ""); String result = cf.formatLevel(record); assertEquals(record.getLevel().getLocalizedName(), result); }
@Test(expected = NullPointerException.class) public void testFormatLevelNull() { CompactFormatter cf = new CompactFormatter(); cf.formatLevel((LogRecord) null); fail(cf.toString()); }