public class ComparisonFailure
extends java.lang.AssertionError
assertEquals(String, String) fails.
Create and throw a ComparisonFailure manually if you want to show users the
difference between two complex strings.
Inspired by a patch from Alex Chaffee (alex@purpletech.com)| Modifier and Type | Class and Description |
|---|---|
private static class |
ComparisonFailure.ComparisonCompactor |
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
fActual |
private java.lang.String |
fExpected |
private static int |
MAX_CONTEXT_LENGTH
The maximum length for expected and actual strings.
|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
ComparisonFailure(java.lang.String message,
java.lang.String expected,
java.lang.String actual)
Constructs a comparison failure.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getActual()
Returns the actual string value
|
java.lang.String |
getExpected()
Returns the expected string value
|
java.lang.String |
getMessage()
Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.
|
private static final int MAX_CONTEXT_LENGTH
private static final long serialVersionUID
private java.lang.String fExpected
private java.lang.String fActual
public ComparisonFailure(java.lang.String message,
java.lang.String expected,
java.lang.String actual)
message - the identifying message or nullexpected - the expected string valueactual - the actual string valuepublic java.lang.String getMessage()
getMessage in class java.lang.ThrowableThrowable.getMessage()public java.lang.String getActual()
public java.lang.String getExpected()