### Question:
RowMapper { public static TableId getTableId(String catalogName, ResultSet rs) throws SQLException { return new TableId(catalogName, rs.getString(SEG_OWNER), rs.getString(TABLE_NAME)); }  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; }### Answer:
@Test public void testGetTableId() throws SQLException { Mockito.when(rs.getString(8)).thenReturn("SCHEMA"); Mockito.when(rs.getString(7)).thenReturn("TABLE"); TableId tableId = RowMapper.getTableId("CATALOG", rs); assertThat(tableId.toString().equals("CATALOG.SCHEMA.TABLE")).isTrue(); verify(rs).getString(8); Mockito.when(rs.getString(8)).thenThrow(SQLException.class); tableId = null; try { tableId = RowMapper.getTableId("catalog", rs); fail("RowMapper should not have returned a TableId"); } catch (SQLException e) { assertThat(tableId).isNull(); } }
@Test @FixFor("DBZ-2555") public void testGetTableIdWithVariedCase() throws SQLException { Mockito.when(rs.getString(8)).thenReturn("Schema"); Mockito.when(rs.getString(7)).thenReturn("table"); TableId tableId = RowMapper.getTableId("CATALOG", rs); assertThat(tableId.toString().equals("CATALOG.Schema.table")).isTrue(); verify(rs).getString(8); Mockito.when(rs.getString(8)).thenThrow(SQLException.class); tableId = null; try { tableId = RowMapper.getTableId("catalog", rs); fail("RowMapper should not have returned a TableId"); } catch (SQLException e) { assertThat(tableId).isNull(); } }