SeverityLevelIntegerToken implements Token { @Override public void apply(final LogEntry logEntry, final PreparedStatement statement, final int index) throws SQLException { statement.setInt(index, getReverseOfOrdinalAsLevelValue(logEntry)); } SeverityLevelIntegerToken(); @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 applyTrace() throws SQLException { SeverityLevelIntegerToken token = new SeverityLevelIntegerToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(Level.TRACE), statement, 1); verify(statement).setInt(1, 5); }
@Test public void applyDebug() throws SQLException { SeverityLevelIntegerToken token = new SeverityLevelIntegerToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(Level.DEBUG), statement, 1); verify(statement).setInt(1, 4); }
@Test public void applyInfo() throws SQLException { SeverityLevelIntegerToken token = new SeverityLevelIntegerToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(Level.INFO), statement, 1); verify(statement).setInt(1, 3); }
@Test public void applyWarning() throws SQLException { SeverityLevelIntegerToken token = new SeverityLevelIntegerToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(Level.WARN), statement, 1); verify(statement).setInt(1, 2); }
@Test public void applyError() throws SQLException { SeverityLevelIntegerToken token = new SeverityLevelIntegerToken(); PreparedStatement statement = mock(PreparedStatement.class); token.apply(createLogEntry(Level.ERROR), statement, 1); verify(statement).setInt(1, 1); }