org.junit
Class ComparisonFailure
java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.AssertionError
org.junit.ComparisonFailure
- 所有已实现接口:
- Serializable
public class ComparisonFailure
- extends AssertionError
Thrown when an 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 ([email protected])
- 另请参见:
- Serialized Form
ComparisonFailure
public ComparisonFailure(String message,
String expected,
String actual)
- Constructs a comparison failure.
- 参数:
message
- the identifying message or nullexpected
- the expected string valueactual
- the actual string value
getMessage
public String getMessage()
- Returns "..." in place of common prefix and "..." in
place of common suffix between expected and actual.
- 重写:
getMessage
in class Throwable
- 另请参见:
Throwable.getMessage()
getActual
public String getActual()
- Returns the actual string value
- 返回:
- the actual string value
getExpected
public String getExpected()
- Returns the expected string value
- 返回:
- the expected string value