Class LitRendererTestUtil

  • All Implemented Interfaces:

    
    public class LitRendererTestUtil
    
                        

    Utility methods for unit testing properties and functions of LitRenderers.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • getProperties

         static <Y> Set<String> getProperties(LitRenderer<Y> litRenderer, BiFunction<Class<out Object>, String, Field> fieldGetter)

        Gets the property names for the supplied LitRenderer using the given field getter.

        Parameters:
        litRenderer - the LitRenderer with properties to get
        fieldGetter - the field getter of the ComponentTester
        Returns:

        the set of property names of the LitRenderer

      • getPropertyValue

         static <Y, V> V getPropertyValue(LitRenderer<Y> litRenderer, BiFunction<Class<out Object>, String, Field> fieldGetter, IntFunction<Y> itemGetter, int index, String propertyName, Class<V> propertyClass)

        Gets the property value for the supplied LitRenderer.

        Parameters:
        litRenderer - the LitRenderer with properties to get
        fieldGetter - the field getter of the ComponentTester
        itemGetter - the getter for the item rendered by the LitRenderer
        index - the index of the item rendered by the LitRenderer
        propertyName - the name of the property of the LitRenderer
        propertyClass - the type of the property value
        Returns:

        the property value

      • getFunctionNames

         static <Y> Set<String> getFunctionNames(LitRenderer<Y> litRenderer, BiFunction<Class<out Object>, String, Field> fieldGetter)

        Gets the function names for the supplied LitRenderer using the given field getter.

        Parameters:
        litRenderer - the LitRenderer with properties to get
        fieldGetter - the field getter of the ComponentTester
        Returns:

        the set of function names of the LitRenderer

      • invokeFunction

         static <Y> void invokeFunction(LitRenderer<Y> litRenderer, BiFunction<Class<out Object>, String, Field> fieldGetter, IntFunction<Y> itemGetter, int index, String functionName, JsonArray jsonArray)

        Invokes the function by name for the supplied LitRenderer using the given field getter.

        Parameters:
        litRenderer - the LitRenderer with properties to get
        fieldGetter - the field getter of the ComponentTester
        itemGetter - the getter for the item rendered by the LitRenderer
        index - the index of the item rendered by the LitRenderer
        functionName - the name of the function of the LitRenderer
        jsonArray - additional parameters to pass to the function