public void testUpdate3(){
  int newValue1=-1;
  int newValue2=-2;
  String updateQuery="UPDATE " + DatabaseCreator.TEST_TABLE1 + " SET field2="+ newValue1+ ", field3="+ newValue2;
  try {
    int num=statement.executeUpdate(updateQuery);
    assertEquals("Not all records in the database were updated",numberOfRecords,num);
    String selectQuery="SELECT field2, field3 FROM " + DatabaseCreator.TEST_TABLE1;
    ResultSet result=statement.executeQuery(selectQuery);
    while (result.next()) {
    }
    result.close();
  }
 catch (  SQLException e) {
    fail("Unexpected exception" + e.getMessage());
  }
}

public void testUpdate3 ( ) { int newValue1 = - 1 ; int newValue2 = - 2 ; String updateQuery = "UPDATE " + DatabaseCreator . TEST_TABLE1 + " SET field2=" + newValue1 + ", field3=" + newValue2 ; try { int num = statement . executeUpdate ( updateQuery ) ; assertEquals ( "Not all records in the database were updated" , numberOfRecords , num ) ; String selectQuery = "SELECT field2, field3 FROM " + DatabaseCreator . TEST_TABLE1 ; ResultSet result = statement . executeQuery ( selectQuery ) ; while ( result . next ( ) ) { } result . close ( ) ; } catch ( SQLException e ) { fail ( "Unexpected exception" + e . getMessage ( ) ) ; } }
updatefunctionalitytest # testupdate3 ( ) . updates values in a several columns in the table
