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: | 68 |  | Methods: | 9
| NCLOC: | 51 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

Range.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;
6 |  |
7 |  | public class Range {
8 |  | private int minimum;
9 |  |
10 |  | private int maximum;
11 |  |
12 | 32 | public Range(int count) {
13 | 32 | this(count, count);
14 |  | }
15 |  |
16 | 1269 | public Range(int minimum, int maximum) {
17 | 1269 | if (!(minimum <= maximum)) {
18 | 1 | throw new RuntimeExceptionWrapper(new IllegalArgumentException(
19 |  | "minimum must be <= maximum"));
20 |  | }
21 |  |
22 | 1268 | if (!(minimum >= 0)) {
23 | 1 | throw new RuntimeExceptionWrapper(new IllegalArgumentException(
24 |  | "minimum must be >= 0"));
25 |  | }
26 |  |
27 | 1267 | if (!(maximum >= 1)) {
28 | 1 | throw new RuntimeExceptionWrapper(new IllegalArgumentException(
29 |  | "maximum must be >= 1"));
30 |  | }
31 | 1266 | this.minimum = minimum;
32 | 1266 | this.maximum = maximum;
33 |  | }
34 |  |
35 | 263 | public boolean hasFixedCount() {
36 | 263 | return minimum == maximum;
37 |  | }
38 |  |
39 | 1690 | public int getMaximum() {
40 | 1690 | return maximum;
41 |  | }
42 |  |
43 | 1355 | public int getMinimum() {
44 | 1355 | return minimum;
45 |  | }
46 |  |
47 | 224 | public String toString() {
48 | 224 | if (hasFixedCount()) {
49 | 192 | return "" + minimum;
50 | 32 | } else if (hasOpenCount()) {
51 | 26 | return "at least " + minimum;
52 |  | } else {
53 | 6 | return "between " + minimum + " and " + maximum;
54 |  | }
55 |  | }
56 |  |
57 | 224 | public String expectedAndActual(int count) {
58 | 224 | return "expected: " + this.toString() + ", actual: " + count;
59 |  | }
60 |  |
61 | 993 | public boolean contains(int count) {
62 | 993 | return minimum <= count && count <= maximum;
63 |  | }
64 |  |
65 | 1916 | public boolean hasOpenCount() {
66 | 1916 | return maximum == Integer.MAX_VALUE;
67 |  | }
68 |  | }