FileNameToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { statement.setString(index, logEntry.getFileName()); } FileNameToken(); @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 applyFileName() throws SQLException { FileNameToken token = new FileNameToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry("TestClass.java"), statement, 1); verify(statement).setString(1, "TestClass.java"); }
@Test public void applyNull() throws SQLException { FileNameToken token = new FileNameToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(null), statement, 1); verify(statement).setString(1, null); }