SimpleClassNameToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { statement.setString(index, getSimpleClassName(logEntry.getClassName())); } SimpleClassNameToken(); @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 applyClassWithPackage() throws SQLException { SimpleClassNameToken token = new SimpleClassNameToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry("my.package.TestClass"), statement, 1); verify(statement).setString(1, "TestClass"); }
@Test public void applyClassWithoutPackage() throws SQLException { SimpleClassNameToken token = new SimpleClassNameToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry("AnotherClass"), statement, 1); verify(statement).setString(1, "AnotherClass"); }