Class TestPublisher.ManualProbe<I>
- All Implemented Interfaces:
org.reactivestreams.Publisher<I>
- Direct Known Subclasses:
TestPublisher.Probe
- Enclosing class:
- TestPublisher
-
Method Summary
Modifier and TypeMethodDescription<T> TJAVA API<T> TexecuteAfterSubscription(scala.Function0<T> f) <T> TexpectEventPF(scala.PartialFunction<TestPublisher.PublisherEvent, T> f) JAVA APIExpect no messages.expectNoMessage(Duration max) JAVA APIexpectNoMessage(scala.concurrent.duration.FiniteDuration max) Expect no messages for a given duration.expectRequest(org.reactivestreams.Subscription subscription, int n) Expect demand from a given subscription.Expect a subscription.org.reactivestreams.Publisher<I><T> List<T>receiveWhile(Duration max, Duration idle, int messages, scala.PartialFunction<TestPublisher.PublisherEvent, T> f) JAVA API<T> scala.collection.immutable.Seq<T>receiveWhile(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration idle, int messages, scala.PartialFunction<TestPublisher.PublisherEvent, T> f) Receive messages for a given duration or until one does not match a given partial function.<T> scala.concurrent.duration.Duration<T> scala.concurrent.duration.Duration<T> intvoidSubscribes a givenSubscriberto this probe publisher.<T> TJAVA API<T> TJAVA API<T> Twithin(scala.concurrent.duration.FiniteDuration min, scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f) Execute code block while bounding its execution time betweenminandmax.<T> Twithin(scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f) Same as callingwithin(0 seconds, max)(f).
-
Method Details
-
subscribe
Subscribes a givenSubscriberto this probe publisher.- Specified by:
subscribein interfaceorg.reactivestreams.Publisher<I>
-
executeAfterSubscription
public <T> T executeAfterSubscription(scala.Function0<T> f) -
executeAfterSubscription
JAVA API- Since:
- 1.1.0
-
expectSubscription
Expect a subscription. -
expectRequest
public TestPublisher.ManualProbe expectRequest(org.reactivestreams.Subscription subscription, int n) Expect demand from a given subscription. -
expectNoMessage
Expect no messages. Waits for the default period configured aspekko.actor.testkit.expect-no-message-default. -
expectNoMessage
Expect no messages for a given duration. -
expectNoMessage
JAVA APIExpect no messages for a given duration.
- Since:
- 1.1.0
-
receiveWhile
public <T> scala.collection.immutable.Seq<T> receiveWhile(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration idle, int messages, scala.PartialFunction<TestPublisher.PublisherEvent, T> f) Receive messages for a given duration or until one does not match a given partial function. -
receiveWhile
public <T> List<T> receiveWhile(Duration max, Duration idle, int messages, scala.PartialFunction<TestPublisher.PublisherEvent, T> f) JAVA APIReceive messages for a given duration or until one does not match a given partial function.
- Since:
- 1.1.0
-
receiveWhile$default$1
public <T> scala.concurrent.duration.Duration receiveWhile$default$1() -
receiveWhile$default$2
public <T> scala.concurrent.duration.Duration receiveWhile$default$2() -
receiveWhile$default$3
public <T> int receiveWhile$default$3() -
expectEventPF
JAVA APIReceive messages for a given duration or until one does not match a given partial function.
- Since:
- 1.1.0
-
getPublisher
-
within
public <T> T within(scala.concurrent.duration.FiniteDuration min, scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f) Execute code block while bounding its execution time betweenminandmax.withinblocks may be nested. All methods in this trait which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosingwithinblock.Note that the timeout is scaled using Duration.dilated, which uses the configuration entry "pekko.test.timefactor", while the min Duration is not.
val ret = within(50 millis) { test ! "ping" expectMsgClass(classOf[String]) } -
within
JAVA APIExecute code block while bounding its execution time between
minandmax.withinblocks may be nested. All methods in this trait which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosingwithinblock.Note that the timeout is scaled using Duration.dilated, which uses the configuration entry "pekko.test.timefactor", while the min Duration is not.
val ret = within(Duration.ofMillis(50)) { test ! "ping" expectMsgClass(classOf[String]) }- Since:
- 1.1.0
-
within
public <T> T within(scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f) Same as callingwithin(0 seconds, max)(f). -
within
JAVA APISame as calling
within(Duration.ofSeconds(0), max)(f).- Since:
- 1.1.0
-