@Test public void testOperationCode() throws SQLException { Mockito.when(rs.getInt(3)).thenReturn(100); int operation = RowMapper.getOperationCode(metrics, rs); assertThat(operation == 100).isTrue(); verify(rs).getInt(3); Mockito.when(rs.getInt(3)).thenThrow(SQLException.class); operation = RowMapper.getOperationCode(metrics, rs); assertThat(operation == 0).isTrue(); verify(rs, times(2)).getInt(3); }
public static int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getInt(OPERATION_CODE); } catch (SQLException e) { logError(metrics, e, "OPERATION_CODE"); return 0; } }
RowMapper { public static int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getInt(OPERATION_CODE); } catch (SQLException e) { logError(metrics, e, "OPERATION_CODE"); return 0; } } }
RowMapper { public static int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getInt(OPERATION_CODE); } catch (SQLException e) { logError(metrics, e, "OPERATION_CODE"); return 0; } }  }
RowMapper { public static int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getInt(OPERATION_CODE); } catch (SQLException e) { logError(metrics, e, "OPERATION_CODE"); return 0; } }  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 int getOperationCode(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getInt(OPERATION_CODE); } catch (SQLException e) { logError(metrics, e, "OPERATION_CODE"); return 0; } }  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; }