TableMetaDataAdapter implements ITableMetaData { @Override public int getColumnIndex(final String columnName) throws DataSetException { final Integer index = nameToIndexCache.get(columnName); if (index == null) { throw new NoSuchColumnException(tableType.getName(), columnName); } return index; } TableMetaDataAdapter(final TableType tableType); @Override String getTableName(); @Override Column[] getColumns(); @Override Column[] getPrimaryKeys(); @Override int getColumnIndex(final String columnName);  }
@Test public void getColumnIndexForId_should_beCorrect() throws DataSetException { assertThat(tableMetaData.getColumnIndex("ID"), is(0)); }
@Test public void getColumnIndexForName_should_beCorrect() throws DataSetException { assertThat(tableMetaData.getColumnIndex("NAME"), is(1)); }
@Test(expected = NoSuchColumnException.class) public void getColumnIndexForUnknown_should_throw() throws DataSetException { tableMetaData.getColumnIndex("FOO"); }