Serializable
public class ComparisonFailure extends 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)Constructor | Description |
---|---|
ComparisonFailure(String message,
String expected,
String actual) |
Constructs a comparison failure.
|
Modifier and Type | Method | Description |
---|---|---|
String |
getActual() |
Returns the actual string value
|
String |
getExpected() |
Returns the expected string value
|
String |
getMessage() |
Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public ComparisonFailure(String message, String expected, String actual)
message
- the identifying message or nullexpected
- the expected string valueactual
- the actual string valuepublic String getMessage()
getMessage
in class Throwable
Throwable.getMessage()
public String getActual()
public String getExpected()
Copyright © 2002–2018 JUnit. All rights reserved.