### Question:
MessageCollector implements Messages { <E extends Exception> void replayMessages(ExceptionFactory<E> efactory, final List<Message> messages) throws E { messages.forEach(message -> collect(message)); throwExceptionIfThereWereErrorMessages(efactory); } MessageCollector(Logger log); @Override void info(File resource, int line, int column, String message, Throwable cause); @Override void warn(File resource, int line, int column, String message, Throwable cause); @Override void error(File resource, int line, int column, String message, Throwable cause); @Override void info(Path resource, int line, int column, String message, Throwable cause); @Override void warn(Path resource, int line, int column, String message, Throwable cause); @Override void error(Path resource, int line, int column, String message, Throwable cause);  }### Answer:
@Test(expected = BuilderExecutionException.class) public void testMessageReplay_error() throws Exception { List<Message> messages = new ArrayList<>(); messages.add(new Message(new File("").toString(), 0, 0, "error", MessageSeverity.ERROR, null)); testee.replayMessages(BuilderExecutionException::new, messages); }