@Test public void testValidColumnTypes() { String[] tableNames = reader.getTableNames(); for (int i = 0; i < tableNames.length; i++) { Class[] typesByIndex = reader.getColumnTypes(i); Class[] typesByName = reader.getColumnTypes(tableNames[i]); assertNotNull(typesByIndex); assertNotNull(typesByName); assertEquals(typesByIndex.length, typesByName.length); for (int j = 0; j < typesByIndex.length; j++) { assertNotNull(typesByIndex[j]); assertEquals(typesByIndex[j], typesByName[j]); } } }
@Test public void testColumnCounts() { for (int i = 0; i < reader.getTableCount(); i++) { String[] names = reader.getColumnNames(i); Class[] types = reader.getColumnTypes(i); assertNotNull(names); assertNotNull(types); assertEquals(names.length, types.length); } }
@Test(expectedExceptions = {ArrayIndexOutOfBoundsException.class}) public void testColumnTypeTableIndexTooLarge() { reader.getColumnTypes(reader.getTableCount()); }
@Test public void testColumnTypeInvalidTableNames() { assertNull(reader.getColumnTypes(null)); assertNull(reader.getColumnTypes(INVALID_TABLE)); }
@Test(expectedExceptions = {ArrayIndexOutOfBoundsException.class}) public void testColumnTypeTableIndexTooSmall() { reader.getColumnTypes(-1); }