From d829637ef28c5adcc88e2e97d13c15a5b11162cf Mon Sep 17 00:00:00 2001 From: He-Pin Date: Thu, 28 Dec 2023 17:07:27 +0800 Subject: [PATCH] chore: Fix RecipeAdhocSource test. --- .../javadsl/cookbook/RecipeAdhocSourceTest.java | 3 ++- .../docs/stream/cookbook/RecipeAdhocSource.scala | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/src/test/java/jdocs/stream/javadsl/cookbook/RecipeAdhocSourceTest.java b/docs/src/test/java/jdocs/stream/javadsl/cookbook/RecipeAdhocSourceTest.java index ddf45401f9..da9e244c0e 100644 --- a/docs/src/test/java/jdocs/stream/javadsl/cookbook/RecipeAdhocSourceTest.java +++ b/docs/src/test/java/jdocs/stream/javadsl/cookbook/RecipeAdhocSourceTest.java @@ -18,6 +18,7 @@ import org.apache.pekko.NotUsed; import org.apache.pekko.actor.ActorSystem; import org.apache.pekko.dispatch.Futures; import org.apache.pekko.japi.pf.PFBuilder; +import org.apache.pekko.stream.BackpressureTimeoutException; import org.apache.pekko.stream.javadsl.Keep; import org.apache.pekko.stream.javadsl.Source; import org.apache.pekko.stream.testkit.TestSubscriber; @@ -232,7 +233,7 @@ public class RecipeAdhocSourceTest extends RecipeTest { assertEquals(4, startedCount.get()); // startCount == 4, which means "re"-tried 3 times Thread.sleep(500); - assertEquals(TimeoutException.class, probe.expectError().getClass()); + assertEquals(BackpressureTimeoutException.class, probe.expectError().getClass()); probe.request(1); // send demand probe.expectNoMessage(FiniteDuration.create(200, "milliseconds")); // but no more restart } diff --git a/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala b/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala index b6e1831828..6360e2f4fe 100644 --- a/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala +++ b/docs/src/test/scala/docs/stream/cookbook/RecipeAdhocSource.scala @@ -14,11 +14,12 @@ package docs.stream.cookbook import java.util.concurrent.atomic.{ AtomicBoolean, AtomicInteger } - -import org.apache.pekko.stream.scaladsl.Source -import org.apache.pekko.stream.testkit.scaladsl.TestSink -import org.apache.pekko.testkit.TimingTest -import org.apache.pekko.{ Done, NotUsed } +import org.apache.pekko +import pekko.stream.scaladsl.Source +import pekko.stream.testkit.scaladsl.TestSink +import pekko.stream.BackpressureTimeoutException +import pekko.testkit.TimingTest +import pekko.{ Done, NotUsed } import scala.concurrent._ import scala.concurrent.duration._ @@ -127,7 +128,7 @@ class RecipeAdhocSource extends RecipeSpec { startedCount.get() should be(4) // startCount == 4, which means "re"-tried 3 times Thread.sleep(500) - sink.expectError().getClass should be(classOf[TimeoutException]) + sink.expectError().getClass should be(classOf[BackpressureTimeoutException]) sink.request(1) // send demand sink.expectNoMessage(200.milliseconds) // but no more restart }