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: | 33 |  | Methods: | 3
| NCLOC: | 20 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

CompareTo.java

100%

100%

100%

100%

1 |  | /*
2 |  | * Copyright (c) 2001-2007 OFFIS, Tammo Freese.
3 |  | * This program is made available under the terms of the MIT License.
4 |  | */
5 |  | package org.easymock.internal.matchers;
6 |  |
7 |  | import org.easymock.IArgumentMatcher;
8 |  |
9 |  | public abstract class CompareTo<T extends Comparable<T>> implements IArgumentMatcher {
10 |  | private final Comparable<T> expected;
11 |  |
12 | 47 | public CompareTo(Comparable<T> value) {
13 | 47 | this.expected = value;
14 |  | }
15 |  |
16 | 96 | @SuppressWarnings("unchecked")
17 |  | public boolean matches(Object actual) {
18 |  |
19 | 96 | if(!(actual instanceof Comparable)) {
20 | 1 | return false;
21 |  | }
22 |  |
23 | 95 | return matchResult(((Comparable) actual).compareTo(expected));
24 |  | }
25 |  |
26 | 19 | public void appendTo(StringBuffer buffer) {
27 | 19 | buffer.append(getName() + "(" + expected + ")");
28 |  | }
29 |  |
30 |  | protected abstract String getName();
31 |  |
32 |  | protected abstract boolean matchResult(int result);
33 |  | }