Package org.apache.tapestry5.test.ioc
Class TestUtils
- java.lang.Object
-
- org.testng.Assert
-
- org.apache.tapestry5.test.ioc.TestUtils
-
- Direct Known Subclasses:
TestBase
public class TestUtils extends org.testng.Assert
Deprecated.In 5.4, with no replacementExtra assertions on top of the standard set, packaged as a base class for easy referencing in tests. Also, utilities for instantiation objects and setting and reading private fields of those objects. This class was originally in the tapestry-ioc module as was moved to tapestry-test; the package name was not changed to ensure backwards compatibility.- Since:
- 5.2.0
-
-
Constructor Summary
Constructors Constructor Description TestUtils()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> void
assertArraysEqual(T[] actual, T... expected)
Deprecated.Convenience forassertListsEquals(List, List)
.static <T> void
assertListsEquals(List<T> actual, List<T> expected)
Deprecated.Compares two lists for equality; first all the elements are individually compared for equality (if the lists are of unequal length, only elements up to the shorter length are compared).static <T> void
assertListsEquals(List<T> actual, T... expected)
Deprecated.Convenience forassertListsEquals(List, List)
.static void
assertMessageContains(Throwable t, String... substrings)
Deprecated.Asserts that the message property of the throwable contains each of the provided substrings.static <T> T
create(Class<T> objectType, Object... fieldValues)
Deprecated.Creates a new instance of the object using its default constructor, and initializes it (viaset(Object, Object[])
).static Object
get(Object object, String fieldName)
Deprecated.Reads the content of a private field.static <T> T
set(T object, Object... fieldValues)
Deprecated.Initializes private fields (via reflection).protected static <T> void
showLists(List<T> actual, List<T> expected)
Deprecated.static void
unreachable()
Deprecated.Invoked from code that should not be reachable.-
Methods inherited from class org.testng.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsNoOrder, assertEqualsNoOrder, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, fail
-
-
-
-
Constructor Detail
-
TestUtils
public TestUtils()
Deprecated.
-
-
Method Detail
-
unreachable
public static void unreachable()
Deprecated.Invoked from code that should not be reachable. For example, place a call to unreachable() after invoking a method that is expected to throw an exception.
-
assertMessageContains
public static void assertMessageContains(Throwable t, String... substrings)
Deprecated.Asserts that the message property of the throwable contains each of the provided substrings.- Parameters:
t
- throwable to checksubstrings
- some number of expected substrings
-
assertListsEquals
public static <T> void assertListsEquals(List<T> actual, List<T> expected)
Deprecated.Compares two lists for equality; first all the elements are individually compared for equality (if the lists are of unequal length, only elements up to the shorter length are compared). Then the length of the lists are compared. This generally gives- Type Parameters:
T
- type of objects to compare- Parameters:
actual
- actual values to checkexpected
- expected values
-
assertListsEquals
public static <T> void assertListsEquals(List<T> actual, T... expected)
Deprecated.Convenience forassertListsEquals(List, List)
.- Type Parameters:
T
- type of objects to compare- Parameters:
actual
- actual values to checkexpected
- expected values
-
assertArraysEqual
public static <T> void assertArraysEqual(T[] actual, T... expected)
Deprecated.Convenience forassertListsEquals(List, List)
.- Type Parameters:
T
- type of objects to compare- Parameters:
actual
- actual values to checkexpected
- expected values
-
set
public static <T> T set(T object, Object... fieldValues)
Deprecated.Initializes private fields (via reflection).- Parameters:
object
- object to be updatedfieldValues
- string field names and corresponding field values- Returns:
- the object
-
get
public static Object get(Object object, String fieldName)
Deprecated.Reads the content of a private field.- Parameters:
object
- to read the private field fromfieldName
- name of field to read- Returns:
- value stored in the field
- Since:
- 5.1.0.5
-
create
public static <T> T create(Class<T> objectType, Object... fieldValues)
Deprecated.Creates a new instance of the object using its default constructor, and initializes it (viaset(Object, Object[])
).- Parameters:
objectType
- typeof object to instantiatefieldValues
- string field names and corresponding field values- Returns:
- the initialized instance
-
-