Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 75   Methods: 7
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LockMapTest.java - 94.4% 85.7% 92%
coverage coverage
 1    /*
 2    * JBoss, the OpenSource J2EE webOS
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7    package org.jboss.cache.lock;
 8   
 9    import junit.framework.TestCase;
 10   
 11    /**
 12    * @author Ben Wang
 13    */
 14    public class LockMapTest extends TestCase
 15    {
 16    private LockMap map_;
 17   
 18    /**
 19    * Constructor for LockMapTest.
 20    *
 21    * @param arg0
 22    */
 23  3 public LockMapTest(String arg0)
 24    {
 25  3 super(arg0);
 26    }
 27   
 28  0 public static void main(String[] args)
 29    {
 30  0 junit.textui.TestRunner.run(LockMapTest.class);
 31    }
 32   
 33    /*
 34    * @see TestCase#setUp()
 35    */
 36  3 protected void setUp() throws Exception
 37    {
 38  3 super.setUp();
 39  3 map_ = new LockMap();
 40    }
 41   
 42    /*
 43    * @see TestCase#tearDown()
 44    */
 45  3 protected void tearDown() throws Exception
 46    {
 47  3 super.tearDown();
 48  3 map_.removeAll();
 49    }
 50   
 51  1 final public void testIsOwner()
 52    {
 53  1 map_.addReader(this);
 54  1 assertTrue(map_.isOwner(this, LockMap.OWNER_READ));
 55  1 map_.setWriterIfNotNull(this);
 56  1 assertTrue(map_.isOwner(this, LockMap.OWNER_WRITE));
 57  1 assertTrue(map_.isOwner(this, LockMap.OWNER_ANY));
 58  1 map_.removeAll();
 59    }
 60   
 61  1 final public void testAddReader()
 62    {
 63  1 map_.addReader(this);
 64  1 assertTrue(map_.isOwner(this, LockMap.OWNER_READ));
 65  1 map_.removeReader(this);
 66    }
 67   
 68  1 final public void testAddWriter()
 69    {
 70  1 map_.setWriterIfNotNull(this);
 71  1 assertTrue(map_.writerOwner().equals(this));
 72  1 map_.removeWriter();
 73    }
 74   
 75    }