EasyMock 2.3

Clover coverage report - EasyMock 2.3
Coverage timestamp: mar. juil. 10 2007 02:46:04 CEST
FRAMES NO FRAMES

file stats: | LOC: | 39 |  | Methods: | 3
| NCLOC: | 25 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

Compare.java

100%

100%

100%

100%

1 |  | /*
2 |  | * Copyright (c) 2001-2007 OFFIS, Henri Tremblay.
3 |  | * This program is made available under the terms of the MIT License.
4 |  | */
5 |  | package org.easymock.internal.matchers;
6 |  |
7 |  | import java.util.Comparator;
8 |  |
9 |  | import org.easymock.IArgumentMatcher;
10 |  | import org.easymock.LogicalOperator;
11 |  |
12 |  | public class Compare<T> implements IArgumentMatcher {
13 |  |
14 |  | private T expected;
15 |  |
16 |  | private Comparator<T> comparator;
17 |  |
18 |  | private LogicalOperator operator;
19 |  |
20 | 7 | public Compare(T expected, Comparator<T> comparator, LogicalOperator result) {
21 | 7 | this.expected = expected;
22 | 7 | this.comparator = comparator;
23 | 7 | this.operator = result;
24 |  | }
25 |  |
26 | 17 | public void appendTo(StringBuffer buffer) {
27 | 17 | buffer.append(comparator + "(" + expected + ") " + operator.getSymbol()
28 |  | + " 0");
29 |  | }
30 |  |
31 | 37 | @SuppressWarnings("unchecked")
32 |  | public boolean matches(Object actual) {
33 | 37 | if(actual == null) {
34 | 2 | return false;
35 |  | }
36 | 35 | return operator.matchResult(comparator.compare((T) actual, expected));
37 |  | }
38 |  |
39 |  | }