}
public void testCreation4() {
logger.log(BasicLevel.DEBUG, "Start testCreation4");
logger.log(BasicLevel.DEBUG, "Create Employee");
Employee e1 = new Employee("e1", null);
PersistenceManager pm = pmf.getPersistenceManager();
pm.makePersistent(e1);
Object eId = pm.getObjectId(e1);
Assert.assertNotNull("null object identifier", eId);
Employee e2 = new Employee("e2");
e1.addFriend(e2);
Assert.assertEquals("Bad friends set size", e1.getFriendsCol().size(), 1);
Assert.assertTrue("Bad friends set content", e1.getFriendsCol().contains(e2));
e1.addInt(1);
Assert.assertEquals("Bad ints set size", e1.getIntsCol().size(), 1);
Assert.assertTrue("Bad ints set content", e1.getIntsCol().contains(new Integer(1)));
pm.close();
e1 = null;
pm = pmf.getPersistenceManager();
e1 = (Employee) pm.getObjectById(eId, true);
Assert.assertNotNull("null instance returned by getObjectById", e1);
Assert.assertEquals("Bad employee name", "e1", e1.getName());
Assert.assertNotNull("null collection returned by getObjectById", e1.getFriendsCol());
Assert.assertEquals("Bad friends set size", e1.getFriendsCol().size(), 1);
Assert.assertTrue("Bad friends set content", e1.getFriendsCol().iterator().hasNext());
Assert.assertNotNull("Bad friends set content", e1.getFriendsCol().iterator().next());
Assert.assertEquals("Bad friends set content", ((Employee) e1.getFriendsCol().iterator().next()).getName(), "e2");
Assert.assertNotNull("null collection returned by getObjectById", e1.getIntsCol());
Assert.assertEquals("Bad ints set size", e1.getIntsCol().size(), 1);
Assert.assertTrue("Bad ints set content", e1.getIntsCol().iterator().hasNext());
Assert.assertNotNull("Bad ints set content", e1.getIntsCol().iterator().next());
Assert.assertTrue("Bad ints set content", e1.getIntsCol().contains(new Integer(1)));
Object o = e2.getName();
pm.currentTransaction().begin();
pm.deletePersistent(e1);
pm.deletePersistent(e2);
pm.currentTransaction().commit();
pm.close();