Example #1
0
  @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);
    }
  }
Example #2
0
  @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]);
      }
    }
  }
Example #3
0
 @Test(expectedExceptions = {ArrayIndexOutOfBoundsException.class})
 public void testColumnTypeTableIndexTooLarge() {
   reader.getColumnTypes(reader.getTableCount());
 }
Example #4
0
 @Test
 public void testColumnTypeInvalidTableNames() {
   assertNull(reader.getColumnTypes(null));
   assertNull(reader.getColumnTypes(INVALID_TABLE));
 }
Example #5
0
 @Test(expectedExceptions = {ArrayIndexOutOfBoundsException.class})
 public void testColumnTypeTableIndexTooSmall() {
   reader.getColumnTypes(-1);
 }