1 package junit.framework;
2
3
4
5
6
7
8 public class ComparisonFailure extends AssertionFailedError {
9 private static final int MAX_CONTEXT_LENGTH = 20;
10 private static final long serialVersionUID = 1L;
11
12 private String fExpected;
13 private String fActual;
14
15
16
17
18
19
20
21
22 public ComparisonFailure(String message, String expected, String actual) {
23 super(message);
24 fExpected = expected;
25 fActual = actual;
26 }
27
28
29
30
31
32
33
34 @Override
35 public String getMessage() {
36 return new ComparisonCompactor(MAX_CONTEXT_LENGTH, fExpected, fActual).compact(super.getMessage());
37 }
38
39
40
41
42
43
44 public String getActual() {
45 return fActual;
46 }
47
48
49
50
51
52
53 public String getExpected() {
54 return fExpected;
55 }
56 }