public class ThreadlessNotificationTestHelper extends Object implements NotificationObserver
ThreadlessNotificationTestHelper is an alternative to the NotificationTestHelper and can be used
to test notifications, for instance from view models. Unlike the NotificationTestHelper, this class does not
use a thread and does also not rely on the JavaFX runtime environment being started. This makes this class useful in
unit tests within test environments where JavaFX can not be used.
This class implements NotificationObserver, which means that it can be added as subscriber. It records every
received notification and can be queried afterwards.NotificationTestHelper| Constructor and Description |
|---|
ThreadlessNotificationTestHelper() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the list of received notifications.
|
List<javafx.util.Pair<String,Object[]>> |
getReceivedNotifications()
Provides an unmodifiable list containing all received notifications.
|
int |
numberOfReceivedNotifications()
Provides the number of received notifications.
|
int |
numberOfReceivedNotifications(String key)
Provides the number of received notifications with a given key.
|
void |
receivedNotification(String key,
Object... payload)
Handle the Notification which is passed by the NotificationCenter.
|
public void receivedNotification(String key, Object... payload)
NotificationObserverreceivedNotification in interface NotificationObserverkey - notification namepayload - which are passedpublic List<javafx.util.Pair<String,Object[]>> getReceivedNotifications()
public int numberOfReceivedNotifications()
public int numberOfReceivedNotifications(String key)
key - The key of the notification.public void clear()
Copyright © 2019 Saxonia Systems AG. All rights reserved.