Clover coverage report - EasyMock 2.2
Coverage timestamp: Mo Apr 17 2006 21:21:22 CEST
file stats: LOC: 57   Methods: 7
NCLOC: 42   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Equals.java 100% 100% 100% 100%
coverage
 1    /*
 2    * Copyright (c) 2001-2006 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 org.easymock.IArgumentMatcher;
 8   
 9    public class Equals implements IArgumentMatcher {
 10   
 11    private final Object expected;
 12   
 13  501 public Equals(Object expected) {
 14  501 this.expected = expected;
 15    }
 16   
 17  688 public boolean matches(Object actual) {
 18  688 if (this.expected == null) {
 19  3 return actual == null;
 20    }
 21  685 return expected.equals(actual);
 22    }
 23   
 24  240 public void appendTo(StringBuffer buffer) {
 25  240 appendQuoting(buffer);
 26  240 buffer.append(expected);
 27  237 appendQuoting(buffer);
 28    }
 29   
 30  477 private void appendQuoting(StringBuffer buffer) {
 31  477 if (expected instanceof String) {
 32  184 buffer.append("\"");
 33  293 } else if (expected instanceof Character) {
 34  18 buffer.append("'");
 35    }
 36    }
 37   
 38  80 protected final Object getExpected() {
 39  80 return expected;
 40    }
 41   
 42  12 @Override
 43    public boolean equals(Object o) {
 44  12 if (o == null || !this.getClass().equals(o.getClass()))
 45  2 return false;
 46  10 Equals other = (Equals) o;
 47  10 return this.expected == null && other.expected == null
 48    || this.expected != null
 49    && this.expected.equals(other.expected);
 50    }
 51   
 52  1 @Override
 53    public int hashCode() {
 54  1 throw new UnsupportedOperationException("hashCode() is not supported");
 55    }
 56   
 57    }