protected void assertThrows(int expectedErrorCode,Statement stat,String sql){
  try {
    stat.execute(sql);
    fail("Expected error: " + expectedErrorCode);
  }
 catch (  SQLException ex) {
    assertEquals(expectedErrorCode,ex.getErrorCode());
  }
}

protected void assertThrows ( int expectedErrorCode , Statement stat , String sql ) { try { stat . execute ( sql ) ; fail ( "Expected error: " + expectedErrorCode ) ; } catch ( SQLException ex ) { assertEquals ( expectedErrorCode , ex . getErrorCode ( ) ) ; } }
check that executing the specified query results in the specified error .
