Пример #1
0
 @Test
 /** Test </code>item.delete()</code> when the object does not exist. */
 public void testDeleteNonexisting() {
   ZSession session = getSession();
   int numQueries = 0;
   Item item = (Item) session.getShallow(Item.META, "0");
   Assert.assertEquals(session.getNumQueries(), numQueries);
   boolean deleted = item.delete();
   Assert.assertEquals(session.getNumQueries(), ++numQueries);
   Assert.assertFalse(deleted);
 }
Пример #2
0
 @Test
 /** Test <code>item.delete()</code> when the object exists. */
 public void testDeleteExisting() {
   ZSession session = getSession();
   int numQueries = 0;
   Item item = (Item) session.get(Item.META, "1");
   Assert.assertEquals(session.getNumQueries(), ++numQueries);
   boolean deleted = item.delete();
   Assert.assertEquals(session.getNumQueries(), ++numQueries);
   Assert.assertTrue(deleted);
   boolean objectNotFound = false;
   try {
     item = (Item) session.get(Item.META, "1");
   } catch (ZormPersistentObjectNotFoundException e) {
     objectNotFound = false;
   }
   Assert.assertFalse(objectNotFound);
 }