Clover Coverage Report - EasyMock 2.4
Coverage timestamp: mer. juil. 2 2008 02:17:38 CEST
20   73   14   2,22
10   53   0,7   9
9     1,56  
1    
 
 
  Range       Line # 9 20 14 100% 1.0
 
  (190)
 
1    /*
2    * Copyright (c) 2001-2008 OFFIS, Tammo Freese.
3    * This program is made available under the terms of the MIT License.
4    */
5    package org.easymock.internal;
6   
7    import java.io.Serializable;
8   
 
9    public class Range implements Serializable {
10   
11    private static final long serialVersionUID = -6743402320315331536L;
12   
13    private int minimum;
14   
15    private int maximum;
16   
 
17  35 toggle public Range(int count) {
18  35 this(count, count);
19    }
20   
 
21  1385 toggle public Range(int minimum, int maximum) {
22  1385 if (!(minimum <= maximum)) {
23  1 throw new RuntimeExceptionWrapper(new IllegalArgumentException(
24    "minimum must be <= maximum"));
25    }
26   
27  1384 if (!(minimum >= 0)) {
28  1 throw new RuntimeExceptionWrapper(new IllegalArgumentException(
29    "minimum must be >= 0"));
30    }
31   
32  1383 if (!(maximum >= 1)) {
33  1 throw new RuntimeExceptionWrapper(new IllegalArgumentException(
34    "maximum must be >= 1"));
35    }
36  1382 this.minimum = minimum;
37  1382 this.maximum = maximum;
38    }
39   
 
40  277 toggle public boolean hasFixedCount() {
41  277 return minimum == maximum;
42    }
43   
 
44  1846 toggle public int getMaximum() {
45  1846 return maximum;
46    }
47   
 
48  1461 toggle public int getMinimum() {
49  1461 return minimum;
50    }
51   
 
52  239 toggle public String toString() {
53  239 if (hasFixedCount()) {
54  208 return "" + minimum;
55  31 } else if (hasOpenCount()) {
56  25 return "at least " + minimum;
57    } else {
58  6 return "between " + minimum + " and " + maximum;
59    }
60    }
61   
 
62  239 toggle public String expectedAndActual(int count) {
63  239 return "expected: " + this.toString() + ", actual: " + count;
64    }
65   
 
66  1091 toggle public boolean contains(int count) {
67  1091 return minimum <= count && count <= maximum;
68    }
69   
 
70  2068 toggle public boolean hasOpenCount() {
71  2068 return maximum == Integer.MAX_VALUE;
72    }
73    }