private void verifyEvent(LogEventListener listener1) { ArgumentCaptor<LogEvent> event = ArgumentCaptor.forClass(LogEvent.class); verify(listener1).onEvent(event.capture()); LogEvent value = event.getValue(); assertThat(value.getElement(), equalTo("div")); assertThat(value.getSubject(), equalTo("click()")); assertThat(value.getStatus(), equalTo(PASS)); }
@Override protected void finished(Description description) { StringBuilder sb = new StringBuilder(); sb.append("Report for ").append(description.getDisplayName()).append('\n'); String delimiter = '+' + Joiner.on('+').join(line(20), line(70), line(10), line(10)) + "+\n"; sb.append(delimiter); sb.append(String.format("|%-20s|%-70s|%-10s|%-10s|%n", "Element", "Subject", "Status", "ms.")); sb.append(delimiter); for (LogEvent e : logEvents) { sb.append( String.format( "|%-20s|%-70s|%-10s|%-10s|%n", e.getElement(), e.getSubject(), e.getStatus(), e.getDuration())); } sb.append(delimiter); log.info(sb.toString()); }