程序包 org.junit
类 ComparisonFailure
- java.lang.Object
- java.lang.Throwable
- java.lang.Error
- java.lang.AssertionError
- org.junit.ComparisonFailure
- 所有已实现的接口:
Serializable
public class ComparisonFailure extends AssertionError
Thrown when anassertEquals(String, String)
fails. Create and throw aComparisonFailure
manually if you want to show users the difference between two complex strings. Inspired by a patch from Alex Chaffee ([email protected])- 从以下版本开始:
- 4.0
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 ComparisonFailure(String message, String expected, String actual)
Constructs a comparison failure.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
getActual()
Returns the actual string valueString
getExpected()
Returns the expected string valueString
getMessage()
Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.
构造器详细资料
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
在类中Throwable
- 另请参阅:
Throwable.getMessage()
getExpected
public String getExpected()
Returns the expected string value- 返回:
- the expected string value