Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:42:32 CET
file stats: LOC: 60   Methods: 5
NCLOC: 49   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
ReplayModifier.java 83.3% 86.7% 100% 88.5%
coverage coverage
 1    package com.agical.rmock.core.find.match.method;
 2   
 3    import java.lang.reflect.InvocationHandler;
 4    import java.lang.reflect.Method;
 5    import java.util.ArrayList;
 6    import java.util.Iterator;
 7    import java.util.List;
 8   
 9    import com.agical.rmock.core.exception.UnexpectedFatalSystemException;
 10    import com.agical.rmock.core.expectation.modification.ExpectationModifier;
 11   
 12    public class ReplayModifier implements Modifier, InvocationHandler {
 13    private class Invoker {
 14    private final Method method;
 15    private final Object[] args;
 16  41 public Invoker(Method method, Object[] args) {
 17  41 this.method = method;
 18  41 this.args = args;
 19    }
 20  20 public Object invoke(Object target) throws Throwable {
 21  20 return method.invoke(target, args);
 22    }
 23    }
 24   
 25    private final List invokers = new ArrayList();
 26   
 27    private final ExpectationModifier expectationModifier;
 28   
 29  3 public ReplayModifier(ExpectationModifier expectationModifier) {
 30  3 this.expectationModifier = expectationModifier;
 31   
 32    }
 33   
 34  1 public void modify() {
 35  1 try {
 36  1 for (Iterator iter = invokers.iterator(); iter.hasNext();) {
 37  20 Invoker invoker = (Invoker) iter.next();
 38  20 invoker.invoke(expectationModifier);
 39    }
 40    }
 41    catch (Throwable e) {
 42  0 throw new UnexpectedFatalSystemException(e);
 43    }
 44   
 45    }
 46   
 47  41 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
 48  41 invokers.add(new Invoker(method, args));
 49  41 if (method.getReturnType().isInstance(proxy)) {
 50  17 return proxy;
 51    }
 52    else {
 53  24 if (method.getName().equals("toString")) {
 54  0 return ("ReplayModifier");
 55    }
 56    }
 57  24 return null;
 58    }
 59   
 60    }