Class TestUtilInternal
- java.lang.Object
-
- com.hybris.cockpitng.testing.util.internal.TestUtilInternal
-
public final class TestUtilInternal extends java.lang.ObjectInternal utility class to be used by general purpose test classes.- See Also:
AbstractWidgetUnitTest,AbstractActionUnitTest
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<java.lang.reflect.Method>getAllMethods(java.lang.Class<?> clazz, boolean includeSuperTypes)Helper method to fetch all the methods (public, private, protected, package) of a type with or without supertype declared methods.static booleanhasDefaultOrNoParameterConstructor(java.lang.Class<?> clazz)static booleanisExtensible(java.lang.Class<?> clazz, int modifier)static booleanisNullsafe(java.lang.Class<?> clazz)static booleanisNullsafe(java.lang.reflect.Method method)static java.util.List<java.lang.Object[]>prepareAllCombinations(java.util.Collection<? extends java.util.Collection<?>> possibleParams)Returns a collection of all combinations of the given parameters.static java.util.List<java.util.List<java.lang.Object>>prepareMatchingParametersNullSafe(java.lang.reflect.Method method, java.lang.Class<?> testClass)static java.lang.StringtoSingleLine(java.lang.String text)
-
-
-
Method Detail
-
isNullsafe
public static boolean isNullsafe(java.lang.Class<?> clazz)
- Parameters:
clazz- type to be checked if annotated with @NullSafeWidget- Returns:
- true if the given type is not annotated with @NullSafeWidget or the annotation has value of true
- See Also:
NullSafeWidget
-
isNullsafe
public static boolean isNullsafe(java.lang.reflect.Method method)
- Parameters:
method- method to be checked if annotated with @NullSafeWidget- Returns:
- true if the given type is not annotated with @NullSafeWidget or the annotation has value of true
- See Also:
NullSafeWidget
-
hasDefaultOrNoParameterConstructor
public static boolean hasDefaultOrNoParameterConstructor(java.lang.Class<?> clazz)
- Parameters:
clazz- type to be checked- Returns:
- true if the class has a default or zero-argument constructor
- Since:
- 2.0.6
-
getAllMethods
public static java.util.Collection<java.lang.reflect.Method> getAllMethods(java.lang.Class<?> clazz, boolean includeSuperTypes)Helper method to fetch all the methods (public, private, protected, package) of a type with or without supertype declared methods.- Parameters:
clazz- type to fetch its methodsincludeSuperTypes- if set to true methods from all the supertypes will be included.- Returns:
- Collection of all the methods declared on the type (and optionally its supertypes).
-
prepareMatchingParametersNullSafe
public static java.util.List<java.util.List<java.lang.Object>> prepareMatchingParametersNullSafe(java.lang.reflect.Method method, java.lang.Class<?> testClass)- Parameters:
method- a method for which possible input parameters will be generatedtestClass- test class that implements the test- Returns:
- a list of lists of all possible parameters, sub-lists' positions reflect the position of attribute they may be used as an input parameter
-
prepareAllCombinations
public static java.util.List<java.lang.Object[]> prepareAllCombinations(java.util.Collection<? extends java.util.Collection<?>> possibleParams)
Returns a collection of all combinations of the given parameters. For example input:[[A,B],[C,D,E],[F]]
the result will be:[[A,C,F],[A,D,F],[A,E,F],[B,C,F],[B,D,F],[B,E,F]]
-
isExtensible
public static boolean isExtensible(java.lang.Class<?> clazz, int modifier)- Parameters:
clazz- class to check for com.hybris.cockpitng.testing.annotation.ExtensibleWidget annotationmodifier- expected level of extensibility- Returns:
- true if the modifier available matches the required
- Since:
- 2.0.6
-
toSingleLine
public static java.lang.String toSingleLine(java.lang.String text)
- Parameters:
text- to be converted to single line (characters- Returns:
- text converted to single line (removes characters like \r \n )
-
-