TableStructure { public AbstractComponent getValue(int rowIndex, int columnIndex) { try { if (rowIndex < 0 || rowIndex >= getRowCount()) { logger.warn("Row index " + rowIndex + " > " + (getRowCount() - 1)); } if (columnIndex < 0 || columnIndex >= columnCount) { logger.warn("Column index " + columnIndex + " > " + (columnCount - 1)); } if (rowList.size() > 0) { TableRow row = rowList.get(rowIndex); if (row.size() > 0 && columnIndex < row.size()) { return row.get(columnIndex).getValue(); } else { return null; } } else { return null; } } catch (IndexOutOfBoundsException outOfBoundsException) { logger.warn("IndexOutOfBoundsException: {0}", outOfBoundsException); return null; } } TableStructure(TableType type, AbstractComponent rootComponent); void notifyTableStructureChanged(); int getRowCount(); int getColumnCount(); boolean isSkeleton(); AbstractComponent getValue(int rowIndex, int columnIndex); void setValue(int rowIndex, int columnIndex, boolean isInsertRow, boolean isInsertColumn, AbstractComponent value); boolean canSetValue(int rowIndex, int columnIndex, boolean isInsertRow, boolean isInsertColumn); AbstractComponent getModifiedComponent(int rowIndex, int columnIndex, boolean isInsertRow, boolean isInsertColumn); TableType getType();  }
@Test(dataProvider="badIndexTests") public void testGetValueBadRowCount(TableType type, int rowIndex, int columnIndex) { TableStructure structure = getTableStructure(type); structure.getValue(rowIndex, columnIndex); }
@Test public void testGetValue() { assertSame(zeroDimensional.getValue(0, 0), a0); assertSame(oneDimensional.getValue(0, 0), a1); assertSame(oneDimensional.getValue(1, 0), a2); assertSame(oneDimensional.getValue(2, 0), a3); assertSame(twoDimensional.getValue(0, 0), c1); assertSame(twoDimensional.getValue(0, 1), c2); assertSame(twoDimensional.getValue(0, 2), c3); assertSame(twoDimensional.getValue(1, 0), d1); assertSame(twoDimensional.getValue(1, 1), d2); assertNull(twoDimensional.getValue(1, 2)); assertSame(twoDimensional.getValue(2, 0), e1); assertSame(twoDimensional.getValue(2, 1), e2); assertNull(twoDimensional.getValue(2, 2)); }