Fix mustBeAbleToUseMapWithAutoCloseableResource broken test (#1241)
Closes #1229.
This commit is contained in:
parent
ecdea09145
commit
9e54e4695b
2 changed files with 8 additions and 4 deletions
|
|
@ -239,7 +239,7 @@ public class FlowTest extends StreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUseMapWithAutoCloseableResource() {
|
||||
public void mustBeAbleToUseMapWithAutoCloseableResource() throws Exception {
|
||||
final TestKit probe = new TestKit(system);
|
||||
final AtomicInteger closed = new AtomicInteger();
|
||||
Source.from(Arrays.asList("1", "2", "3"))
|
||||
|
|
@ -247,7 +247,9 @@ public class FlowTest extends StreamTest {
|
|||
Flow.of(String.class)
|
||||
.mapWithResource(
|
||||
() -> (AutoCloseable) closed::incrementAndGet, (resource, elem) -> elem))
|
||||
.runWith(Sink.foreach(elem -> probe.getRef().tell(elem, ActorRef.noSender())), system);
|
||||
.runWith(Sink.foreach(elem -> probe.getRef().tell(elem, ActorRef.noSender())), system)
|
||||
.toCompletableFuture()
|
||||
.get(3, TimeUnit.SECONDS);
|
||||
|
||||
probe.expectMsgAllOf("1", "2", "3");
|
||||
Assert.assertEquals(closed.get(), 1);
|
||||
|
|
|
|||
|
|
@ -817,12 +817,14 @@ public class SourceTest extends StreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUseMapWithAutoCloseableResource() {
|
||||
public void mustBeAbleToUseMapWithAutoCloseableResource() throws Exception {
|
||||
final TestKit probe = new TestKit(system);
|
||||
final AtomicInteger closed = new AtomicInteger();
|
||||
Source.from(Arrays.asList("1", "2", "3"))
|
||||
.mapWithResource(() -> (AutoCloseable) closed::incrementAndGet, (resource, elem) -> elem)
|
||||
.runWith(Sink.foreach(elem -> probe.getRef().tell(elem, ActorRef.noSender())), system);
|
||||
.runWith(Sink.foreach(elem -> probe.getRef().tell(elem, ActorRef.noSender())), system)
|
||||
.toCompletableFuture()
|
||||
.get(3, TimeUnit.SECONDS);
|
||||
|
||||
probe.expectMsgAllOf("1", "2", "3");
|
||||
Assert.assertEquals(closed.get(), 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue