Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 74   Methods: 4
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
HasChildTest.java - 100% 100% 100%
coverage
 1    package org.jboss.cache.optimistic;
 2   
 3    import org.jboss.cache.CacheImpl;
 4    import org.jboss.cache.Fqn;
 5   
 6    import javax.transaction.Transaction;
 7    import javax.transaction.TransactionManager;
 8   
 9    /**
 10    * Tests the hasChild() API
 11    *
 12    * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
 13    * @since 2.0.0
 14    */
 15    public class HasChildTest extends AbstractOptimisticTestCase
 16    {
 17    private CacheImpl cache;
 18    private TransactionManager txMgr;
 19    private Fqn f = Fqn.fromString("/a");
 20   
 21  1 protected void setUp() throws Exception
 22    {
 23  1 cache = createCache();
 24  1 txMgr = cache.getTransactionManager();
 25    }
 26   
 27  1 protected void tearDown()
 28    {
 29  1 destroyCache(cache);
 30    }
 31   
 32  1 public HasChildTest(String name)
 33    {
 34  1 super(name);
 35    }
 36   
 37  1 public void testExists() throws Exception
 38    {
 39  1 cache.put(f, "k", "v");
 40   
 41  1 assertTrue(cache.getRoot().hasChild(f));
 42   
 43  1 cache.remove(f);
 44   
 45  1 assertFalse(cache.getRoot().hasChild(f));
 46   
 47  1 txMgr.begin();
 48   
 49  1 cache.put(f, "k", "v");
 50  1 assertTrue(cache.getRoot().hasChild(f));
 51   
 52  1 Transaction t = txMgr.suspend();
 53  1 assertFalse(cache.getRoot().hasChild(f));
 54   
 55  1 txMgr.resume(t);
 56  1 assertTrue(cache.getRoot().hasChild(f));
 57  1 txMgr.commit();
 58   
 59  1 assertTrue(cache.getRoot().hasChild(f));
 60   
 61  1 txMgr.begin();
 62  1 assertTrue(cache.getRoot().hasChild(f));
 63  1 cache.remove(f);
 64  1 assertFalse(cache.getRoot().hasChild(f));
 65   
 66  1 t = txMgr.suspend();
 67  1 assertTrue(cache.getRoot().hasChild(f));
 68  1 txMgr.resume(t);
 69  1 assertFalse(cache.getRoot().hasChild(f));
 70  1 txMgr.commit();
 71   
 72  1 assertFalse(cache.getRoot().hasChild(f));
 73    }
 74    }