Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 44   Methods: 2
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
InterceptorChainTestBase.java 100% 100% 100% 100%
coverage
 1    package org.jboss.cache.factories;
 2   
 3    import junit.framework.TestCase;
 4    import org.jboss.cache.interceptors.Interceptor;
 5   
 6    import java.util.List;
 7   
 8    /**
 9    * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
 10    */
 11    public abstract class InterceptorChainTestBase extends TestCase
 12    {
 13  28 protected void assertLast(Interceptor first, Interceptor last)
 14    {
 15  28 assertNotNull("First interceptor in the chain cannot be null", first);
 16  28 assertNotNull("Last interceptor in the chain cannot be null", last);
 17   
 18  28 Interceptor i = first;
 19  28 while (i != null)
 20    {
 21  214 assertEquals("Expected last interceptor (in " + i + ") to be " + last, last, i.getLast());
 22  214 i = i.getNext();
 23    }
 24    }
 25   
 26  28 protected void assertInterceptorLinkage(List<Interceptor> list)
 27    {
 28  28 Interceptor previous = null;
 29  28 for (Interceptor i : list)
 30    {
 31  214 if (previous == null)
 32    {
 33  28 previous = i;
 34  28 continue;
 35    }
 36   
 37  186 assertEquals("Expecting the next interceptor after " + previous + " to be " + i, i, previous.getNext());
 38   
 39  186 previous = i;
 40    }
 41   
 42  28 assertLast(list.get(0), previous);
 43    }
 44    }