### Question:
OneLineFormatter extends Formatter { @Override public String format(LogRecord x) { StringBuilder sb = new StringBuilder(); sb.append(String.format("%6d",System.currentTimeMillis() - FIRST_TIME) ) .append(" ") .append(String.format("%-7s",x.getLevel().getName())) .append(formatMessage(x)); if (x.getThrown() != null) { try { sb.append(LF).append("exception: "); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); x.getThrown().printStackTrace(pw); pw.close(); sb.append(sw.toString()); } catch (Exception ex) { sb.append("while retrieving exception: "); sb.append(ex.getMessage()); sb.append(" "); } } sb.append(LF); return sb.toString(); }  @Override String format(LogRecord x);  }### Answer:
@Test void test_oneline_format() { OneLineFormatter f = new OneLineFormatter(); LogRecord x = new LogRecord(Level.INFO,"test"); x.setThrown(new IllegalArgumentException()); assertThat(f.format(x), CoreMatchers.containsString("exception: java.lang.IllegalArgumentException")); }