public void testGetColumnType(){
  int[] types={Types.SMALLINT,Types.VARCHAR,Types.VARCHAR};
  try {
    for (int i=0; i < rsmd.getColumnCount(); i++) {
      int type=rsmd.getColumnType(i + 1);
      assertEquals(types[i],type);
    }
  }
 catch (  SQLException e) {
    fail("SQLException is thrown: " + e.getMessage());
  }
  try {
    rsmd.getColumnType(0);
    fail("SQLException is not thrown");
  }
 catch (  SQLException e) {
  }
  try {
    rsmd.getColumnType(5);
    fail("SQLException is not thrown");
  }
 catch (  SQLException e) {
  }
}

public void testGetColumnType ( ) { int [ ] types = { Types . SMALLINT , Types . VARCHAR , Types . VARCHAR } ; try { for ( int i = 0 ; i < rsmd . getColumnCount ( ) ; i ++ ) { int type = rsmd . getColumnType ( i + 1 ) ; assertEquals ( types [ i ] , type ) ; } } catch ( SQLException e ) { fail ( "SQLException is thrown: " + e . getMessage ( ) ) ; } try { rsmd . getColumnType ( 0 ) ; fail ( "SQLException is not thrown" ) ; } catch ( SQLException e ) { } try { rsmd . getColumnType ( 5 ) ; fail ( "SQLException is not thrown" ) ; } catch ( SQLException e ) { } }
for extensive tests see : resultsetgettertest . testgetmetadata
