=str Add dedicated stream timeout exceptions for stream timeout operators.

This commit is contained in:
He-Pin 2023-12-23 16:22:21 +08:00 committed by kerr
parent 80cd63faf5
commit 873868c87b
11 changed files with 100 additions and 66 deletions

View file

@ -1364,10 +1364,9 @@ public class FlowTest extends StreamTest {
.runWith(Sink.head(), system)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS));
assertEquals(
assertTrue(
"A TimeoutException was expected",
TimeoutException.class,
executionException.getCause().getClass());
TimeoutException.class.isAssignableFrom(executionException.getCause().getClass()));
}
@Test
@ -1381,10 +1380,9 @@ public class FlowTest extends StreamTest {
.runWith(Sink.head(), system)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS));
assertEquals(
assertTrue(
"A TimeoutException was expected",
TimeoutException.class,
executionException.getCause().getClass());
TimeoutException.class.isAssignableFrom(executionException.getCause().getClass()));
}
@Test
@ -1398,10 +1396,9 @@ public class FlowTest extends StreamTest {
.runWith(Sink.head(), system)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS));
assertEquals(
assertTrue(
"A TimeoutException was expected",
TimeoutException.class,
executionException.getCause().getClass());
TimeoutException.class.isAssignableFrom(executionException.getCause().getClass()));
}
@Test

View file

@ -55,8 +55,7 @@ import static org.apache.pekko.stream.testkit.StreamTestKit.PublisherProbeSubscr
import static org.apache.pekko.stream.testkit.TestPublisher.ManualProbe;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
@SuppressWarnings("serial")
public class SourceTest extends StreamTest {
@ -1204,10 +1203,9 @@ public class SourceTest extends StreamTest {
.runWith(Sink.head(), system)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS));
assertEquals(
assertTrue(
"The cause of ExecutionException should be TimeoutException",
TimeoutException.class,
exception.getCause().getClass());
TimeoutException.class.isAssignableFrom(exception.getCause().getClass()));
}
@Test
@ -1222,10 +1220,9 @@ public class SourceTest extends StreamTest {
.runWith(Sink.head(), system)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS));
assertEquals(
assertTrue(
"The cause of ExecutionException should be TimeoutException",
TimeoutException.class,
exception.getCause().getClass());
TimeoutException.class.isAssignableFrom(exception.getCause().getClass()));
}
@Test
@ -1240,10 +1237,9 @@ public class SourceTest extends StreamTest {
.runWith(Sink.head(), system)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS));
assertEquals(
assertTrue(
"The cause of ExecutionException should be TimeoutException",
TimeoutException.class,
exception.getCause().getClass());
TimeoutException.class.isAssignableFrom(exception.getCause().getClass()));
}
@Test