Class NotificationTester<T extends Notification>
java.lang.Object
com.vaadin.testbench.unit.ComponentTester<T>
com.vaadin.flow.component.notification.NotificationTester<T>
- Type Parameters:
T- component type
Tester for Notification components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSimulates auto-close of the notification, because of show duration timeout.getText()Gets the text of the notification.booleanisUsable()Validate that component can be interacted with and should be visible in the UI.protected voidnotUsableReasons(Consumer<String> collector) Provides messages explaining why the component is actually not usable.Methods inherited from class com.vaadin.testbench.unit.ComponentTester
ensureComponentIsUsable, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, roundTrip, setModal
-
Constructor Details
-
NotificationTester
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Details
-
getText
Gets the text of the notification. If the notification is not displayed an IllegalStateException will be thrown as the end user would not be able to see the contents.- Returns:
- the text of the notification
- Throws:
IllegalStateException- is notification is not displayed
-
autoClose
public void autoClose()Simulates auto-close of the notification, because of show duration timeout. If notification is not displayed or auto-close is disabled setting duration to 0 or negative, anIllegalStateExceptionis thrown.- Throws:
IllegalStateException- if the notification is not displayed or has auto-close disabled.
-
isUsable
public boolean isUsable()Description copied from class:ComponentTesterValidate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also overrideComponentTester.notUsableReasons(Consumer)to provide additional details to the potential exception thrown byComponentTester.ensureComponentIsUsable().- Overrides:
isUsablein classComponentTester<T extends Notification>- Returns:
trueif component can be interacted with by the user- See Also:
-
notUsableReasons
Description copied from class:ComponentTesterProvides messages explaining why the component is actually not usable. Subclasses overridingComponentTester.isUsable()should also override this method to provide additional details to the potential exception throw byComponentTester.ensureComponentIsUsable().- Overrides:
notUsableReasonsin classComponentTester<T extends Notification>- See Also:
-