Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
7   59   4   2,33
2   26   0,57   3
3     1,33  
1    
 
  Compare       Line # 31 7 0% 4 0 100% 1.0
 
  (2)
 
1    /**
2    * Copyright 2001-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16   
17    package org.easymock.internal.matchers;
18   
19    import java.io.Serializable;
20    import java.util.Comparator;
21   
22    import org.easymock.IArgumentMatcher;
23    import org.easymock.LogicalOperator;
24   
25    /**
26    * @param <T>
27    * Type of the values compared
28    *
29    * @author Henri Tremblay
30    */
 
31    public class Compare<T> implements IArgumentMatcher, Serializable {
32   
33    private static final long serialVersionUID = -4859402739599754147L;
34   
35    private final T expected;
36   
37    private final Comparator<? super T> comparator;
38   
39    private final LogicalOperator operator;
40   
 
41  14 toggle public Compare(final T expected, final Comparator<? super T> comparator, final LogicalOperator result) {
42  14 this.expected = expected;
43  14 this.comparator = comparator;
44  14 this.operator = result;
45    }
46   
 
47  32 toggle public void appendTo(final StringBuffer buffer) {
48  32 buffer.append(comparator + "(" + expected + ") " + operator.getSymbol() + " 0");
49    }
50   
 
51  62 toggle @SuppressWarnings("unchecked")
52    public boolean matches(final Object actual) {
53  62 if (actual == null) {
54  4 return false;
55    }
56  58 return operator.matchResult(comparator.compare((T) actual, expected));
57    }
58   
59    }