Package com.vaadin.testbench.unit
Class LitRendererTestUtil
-
- All Implemented Interfaces:
public class LitRendererTestUtilUtility methods for unit testing properties and functions of LitRenderers.
-
-
Method Summary
Modifier and Type Method Description 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. static <Y, V> VgetPropertyValue(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. 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. static <Y> voidinvokeFunction(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. -
-
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 getfieldGetter- 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 getfieldGetter- the field getter of the ComponentTesteritemGetter- the getter for the item rendered by the LitRendererindex- the index of the item rendered by the LitRendererpropertyName- the name of the property of the LitRendererpropertyClass- 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 getfieldGetter- 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 getfieldGetter- the field getter of the ComponentTesteritemGetter- the getter for the item rendered by the LitRendererindex- the index of the item rendered by the LitRendererfunctionName- the name of the function of the LitRendererjsonArray- additional parameters to pass to the function
-
-
-
-