Class TestNotificationPublisher<T>

Object
akka.javasdk.testkit.TestNotificationPublisher<T>
Type Parameters:
T - the type of notification messages
All Implemented Interfaces:
akka.javasdk.NotificationPublisher<T>

public final class TestNotificationPublisher<T> extends Object implements akka.javasdk.NotificationPublisher<T>
Test implementation of NotificationPublisher that collects all published notifications for later assertions.

Example usage:


 var notificationPublisher = new TestNotificationPublisher<MyNotification>();
 var testKit = EventSourcedTestKit.of(entityId, ctx -> new MyEntity(notificationPublisher));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from interface akka.javasdk.NotificationPublisher

    akka.javasdk.NotificationPublisher.NotificationStream<T>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all collected notifications.
    Returns a list of all notifications published so far, in order.
    void
    publish(T msg)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface akka.javasdk.NotificationPublisher

    publishSink, publishTokenStream, stream
  • Constructor Details

    • TestNotificationPublisher

      public TestNotificationPublisher()
  • Method Details

    • publish

      public void publish(T msg)
      Specified by:
      publish in interface akka.javasdk.NotificationPublisher<T>
    • getNotifications

      public List<T> getNotifications()
      Returns a list of all notifications published so far, in order.
    • clear

      public void clear()
      Clears all collected notifications.