MessageToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { statement.setString(index, logEntry.getMessage()); } MessageToken(); @Override Collection<LogEntryValue> getRequiredLogEntryValues(); @Override void render(final LogEntry logEntry, final StringBuilder builder); @Override void apply(final LogEntry logEntry, final PreparedStatement statement, final int index);  }
@Test public void applyMissingMessage() throws SQLException { MessageToken token = new MessageToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(null), statement, 1); verify(statement).setString(1, null); }
@Test public void applyTextMessage() throws SQLException { MessageToken token = new MessageToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry("Hello World!"), statement, 1); verify(statement).setString(1, "Hello World!"); }