ComparisonFailure (JUnit API)

Junit


org.junit Class ComparisonFailure

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Error
          extended by java.lang.AssertionError
              extended by 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(String message, String expected, String actual)
          Constructs a comparison failure.
 
方法摘要
 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.
 
类方法继承: java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
类方法继承: java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造器详细信息

ComparisonFailure

public ComparisonFailure(String message,
                         String expected,
                         String actual)
Constructs a comparison failure.

参数:
message - the identifying message or null
expected - the expected string value
actual - 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