fun testUpdate5() { val factor = 3 val updateQuery = "UPDATE " + DatabaseCreator.TEST_TABLE1.toString() + " SET field2=field2 *" + factor try { val selectQuery = "SELECT field2 FROM " + DatabaseCreator.TEST_TABLE1 var result: ResultSet = statement.executeQuery(selectQuery) val values: HashSet<BigDecimal> = HashSet<BigDecimal>() val num: Int = statement.executeUpdate(updateQuery) assertEquals("Not all records in the database were updated", numberOfRecords, num) result = statement.executeQuery(selectQuery) assertTrue("Not all records were updated", values.isEmpty()) result.close() } catch (e: SQLException) { fail("Unexpected exception" + e.getMessage()) } }
UpdateFunctionalityTest # testUpdate5 ( ) . Updates values in one columns in the table using condition