public class AbstractTest
extends junit.framework.TestCase
| Constructor and Description |
|---|
AbstractTest() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
assertException(Exception e,
String... keys)
Verify an exception and its cause chain against a series of keys.
|
protected static void |
expectException()
Fail with a message stating that an exception should have been thrown.
|
protected void |
firstSetUp()
This method is called by
setUp() before the first test. |
protected Context |
getContext() |
protected void |
lastTearDown()
This method is called by
tearDown() after the last test. |
protected void |
setUp() |
protected void |
tearDown() |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toStringprotected Context getContext()
protected void setUp()
throws Exception
setUp in class junit.framework.TestCaseExceptionprotected void tearDown()
throws Exception
tearDown in class junit.framework.TestCaseExceptionprotected void firstSetUp()
throws Exception
setUp() before the first test.
So if you override setUp, you must call super.
By default the method does nothing.Exception - on failureprotected void lastTearDown()
throws Exception
tearDown() after the last test.
So if you override tearDown, you must call super.
By default the method does nothing.Exception - on failureprotected static void expectException()
protected static void assertException(Exception e, String... keys)
KeyedException and its key matches.
A null key in the argument list skips a level in the cause chain.
For example the following line asserts that the cause
of exception e has a key equal to "foo":
Skipping all levels is equivalent to failing on the original exception. For example the two following lines have the same effect:assertException(e, null, "foo");
assertException(new RuntimeException("foo")); fail(new RuntimeException("foo").toString());
e - an exceptionkeys - a list of stringsCopyright © 2017. All rights reserved.