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

Source file | Conditionals | Statements | Methods | TOTAL

EqualsWithDelta.java

-

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 class EqualsWithDelta implements IArgumentMatcher {
10 |  | private final Number expected;
11 |  |
12 |  | private final Number delta;
13 |  |
14 | 5 | public EqualsWithDelta(Number value, Number delta) {
15 | 5 | this.expected = value;
16 | 5 | this.delta = delta;
17 |  | }
18 |  |
19 | 12 | public boolean matches(Object actual) {
20 | 12 | Number actualNumber = (Number) actual;
21 | 12 | return expected.doubleValue() - delta.doubleValue() <= actualNumber
22 |  | .doubleValue()
23 |  | && actualNumber.doubleValue() <= expected.doubleValue()
24 |  | + delta.doubleValue();
25 |  | }
26 |  |
27 | 1 | public void appendTo(StringBuffer buffer) {
28 | 1 | buffer.append("eq(" + expected + ", " + delta + ")");
29 |  | }
30 |  | }