| 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 |
|
|
| 12 |
|
|
| 13 |
|
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 10 |
Complexity Density: 0.5 |
|
| 14 |
|
public class Assert extends junit.framework.Assert { |
| 15 |
|
|
| 16 |
|
private static final Logger log = Logger.getLogger(Assert.class); |
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
@param |
| 22 |
|
@param |
| 23 |
|
@param |
| 24 |
|
@param |
| 25 |
|
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0.43 |
|
| 26 |
0
|
@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 |
|
|
| 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) {} |
| 42 |
|
|
| 43 |
0
|
try { |
| 44 |
0
|
assertNull(message + " null, lhs: " + comparator, comparator.compare(rhs, lhs)); |
| 45 |
0
|
fail(); |
| 46 |
|
} catch (NullPointerException npe) {} |
| 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 |
|
|
| 57 |
|
|
| 58 |
|
@param |
| 59 |
|
@param |
| 60 |
|
@param |
| 61 |
|
@param |
| 62 |
|
|
| 63 |
|
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 64 |
0
|
@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 |
|
} |