public class DefaultTCase
extends org.junit.Assert
AbstractTestHelper) may be added as private variables with the
TestHelper annotation. They will be automatically initialized and
destroyed. Note that helpers will be initialized by alphabetical order and
will be destroyed in reverse order. This class will save system properties
on set up and will restore them at tear down.| Constructor and Description |
|---|
DefaultTCase() |
| Modifier and Type | Method and Description |
|---|---|
protected <E extends Enum<E>> |
cover_enumeration(Class<E> cls)
Artificially invoke all automatically generated methods of an
enumeration to make sure they are not missing in the code coverage
report.
|
static <FIELD_T> FIELD_T |
internal_get(Object object,
Class<FIELD_T> field_type,
String field_name)
Obtains the value of a field in an object.
|
static void |
internal_set(Object object,
String field_name,
Object value)
Obtains the value of a field in an object.
|
void |
post_tear_down()
Runs after tear down.
|
void |
pre_set_up()
Runs before any preparation.
|
protected void |
wait_for_true(BooleanEvaluation eval)
Equivalent to invoke
wait_for_true(BooleanEvaluation, long)
with WAIT_FOR_TRUE_DEFAULT_TIMEOUT_MS as timeout. |
protected void |
wait_for_true(BooleanEvaluation eval,
long timeout_ms)
Keeps evaluating an expression until it returns
true or
until it times out. |
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, failpublic void pre_set_up()
throws Exception
TestHelper annotation.Exception - failed to initialize helpers.public void post_tear_down()
throws Exception
Exception - failed to tear down the test caseprotected <E extends Enum<E>> void cover_enumeration(Class<E> cls) throws Exception
E - the enumeration typecls - the enumeration classException - failed to invokeprotected void wait_for_true(BooleanEvaluation eval, long timeout_ms) throws Exception
true or
until it times out. This method is usually used on unit tests to avoid
having to code thread sleeps. This method will invoke
fail() if eval didn't become
true after timeout_ms milliseconds have
elapsedeval - the expression to evaluate; this expression will be invoked
multiple times and it should compute quicklytimeout_ms - the timeout in millisecondsException - failed to evaluateprotected void wait_for_true(BooleanEvaluation eval) throws Exception
wait_for_true(BooleanEvaluation, long)
with WAIT_FOR_TRUE_DEFAULT_TIMEOUT_MS as timeout.eval - the expression to evaluate; this expression will be invoked
multiple times and it should compute quicklyException - failed to evaluatepublic static <FIELD_T> FIELD_T internal_get(Object object, Class<FIELD_T> field_type, String field_name) throws Exception
FIELD_T - the type of fieldobject - the object, cannot be nullfield_type - the type of field, cannot be nullfield_name - the name of the field, cannot be nullException - failed to access the fieldpublic static void internal_set(Object object, String field_name, Object value) throws Exception
object - the object, cannot be nullfield_name - the name of the field, cannot be nullvalue - the value to put in the fieldException - failed to access the fieldCopyright © 2015. All rights reserved.