01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.util.diff;
05:
06: import org.apache.commons.lang.builder.EqualsBuilder;
07:
08: /**
09: * A mock {@link Difference}, for use in tests.
10: */
11: public class MockDifference extends Difference {
12:
13: private final Object a;
14: private final Object b;
15:
16: public MockDifference(DifferenceContext where, Object a, Object b) {
17: super (where);
18:
19: this .a = a;
20: this .b = b;
21: }
22:
23: public MockDifference(DifferenceContext where) {
24: this (where, new Object(), new Object());
25: }
26:
27: public Object a() {
28: return this .a;
29: }
30:
31: public Object b() {
32: return this .b;
33: }
34:
35: public String toString() {
36: return "<MockDifference: " + a() + ", " + b() + ">";
37: }
38:
39: public boolean equals(Object that) {
40: if (!(that instanceof MockDifference))
41: return false;
42:
43: MockDifference mockThat = (MockDifference) that;
44:
45: return new EqualsBuilder().appendSuper(super.equals(that))
46: .append(this.a, mockThat.a).append(this.b, mockThat.b)
47: .isEquals();
48: }
49:
50: }
|