Clover coverage report - jMock - 1.0-beta1
Coverage timestamp: Sat Nov 29 2003 19:35:59 GMT
file stats: LOC: 147   Methods: 28
NCLOC: 108   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
C.java 0% 16.1% 17.9% 16.4%
coverage coverage
 1   
 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
 2   
 package org.jmock;
 3   
 
 4   
 import org.jmock.constraint.*;
 5   
 import org.jmock.dynamic.Invocation;
 6   
 import org.jmock.matcher.ArgumentsMatcher;
 7   
 import org.jmock.matcher.StatelessInvocationMatcher;
 8   
 
 9   
 /**
 10   
  * Convenient factory functions and constants for building Constraints.
 11   
  */
 12   
 public abstract class C {
 13   
     public static final IsAnything IS_ANYTHING = new IsAnything();
 14   
     public static final IsNull IS_NULL = new IsNull();
 15   
     public static final Constraint IS_NOT_NULL = not(IS_NULL);
 16   
     public static final Constraint IS_TRUE = eq(new Boolean(true));
 17   
     public static final Constraint IS_FALSE = eq(new Boolean(false));
 18   
     public static final Constraint IS_ZERO = eq(new Integer(0));
 19   
     public static final Constraint IS_NOT_ZERO = not(IS_ZERO);
 20   
 
 21   
     public static final InvocationMatcher NO_ARGS =
 22   
             new StatelessInvocationMatcher() {
 23  18
                 public boolean matches(Invocation invocation) {
 24  18
                     return invocation.getParameterValues().isEmpty();
 25   
                 }
 26   
             };
 27   
 
 28   
     public static final InvocationMatcher ANY_ARGS =
 29   
             new StatelessInvocationMatcher() {
 30  0
                 public boolean matches(Invocation invocation) {
 31  0
                     return true;
 32   
                 }
 33   
             };
 34   
 
 35  0
     public static Constraint same(Object o) {
 36  0
         return new IsSame(o);
 37   
     }
 38   
 
 39  76
     public static Constraint eq(Object o) {
 40  76
         return new IsEqual(o);
 41   
     }
 42   
 
 43  14
     public static InvocationMatcher eq(Object arg0, Object arg1) {
 44  14
         return args(eq(arg0), eq(arg1));
 45   
     }
 46   
 
 47  0
     public static InvocationMatcher eq(Object arg0, Object arg1, Object arg2) {
 48  0
         return args(eq(arg0), eq(arg1), eq(arg2));
 49   
     }
 50   
 
 51  0
     public static InvocationMatcher eq(Object arg0, Object arg1, Object arg2, Object arg3) {
 52  0
         return args(eq(arg0), eq(arg1), eq(arg2), eq(arg3));
 53   
     }
 54   
 
 55  0
     public static Constraint eq(int n) {
 56  0
         return new IsEqual(new Integer(n));
 57   
     }
 58   
 
 59  0
     public static Constraint eq(long l) {
 60  0
         return new IsEqual(new Long(l));
 61   
     }
 62   
 
 63  0
     public static Constraint eq(double d) {
 64  0
         return new IsEqual(new Double(d));
 65   
     }
 66   
 
 67  0
     public static Constraint gt(int n) {
 68  0
         return new IsGreaterThan(new Integer(n));
 69   
     }
 70   
 
 71  0
     public static Constraint gt(long l) {
 72  0
         return new IsGreaterThan(new Long(l));
 73   
     }
 74   
 
 75  0
     public static Constraint gt(double d) {
 76  0
         return new IsGreaterThan(new Double(d));
 77   
     }
 78   
 
 79  0
     public static Constraint gt(char c) {
 80  0
         return new IsGreaterThan(new Character(c));
 81   
     }
 82   
 
 83  0
     public static Constraint lt(int n) {
 84  0
         return new IsLessThan(new Integer(n));
 85   
     }
 86   
 
 87  0
     public static Constraint lt(long l) {
 88  0
         return new IsLessThan(new Long(l));
 89   
     }
 90   
 
 91  0
     public static Constraint lt(double d) {
 92  0
         return new IsLessThan(new Double(d));
 93   
     }
 94   
 
 95  0
     public static Constraint lt(char c) {
 96  0
         return new IsLessThan(new Character(c));
 97   
     }
 98   
 
 99  26
     public static Constraint not(Constraint p) {
 100  26
         return new IsNot(p);
 101   
     }
 102   
 
 103  0
     public static Constraint and(Constraint p1, Constraint p2) {
 104  0
         return new And(p1, p2);
 105   
     }
 106   
 
 107  0
     public static Constraint or(Constraint p1, Constraint p2) {
 108  0
         return new Or(p1, p2);
 109   
     }
 110   
 
 111  0
     public static Constraint isA(Class c) {
 112  0
         return new IsInstanceOf(c);
 113   
     }
 114   
 
 115   
     /*  Helper methods for succinctly constructing Constraint arrays
 116   
      */
 117   
 
 118  0
     public static InvocationMatcher args() {
 119  0
         return NO_ARGS;
 120   
     }
 121   
 
 122  0
     public static InvocationMatcher args(Constraint p) {
 123  0
         return new ArgumentsMatcher(new Constraint[]{p});
 124   
     }
 125   
 
 126  14
     public static InvocationMatcher args(Constraint p1, Constraint p2) {
 127  14
         return new ArgumentsMatcher(new Constraint[]{p1, p2});
 128   
     }
 129   
 
 130  0
     public static InvocationMatcher args(Constraint p1, Constraint p2, Constraint p3) {
 131  0
         return new ArgumentsMatcher(new Constraint[]{p1, p2, p3});
 132   
     }
 133   
 
 134  0
     public static InvocationMatcher args(Constraint p1, Constraint p2, Constraint p3, Constraint p4) {
 135  0
         return new ArgumentsMatcher(new Constraint[]{p1, p2, p3, p4});
 136   
     }
 137   
 
 138  0
     public static InvocationMatcher anyArgs(int argCount) {
 139  0
         Constraint[] constraints = new Constraint[argCount];
 140  0
         for (int i = 0; i < constraints.length; i++) {
 141  0
             constraints[i] = new IsAnything();
 142   
         }
 143   
 
 144  0
         return new ArgumentsMatcher(constraints);
 145   
     }
 146   
 }
 147