Class TestUtils

  • Direct Known Subclasses:
    TestBase

    public class TestUtils
    extends org.testng.Assert
    Deprecated.
    In 5.4, with no replacement
    Extra 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.
      static <T> void <T> actual, <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 <T> actual, T... expected)
      Deprecated.
      static void  t, ... substrings)
      Deprecated.
      Asserts that the message property of the throwable contains each of the provided substrings.
      static <T> T <T> objectType, ... fieldValues)
      Deprecated.
      Creates a new instance of the object using its default constructor, and initializes it (via set(Object, Object[])).
      static  object,  fieldName)
      Deprecated.
      Reads the content of a private field.
      static <T> T set​(T object, ... fieldValues)
      Deprecated.
      Initializes private fields (via reflection).
      protected static <T> void <T> actual, <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
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Constructor Detail

    • 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  t,
                                                 ... substrings)
        Deprecated.
        Asserts that the message property of the throwable contains each of the provided substrings.
        Parameters:
        t - throwable to check
        substrings - some number of expected substrings
      • assertListsEquals

        public static <T> void <T> actual,
                                                 <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 check
        expected - expected values
      • showLists

        protected static <T> void <T> actual,
                                            <T> expected)
        Deprecated.
      • assertListsEquals

        public static <T> void <T> actual,
                                                 T... expected)
        Deprecated.
        Type Parameters:
        T - type of objects to compare
        Parameters:
        actual - actual values to check
        expected - expected values
      • assertArraysEqual

        public static <T> void assertArraysEqual​(T[] actual,
                                                 T... expected)
        Deprecated.
        Type Parameters:
        T - type of objects to compare
        Parameters:
        actual - actual values to check
        expected - expected values
      • set

        public static <T> T set​(T object,
                                ... fieldValues)
        Deprecated.
        Initializes private fields (via reflection).
        Parameters:
        object - object to be updated
        fieldValues - string field names and corresponding field values
        Returns:
        the object
      • get

        public static   object,
                                  fieldName)
        Deprecated.
        Reads the content of a private field.
        Parameters:
        object - to read the private field from
        fieldName - name of field to read
        Returns:
        value stored in the field
        Since:
        5.1.0.5
      • create

        public static <T> T <T> objectType,
                                   ... fieldValues)
        Deprecated.
        Creates a new instance of the object using its default constructor, and initializes it (via set(Object, Object[])).
        Parameters:
        objectType - typeof object to instantiate
        fieldValues - string field names and corresponding field values
        Returns:
        the initialized instance