Class AbstractSearchContextEnricher
java.lang.Object
org.jboss.arquillian.graphene.enricher.AbstractSearchContextEnricher
- All Implemented Interfaces:
SearchContextTestEnricher
- Direct Known Subclasses:
InFrameEnricher,JavaScriptEnricher,PageFragmentEnricher,PageObjectEnricher,WebElementEnricher,WebElementWrapperEnricher
public abstract class AbstractSearchContextEnricher
extends Object
implements SearchContextTestEnricher
This class should help you to implement
SearchContextTestEnricher.- Author:
- Juraj Huska, Jan Papousek
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidenrichRecursively(org.openqa.selenium.SearchContext searchContext, Object target) Performs further enrichment on the given instance with the given search context.protected final Class<?>getActualType(Field field, Object testCase) It loads a real type of a field defined by parametric type.protected final Class<?>getListType(Field listField) It loads the concrete type of list items.static Collection<SearchContextTestEnricher>getSortedSearchContextEnrichers(org.jboss.arquillian.core.api.Instance<org.jboss.arquillian.core.spi.ServiceLoader> serviceLoader) protected static <T> Tinstantiate(Class<T> type, Object... args) Initialize given class.protected static voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.arquillian.graphene.spi.enricher.SearchContextTestEnricher
enrich, getPrecedence, resolve
-
Field Details
-
NEW_LINE
Constant containing new line separator dependent on the environment.
-
-
Constructor Details
-
AbstractSearchContextEnricher
public AbstractSearchContextEnricher()
-
-
Method Details
-
enrichRecursively
protected static void enrichRecursively(org.openqa.selenium.SearchContext searchContext, Object target) Performs further enrichment on the given instance with the given search context. That means all instancesTestEnricherandSearchContextTestEnricherare invoked.- Parameters:
searchContext-target-
-
getSortedSearchContextEnrichers
public static Collection<SearchContextTestEnricher> getSortedSearchContextEnrichers(org.jboss.arquillian.core.api.Instance<org.jboss.arquillian.core.spi.ServiceLoader> serviceLoader) -
getActualType
It loads a real type of a field defined by parametric type. It searches in declaring class and super class. E. g. if a field is declared as 'A fieldName', It tries to find type parameter called 'A' in super class declaration and its evaluation in the class declaring the given field.- Parameters:
field-testCase-- Returns:
- type of the given field
-
getListType
It loads the concrete type of list items. E.g. for List, String is returned. - Parameters:
listField-- Returns:
- Throws:
ClassNotFoundException
-
instantiate
protected static <T> T instantiate(Class<T> type, Object... args) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Initialize given class.- Parameters:
clazz- to be initialized- Throws:
IllegalAccessExceptionInstantiationExceptionInvocationTargetExceptionIllegalArgumentExceptionSecurityExceptionNoSuchMethodException
-
setValue
-