Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 77   Methods: 6
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MockFailureInterceptor.java 100% 80% 66.7% 77.8%
coverage coverage
 1    package org.jboss.cache.optimistic;
 2   
 3    import org.jboss.cache.CacheSPI;
 4    import org.jboss.cache.InvocationContext;
 5    import org.jboss.cache.interceptors.Interceptor;
 6    import org.jboss.cache.marshall.MethodCall;
 7   
 8    import java.util.ArrayList;
 9    import java.util.List;
 10   
 11    /**
 12    * Handles putXXX() methods: if the given node doesn't exist, it will be created
 13    * (depending on the create_if_not_exists argument)
 14    *
 15    * @author Bela Ban
 16    * @version $Id: CreateIfNotExistsInterceptor.java,v 1.7 2005/01/26 11:45:14
 17    * belaban Exp $
 18    */
 19    public class MockFailureInterceptor extends Interceptor
 20    {
 21   
 22   
 23  2 public void setCache(CacheSPI cache)
 24    {
 25  2 super.setCache(cache);
 26    }
 27   
 28   
 29    private List allCalled = new ArrayList();
 30    private List failurelist = new ArrayList();
 31   
 32  4 public Object invoke(InvocationContext ctx) throws Throwable
 33    {
 34  4 MethodCall m = ctx.getMethodCall();
 35  4 if (failurelist.contains(m.getMethod()))
 36    {
 37  2 throw new Exception("Failure in method" + m);
 38    }
 39   
 40  2 allCalled.add(m.getMethod());
 41   
 42  2 return null;
 43    }
 44   
 45   
 46    /**
 47    * @return Returns the failurelist.
 48    */
 49  0 public List getFailurelist()
 50    {
 51  0 return failurelist;
 52    }
 53   
 54    /**
 55    * @param failurelist The failurelist to set.
 56    */
 57  2 public void setFailurelist(List failurelist)
 58    {
 59  2 this.failurelist = failurelist;
 60    }
 61   
 62    /**
 63    * @return Returns the called.
 64    */
 65  2 public List getAllCalled()
 66    {
 67  2 return allCalled;
 68    }
 69   
 70    /**
 71    * @param called The called to set.
 72    */
 73  0 public void setAllCalled(List called)
 74    {
 75  0 this.allCalled = called;
 76    }
 77    }