Most visited

Recently visited

Added in API level 1

ComparisonFailure

public class ComparisonFailure
extends AssertionFailedError

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Error
       ↳ java.lang.AssertionError
         ↳ junit.framework.AssertionFailedError
           ↳ junit.framework.ComparisonFailure


当一个断言等于字符串失败时抛出。 受Alex Chaffee mailto:[email protected]的补丁启发

Summary

Public constructors

ComparisonFailure(String message, String expected, String actual)

构造比较失败。

Public methods

String getActual()

获取实际的字符串值

String getExpected()

获取预期的字符串值

String getMessage()

返回“...”代替通用前缀和“...”代替预期和实际之间的通用后缀。

Inherited methods

From class java.lang.Throwable
From class java.lang.Object

Public constructors

ComparisonFailure

Added in API level 1
ComparisonFailure (String message, 
                String expected, 
                String actual)

构造比较失败。

Parameters
message String: the identifying message or null
expected String: the expected string value
actual String: the actual string value

Public methods

getActual

Added in API level 16
String getActual ()

获取实际的字符串值

Returns
String the actual string value

getExpected

Added in API level 16
String getExpected ()

获取预期的字符串值

Returns
String the expected string value

getMessage

Added in API level 1
String getMessage ()

返回“...”代替通用前缀和“...”代替预期和实际之间的通用后缀。

Returns
String the detail message string of this Throwable instance (which may be null).

也可以看看:

Hooray!