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

public static void assertColumnNames ( ResultSet rs , String [ ] expectedColNames ) throws SQLException { ResultSetMetaData rsmd = rs . getMetaData ( ) ; int actualCols = rsmd . getColumnCount ( ) ; for ( int i = 0 ; i < actualCols ; i ++ ) { assertEquals ( "Column names do not match:" , expectedColNames [ i ] , rsmd . getColumnName ( i + 1 ) ) ; } assertEquals ( "Unexpected column count:" , expectedColNames . length , rsmd . getColumnCount ( ) ) ; }
* test method from apache derby project class org . apache . derbytesting . functiontests . tests . jdbcapi . databasemetadatatest takes a result set and an array of expected colum names ( as strings ) and asserts that the column names in the result set metadata match the number , order , and names of those in the array .
