Class ComponentTester
-
- All Implemented Interfaces:
public class ComponentTester<T extends Component>Test wrapper for components with helpful methods for testing a component.
More targeted methods for specific components exist in named component wrappers.
-
-
Constructor Summary
Constructors Constructor Description ComponentTester(T component)Wrap given component for testing.
-
Method Summary
Modifier and Type Method Description TgetComponent()Get the wrapped component. booleanisUsable()Validate that component can be interacted with and should be visible in the UI. voidsetModal(boolean modal)Set component modality. <R extends Component> ComponentQuery<R>find(Class<R> componentType)Gets a ComponentQuery to search for component of the given type nested inside the wrapped component. -
-
Constructor Detail
-
ComponentTester
ComponentTester(T component)
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Detail
-
getComponent
T getComponent()
Get the wrapped component.
- Returns:
wrapped component
-
isUsable
boolean isUsable()
Validate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also override notUsableReasons to provide additional details to the potential exception thrown by ensureComponentIsUsable.
- Returns:
trueif component can be interacted with by the user
-
setModal
void setModal(boolean modal)
Set component modality.
Automatically generates a client side change to propagate modality.
- Parameters:
modal-trueto make component modal,falseto remove modality
-
find
<R extends Component> ComponentQuery<R> find(Class<R> componentType)
Gets a ComponentQuery to search for component of the given type nested inside the wrapped component.
- Parameters:
componentType- type of the component to search.- Returns:
a ComponentQuery instance, searching for wrapped component children.
-
-
-
-