public static void assertColumnTypes(ResultSet rs,int[] expectedTypes) throws SQLException {
  ResultSetMetaData rsmd=rs.getMetaData();
  int actualCols=rsmd.getColumnCount();
  assertEquals("Unexpected column count:",expectedTypes.length,rsmd.getColumnCount());
  for (int i=0; i < actualCols; i++) {
    assertEquals("Column types do not match for column " + (i + 1),expectedTypes[i],rsmd.getColumnType(i + 1));
  }
}

public static void assertColumnTypes ( ResultSet rs , int [ ] expectedTypes ) throws SQLException { ResultSetMetaData rsmd = rs . getMetaData ( ) ; int actualCols = rsmd . getColumnCount ( ) ; assertEquals ( "Unexpected column count:" , expectedTypes . length , rsmd . getColumnCount ( ) ) ; for ( int i = 0 ; i < actualCols ; i ++ ) { assertEquals ( "Column types do not match for column " + ( i + 1 ) , expectedTypes [ i ] , rsmd . getColumnType ( i + 1 ) ) ; } }
test method from apache derby project class org . apache . derbytesting . functiontests . tests . jdbcapi . databasemetadatatest takes a result set and an array of expected column types from java . sql . types and asserts that the column types in the result set metadata match the number , order , and names of those in the array . no length information for variable length types can be passed . for resultsets from jdbc databasemetadata the specification only indicates the types of the columns , not the length .
