Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:42:32 CET
file stats: LOC: 65   Methods: 7
NCLOC: 38   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
RMockThreadSupportingTestCase.java - 90.9% 85.7% 88.9%
coverage coverage
 1    package com.agical.rmock.extension.junit;
 2   
 3    import java.lang.reflect.InvocationTargetException;
 4    import java.lang.reflect.Method;
 5   
 6    import com.agical.rmock.core.strategy.TestStep;
 7    import com.agical.rmock.core.strategy.impl.CompositeStep;
 8    import com.agical.rmock.core.strategy.impl.MethodStep;
 9    import com.agical.rmock.core.strategy.impl.ThreadedCompositeStep;
 10   
 11    /**
 12    * (c) 2005 Agical AB
 13    */
 14    public class RMockThreadSupportingTestCase extends BasicJUnitStrategyTestCase {
 15   
 16  10 public RMockThreadSupportingTestCase(String testName) {
 17  10 super(testName);
 18    }
 19   
 20  0 public RMockThreadSupportingTestCase() {
 21  0 super();
 22    }
 23   
 24   
 25    private class PriviledgedMethodStep extends MethodStep {
 26  13 public PriviledgedMethodStep(Object target, String method) {
 27  13 super(target, method);
 28    }
 29   
 30  11 protected void invokeMethod(Object target, Method method) throws IllegalAccessException, InvocationTargetException {
 31  11 method.invoke(target, NO_ARGS);
 32    }
 33    }
 34   
 35    private ThreadedCompositeStep threadedTestPreceedingSteps = new ThreadedCompositeStep();
 36    private ThreadedCompositeStep threadedTestConcurrentSteps = new ThreadedCompositeStep();
 37   
 38  7 protected TestStep createTestStep(String test) {
 39  7 CompositeStep compositeStep = new CompositeStep();
 40  7 compositeStep.addStep( threadedTestPreceedingSteps );
 41  7 threadedTestConcurrentSteps.addStep( new MethodStep( this, test ) );
 42  7 compositeStep.addStep( threadedTestConcurrentSteps );
 43  7 return compositeStep;
 44    }
 45   
 46    /**
 47    * Add a name of a method you want to add to the list of methods that are run concurrently before
 48    * your test is executed, i.e. like a concurrent test fixture. The method must have return type
 49    * void and take no arguments.
 50    */
 51  9 public void addThreadedTestPreceedingStep(String methodToCall) {
 52  9 threadedTestPreceedingSteps.addStep( new PriviledgedMethodStep( this, methodToCall ) );
 53    }
 54   
 55    /**
 56    * Add a name of a method you want to add to the list of methods that are run concurrently with
 57    * your test, i.e. to verify that your tested class can handle the calls while performing some other task. The method must have return type
 58    * void and take no arguments.
 59    */
 60  4 public void addThreadedTestConcurrentStep(String methodToCall) {
 61  4 threadedTestConcurrentSteps.addStep( new PriviledgedMethodStep( this, methodToCall ) );
 62    }
 63   
 64   
 65    }