Clover Coverage Report - itracker
Coverage timestamp: Tue May 1 2012 16:42:12 CEST
20   76   10   10
10   40   0.5   2
2     5  
1    
 
 
  Assert       Line # 14 20 10 0% 0.0
 
No Tests
 
1    package org.itracker;
2   
3    import java.util.Comparator;
4   
5   
6   
7    import org.apache.log4j.Logger;
8    import org.itracker.model.Entity;
9   
10    /**
11    * Itracker specific assertions for include static to test-classes.
12    *
13    */
 
14    public class Assert extends junit.framework.Assert {
15   
16    private static final Logger log = Logger.getLogger(Assert.class);
17   
18    /**
19    * asserts true when comparator compares for lhs being < rhs and rhs > lhs.
20    *
21    * @param message
22    * @param comparator
23    * @param lhs
24    * @param rhs
25    */
 
26  0 toggle @SuppressWarnings("unchecked")
27    public static void assertEntityComparator(String message, Comparator comparator, Entity lhs, Entity rhs) {
28  0 if (log.isDebugEnabled()) {
29  0 log.debug("assertEntityComparator: " + message + " " + comparator);
30    }
31  0 if (null == lhs) {
32  0 throw new IllegalArgumentException("lhs must not both be null.");
33    }
34    // test nullpointer
35   
36  0 if (null == rhs) {
37   
38  0 try {
39  0 assertNull(message + " lhs, null: " + comparator, comparator.compare(lhs, rhs));
40  0 fail();
41    } catch (NullPointerException npe) {} // ok
42   
43  0 try {
44  0 assertNull(message + " null, lhs: " + comparator, comparator.compare(rhs, lhs));
45  0 fail();
46    } catch (NullPointerException npe) {} // ok
47   
48  0 return;
49    }
50   
51  0 assertTrue(message + " lhs, rhs: " + comparator, 0 > comparator.compare(lhs, rhs));
52  0 assertTrue(message + " rhs, lhs: " + comparator, 0 < comparator.compare(rhs, lhs));
53    }
54   
55    /**
56    * asserts true when comparator compares for lhs being equal to rhs and rhs equal lhs.
57    *
58    * @param message
59    * @param comparator
60    * @param lhs
61    * @param rhs
62    */
63   
 
64  0 toggle @SuppressWarnings("unchecked")
65    public static void assertEntityComparatorEquals(String message, Comparator comparator, Entity lhs, Entity rhs) {
66  0 if (log.isDebugEnabled()) {
67  0 log.debug("assertEntityComparatorEquals: " + message + " " + comparator);
68    }
69  0 if (null == lhs || null == rhs) {
70  0 throw new IllegalArgumentException("rhs and lhs must not be null.");
71    }
72   
73  0 assertTrue(message + " lhs, rhs: " + comparator, 0 == comparator.compare(lhs, rhs));
74  0 assertTrue(message + " rhs, lhs: " + comparator, 0 == comparator.compare(rhs, lhs));
75    }
76    }