Exemplo n.º 1
0
 public void mustSuitablyOverrideAttributeHandlingMethods() {
   @SuppressWarnings("unused")
   final Source<Integer, NotUsed> f =
       Source.single(42)
           .withAttributes(Attributes.name(""))
           .addAttributes(Attributes.asyncBoundary())
           .named("");
 }
Exemplo n.º 2
0
  @Test
  public void mustBeAbleToUseIntersperseAndConcat() throws Exception {
    final JavaTestKit probe = new JavaTestKit(system);
    final Source<String, NotUsed> source =
        Source.from(Arrays.asList("0", "1", "2", "3")).intersperse(",");

    final CompletionStage<Done> future =
        Source.single(">> ")
            .concat(source)
            .runWith(
                Sink.foreach(elem -> probe.getRef().tell(elem, ActorRef.noSender())), materializer);

    probe.expectMsgEquals(">> ");
    probe.expectMsgEquals("0");
    probe.expectMsgEquals(",");
    probe.expectMsgEquals("1");
    probe.expectMsgEquals(",");
    probe.expectMsgEquals("2");
    probe.expectMsgEquals(",");
    probe.expectMsgEquals("3");
    future.toCompletableFuture().get(200, TimeUnit.MILLISECONDS);
  }