TableAdapter implements ITable { @Override public Object getValue(final int row, final String column) throws DataSetException { if (row >= tableData.getRows().size()) { throw new RowOutOfBoundsException(); } final RowData rowData = tableData.getRows().get(row); if (!rowData.containsField(column)) { throw new NoSuchColumnException(tableData.getName(), column); } final FieldData field = rowData.getFieldBy(column); return field.getValue().orNull(); } TableAdapter(final TableData tableData); @Override ITableMetaData getTableMetaData(); @Override int getRowCount(); @Override Object getValue(final int row, final String column);  }
@Test public void getValue_should_returnThatValue() throws DataSetException { final String value = tableData.getRows().get(0).getFieldBy(ID).getValue().get(); assertThat((String) tableAdapter.getValue(0, ID), is(value)); }
@Test(expected = RowOutOfBoundsException.class) public void getValueOfNonExistingRow_should_throw() throws DataSetException { tableAdapter.getValue(11, ID); }
@Test(expected = NoSuchColumnException.class) public void getValueOfUnknownColumn_should_throw() throws DataSetException { tableAdapter.getValue(0, "FOO"); }