类 AssertionErrors
- java.lang.Object
- org.springframework.test.util.AssertionErrors
public abstract class AssertionErrors extends Object
JUnit independent assertion class.- 从以下版本开始:
- 3.2
- 作者:
- Lukas Krecan, Arjen Poutsma
构造器概要
构造器 构造器 说明 AssertionErrors()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static void
assertEquals(String message, Object expected, Object actual)
Assert two objects are equal raise anAssertionError
if not.static void
assertTrue(String message, boolean condition)
Assert the given condition istrue
and raise anAssertionError
if it is not.static void
fail(String message)
Fails a test with the given message.static void
fail(String message, Object expected, Object actual)
Fails a test with the given message passing along expected and actual values to be added to the message.
构造器详细资料
AssertionErrors
public AssertionErrors()
方法详细资料
fail
public static void fail(String message)
Fails a test with the given message.- 参数:
message
- describes the reason for the failure
fail
public static void fail(String message, Object expected, Object actual)
Fails a test with the given message passing along expected and actual values to be added to the message.For example given:
assertEquals("Response header [" + name + "]", actual, expected);
The resulting message is:
Response header [Accept] expected:<application/json> but was:<text/plain>
- 参数:
message
- describes the value that failed the matchexpected
- expected valueactual
- actual value
assertTrue
public static void assertTrue(String message, boolean condition)
Assert the given condition istrue
and raise anAssertionError
if it is not.- 参数:
message
- the messagecondition
- the condition to test for
assertEquals
public static void assertEquals(String message, Object expected, Object actual)
Assert two objects are equal raise anAssertionError
if not.For example:
assertEquals("Response header [" + name + "]", actual, expected);
- 参数:
message
- describes the value being checkedexpected
- the expected valueactual
- the actual value