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
11   67   9   1,83
4   36   0,82   6
6     1,5  
1    
 
  Equals       Line # 27 11 0% 9 0 100% 1.0
 
  (422)
 
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   
21    import org.easymock.IArgumentMatcher;
22    import org.easymock.internal.ArgumentToString;
23   
24    /**
25    * @author OFFIS, Tammo Freese
26    */
 
27    public class Equals implements IArgumentMatcher, Serializable {
28   
29    private static final long serialVersionUID = 583055160049982067L;
30   
31    private final Object expected;
32   
 
33  1112 toggle public Equals(final Object expected) {
34  1112 this.expected = expected;
35    }
36   
 
37  1408 toggle public boolean matches(final Object actual) {
38  1408 if (this.expected == null) {
39  4 return actual == null;
40    }
41  1404 return expected.equals(actual);
42    }
43   
 
44  184 toggle public void appendTo(final StringBuffer buffer) {
45  184 ArgumentToString.appendArgument(expected, buffer);
46    }
47   
 
48  32 toggle protected final Object getExpected() {
49  32 return expected;
50    }
51   
 
52  50 toggle @Override
53    public boolean equals(final Object o) {
54  50 if (o == null || !this.getClass().equals(o.getClass())) {
55  6 return false;
56    }
57  44 final Equals other = (Equals) o;
58  44 return this.expected == null && other.expected == null || this.expected != null
59    && this.expected.equals(other.expected);
60    }
61   
 
62  2 toggle @Override
63    public int hashCode() {
64  2 throw new UnsupportedOperationException("hashCode() is not supported");
65    }
66   
67    }