Clover Coverage Report - EasyMock 2.4
Coverage timestamp: mer. juil. 2 2008 02:17:38 CEST
17   61   12   2,43
8   44   0,71   7
7     1,71  
1    
 
 
  Equals       Line # 11 17 12 100% 1.0
 
  (215)
 
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.matchers;
6   
7    import java.io.Serializable;
8   
9    import org.easymock.IArgumentMatcher;
10   
 
11    public class Equals implements IArgumentMatcher, Serializable {
12   
13    private static final long serialVersionUID = 583055160049982067L;
14   
15    private final Object expected;
16   
 
17  531 toggle public Equals(Object expected) {
18  531 this.expected = expected;
19    }
20   
 
21  739 toggle public boolean matches(Object actual) {
22  739 if (this.expected == null) {
23  3 return actual == null;
24    }
25  736 return expected.equals(actual);
26    }
27   
 
28  247 toggle public void appendTo(StringBuffer buffer) {
29  247 appendQuoting(buffer);
30  247 buffer.append(expected);
31  244 appendQuoting(buffer);
32    }
33   
 
34  491 toggle private void appendQuoting(StringBuffer buffer) {
35  491 if (expected instanceof String) {
36  192 buffer.append("\"");
37  299 } else if (expected instanceof Character) {
38  18 buffer.append("'");
39    }
40    }
41   
 
42  82 toggle protected final Object getExpected() {
43  82 return expected;
44    }
45   
 
46  12 toggle @Override
47    public boolean equals(Object o) {
48  12 if (o == null || !this.getClass().equals(o.getClass()))
49  2 return false;
50  10 Equals other = (Equals) o;
51  10 return this.expected == null && other.expected == null
52    || this.expected != null
53    && this.expected.equals(other.expected);
54    }
55   
 
56  1 toggle @Override
57    public int hashCode() {
58  1 throw new UnsupportedOperationException("hashCode() is not supported");
59    }
60   
61    }