@Test public void testTableName() throws SQLException { Mockito.when(rs.getString(7)).thenReturn("table_name"); String tableName = RowMapper.getTableName(metrics, rs); assertThat(tableName.equals("table_name")).isTrue(); verify(rs).getString(7); Mockito.when(rs.getString(7)).thenThrow(SQLException.class); tableName = RowMapper.getTableName(metrics, rs); assertThat(tableName.equals("")).isTrue(); verify(rs, times(2)).getString(7); }
public static String getTableName(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getString(TABLE_NAME); } catch (SQLException e) { logError(metrics, e, "TABLE_NAME"); return ""; } }
RowMapper { public static String getTableName(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getString(TABLE_NAME); } catch (SQLException e) { logError(metrics, e, "TABLE_NAME"); return ""; } } }
RowMapper { public static String getTableName(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getString(TABLE_NAME); } catch (SQLException e) { logError(metrics, e, "TABLE_NAME"); return ""; } }  }
RowMapper { public static String getTableName(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getString(TABLE_NAME); } catch (SQLException e) { logError(metrics, e, "TABLE_NAME"); return ""; } }  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 String getTableName(TransactionalBufferMetrics metrics, ResultSet rs) { try { return rs.getString(TABLE_NAME); } catch (SQLException e) { logError(metrics, e, "TABLE_NAME"); return ""; } }  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; }