Author: tfischer Date: Sat Sep 6 19:52:51 2014 New Revision: 1622919 URL: http://svn.apache.org/r1622919 Log: improve test readability
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SetAndSaveTest.java Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SetAndSaveTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SetAndSaveTest.java?rev=1622919&r1=1622918&r2=1622919&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SetAndSaveTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SetAndSaveTest.java Sat Sep 6 19:52:51 2014 @@ -136,6 +136,16 @@ public class SetAndSaveTest extends Base testData.save(); OIntegerPk oIntegerPk = testData.getOIntegerPkList().get(0); + // the original list size is 2, one of the object remains + // the other is removed + assertEquals(2, oIntegerPk.getNonPkOIntegerFks().size()); + // this object is removed from the list later on + assertTrue(oIntegerPk.getNonPkOIntegerFks().contains( + testData.getNonPkOIntegerFkList().get(0))); + // this object remains in the list later on + assertTrue(oIntegerPk.getNonPkOIntegerFks().contains( + testData.getNonPkOIntegerFkList().get(1))); + List<NonPkOIntegerFk> fkList = new ArrayList<NonPkOIntegerFk>(); // object already associated to this object fkList.add(testData.getNonPkOIntegerFkList().get(1)); @@ -157,7 +167,7 @@ public class SetAndSaveTest extends Base /** * Tests whether the setAndSave method works - * where the collection is euql to the cached list of the object. + * where the passed collection is the cached list of the object. * * @throws Exception if the test fails */ @@ -189,8 +199,20 @@ public class SetAndSaveTest extends Base assertSetAndSaveForOIntegerPk(testData, oIntegerPk, newNonPkOIntegerFk); } - private void assertSetAndSaveForOIntegerPk(final ForeignKeySchemaData testData, - final OIntegerPk oIntegerPk, final NonPkOIntegerFk newNonPkOIntegerFk) + /** + * Checks that the database content is expected as for SetAndSave + * for OIntegerPk. + * + * @param testData the original database content. + * @param oIntegerPk the oIntegerPk object which was saved. + * @param newNonPkOIntegerFk the new object which was added. + * + * @throws TorqueException if an error occurs + */ + private void assertSetAndSaveForOIntegerPk( + final ForeignKeySchemaData testData, + final OIntegerPk oIntegerPk, + final NonPkOIntegerFk newNonPkOIntegerFk) throws TorqueException { List<NonPkOIntegerFk> cachedFks --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org