@Test public void applyNeitherMessageNorException() throws SQLException { MessageAndExceptionToken token = new MessageAndExceptionToken(Collections.emptyList()); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(null, null), statement, 1); verify(statement).setString(1, null); }
@Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { if (logEntry.getException() == null) { statement.setString(index, logEntry.getMessage()); } else { StringBuilder builder = new StringBuilder(); render(logEntry, builder); statement.setString(index, builder.toString()); } }
MessageAndExceptionToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { if (logEntry.getException() == null) { statement.setString(index, logEntry.getMessage()); } else { StringBuilder builder = new StringBuilder(); render(logEntry, builder); statement.setString(index, builder.toString()); } } }
MessageAndExceptionToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { if (logEntry.getException() == null) { statement.setString(index, logEntry.getMessage()); } else { StringBuilder builder = new StringBuilder(); render(logEntry, builder); statement.setString(index, builder.toString()); } } MessageAndExceptionToken(final List<ThrowableFilter> filters); }
MessageAndExceptionToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { if (logEntry.getException() == null) { statement.setString(index, logEntry.getMessage()); } else { StringBuilder builder = new StringBuilder(); render(logEntry, builder); statement.setString(index, builder.toString()); } } MessageAndExceptionToken(final List<ThrowableFilter> filters); @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); }
MessageAndExceptionToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { if (logEntry.getException() == null) { statement.setString(index, logEntry.getMessage()); } else { StringBuilder builder = new StringBuilder(); render(logEntry, builder); statement.setString(index, builder.toString()); } } MessageAndExceptionToken(final List<ThrowableFilter> filters); @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);  }