@Test public void testChangeTime() throws SQLException { Mockito.when(rs.getTimestamp(4)).thenReturn(new Timestamp(1000L)); Timestamp time = RowMapper.getChangeTime(metrics, rs); assertThat(time.getTime() == 1000L).isTrue(); Mockito.when(rs.getTimestamp(4)).thenThrow(SQLException.class); time = RowMapper.getChangeTime(metrics, rs); assertThat(time.getTime() == new Timestamp(Instant.now().getEpochSecond()).getTime()).isTrue(); verify(rs, times(2)).getTimestamp(4); }
public static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getTimestamp(CHANGE_TIME); } catch (SQLException e) { logError(metrics, e, "CHANGE_TIME"); return new Timestamp(Instant.now().getEpochSecond()); } }
RowMapper { public static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getTimestamp(CHANGE_TIME); } catch (SQLException e) { logError(metrics, e, "CHANGE_TIME"); return new Timestamp(Instant.now().getEpochSecond()); } } }
RowMapper { public static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getTimestamp(CHANGE_TIME); } catch (SQLException e) { logError(metrics, e, "CHANGE_TIME"); return new Timestamp(Instant.now().getEpochSecond()); } }  }
RowMapper { public static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getTimestamp(CHANGE_TIME); } catch (SQLException e) { logError(metrics, e, "CHANGE_TIME"); return new Timestamp(Instant.now().getEpochSecond()); } }  static String getOperation(TransactionalBufferMetrics metrics, ResultSet rs); static String getUsername(TransactionalBufferMetrics metrics, ResultSet rs); static int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs); static String getTableName(TransactionalBufferMetrics metrics, ResultSet rs); static String getSegOwner(TransactionalBufferMetrics metrics, ResultSet rs); static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs); static BigDecimal getScn(TransactionalBufferMetrics metrics, ResultSet rs); static String getTransactionId(TransactionalBufferMetrics metrics, ResultSet rs); static String getSqlRedo(TransactionalBufferMetrics metrics, ResultSet rs); static TableId getTableId(String catalogName, ResultSet rs); }
RowMapper { public static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getTimestamp(CHANGE_TIME); } catch (SQLException e) { logError(metrics, e, "CHANGE_TIME"); return new Timestamp(Instant.now().getEpochSecond()); } }  static String getOperation(TransactionalBufferMetrics metrics, ResultSet rs); static String getUsername(TransactionalBufferMetrics metrics, ResultSet rs); static int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs); static String getTableName(TransactionalBufferMetrics metrics, ResultSet rs); static String getSegOwner(TransactionalBufferMetrics metrics, ResultSet rs); static Timestamp getChangeTime(TransactionalBufferMetrics metrics, ResultSet rs); static BigDecimal getScn(TransactionalBufferMetrics metrics, ResultSet rs); static String getTransactionId(TransactionalBufferMetrics metrics, ResultSet rs); static String getSqlRedo(TransactionalBufferMetrics metrics, ResultSet rs); static TableId getTableId(String catalogName, ResultSet rs); static final int INSERT; static final int DELETE; static final int UPDATE; static final int DDL; static final int COMMIT; static final int MISSING_SCN; static final int ROLLBACK; }