injae-kim commented on code in PR #1053:
URL: https://github.com/apache/incubator-pekko/pull/1053#discussion_r1468516343
##########
stream-tests/src/test/java/org/apache/pekko/stream/javadsl/FlowTest.java:
##########
@@ -237,6 +238,22 @@ public void mustBeAbleToUseMapWithResource() {
Assert.assertFalse(gate.get());
}
+ @Test
+ public void mustBeAbleToUseMapWithAutoCloseableResource() {
+ final TestKit probe = new TestKit(system);
+ final AtomicInteger closed = new AtomicInteger();
+ Source.from(Arrays.asList("1", "2", "3"))
+ .via(
+ Flow.of(String.class)
+ .mapWithResource(
+ () -> (AutoCloseable) closed::incrementAndGet, (resource,
elem) -> elem))
+ .runWith(Sink.foreach(elem -> probe.getRef().tell(elem,
ActorRef.noSender())), system);
Review Comment:
Hmm actually I just copy&paste this `probe.getRef` from other test 😅
I don't know how I can avoid this `probe.getRef` so If you suggest some
example code then I'll update it~! thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]