Class WicketTesterHelper


  • public class WicketTesterHelper
    extends java.lang.Object
    A WicketTester-specific helper class.
    Since:
    1.2.6
    Author:
    Ingram Chen
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String asLined​(java.util.Collection<?> objects)
      A toString method for the given Collection.
      static void assertEquals​(java.util.Collection<?> expects, java.util.Collection<?> actuals)
      Asserts that both Collections contain the same elements.
      static void failWithVerboseMessage​(java.util.Collection<?> expects, java.util.Collection<?> actuals)
      Fails with a verbose error message.
      static AjaxEventBehavior findAjaxEventBehavior​(Component component, java.lang.String event)
      Finds the first AjaxEventBehavior attached to the specified component with the specified event.
      static java.util.List<AjaxEventBehavior> findAjaxEventBehaviors​(Component component, java.lang.String event)
      Finds all AjaxEventBehavior's attached to the specified component with the specified event.
      static Behavior findBehavior​(Component component, java.lang.Class<? extends Behavior> behaviorClass)  
      static java.util.List<WicketTesterHelper.ComponentData> getComponentData​(Page page)
      Gets recursively all Components of a given Page, extracts the information relevant to us, and adds them to a List.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WicketTesterHelper

        public WicketTesterHelper()
    • Method Detail

      • getComponentData

        public static java.util.List<WicketTesterHelper.ComponentData> getComponentData​(Page page)
        Gets recursively all Components of a given Page, extracts the information relevant to us, and adds them to a List.
        Parameters:
        page - the Page to analyze
        Returns:
        a List of Component data objects
      • assertEquals

        public static void assertEquals​(java.util.Collection<?> expects,
                                        java.util.Collection<?> actuals)
        Asserts that both Collections contain the same elements.
        Parameters:
        expects - a Collection object
        actuals - a Collection object
      • failWithVerboseMessage

        public static void failWithVerboseMessage​(java.util.Collection<?> expects,
                                                  java.util.Collection<?> actuals)
        Fails with a verbose error message.
        Parameters:
        expects - a Collection object
        actuals - a Collection object
      • asLined

        public static java.lang.String asLined​(java.util.Collection<?> objects)
        A toString method for the given Collection.
        Parameters:
        objects - a Collection object
        Returns:
        a String representation of the Collection
      • findAjaxEventBehavior

        public static AjaxEventBehavior findAjaxEventBehavior​(Component component,
                                                              java.lang.String event)
        Finds the first AjaxEventBehavior attached to the specified component with the specified event.
        Parameters:
        component -
        event -
        Returns:
        the first behavior for this event, or null
      • findAjaxEventBehaviors

        public static java.util.List<AjaxEventBehavior> findAjaxEventBehaviors​(Component component,
                                                                               java.lang.String event)
        Finds all AjaxEventBehavior's attached to the specified component with the specified event.
        Parameters:
        component -
        event -
        Returns:
        a list of all found AjaxEventBehavior or an empty list
      • findBehavior

        public static Behavior findBehavior​(Component component,
                                            java.lang.Class<? extends Behavior> behaviorClass)
        Parameters:
        component -
        behaviorClass -
        Returns:
        Behavior or null