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