Docs: Source.repeat (and friends) (#28615)
This commit is contained in:
parent
d946abd8d7
commit
cff15cf40d
6 changed files with 64 additions and 16 deletions
|
|
@ -626,6 +626,20 @@ public class SourceTest extends StreamTest {
|
|||
for (Integer i : result) assertEquals(i, (Integer) 42);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustRepeatForDocs() throws Exception {
|
||||
// #repeat
|
||||
Source<Integer, NotUsed> source = Source.repeat(42);
|
||||
CompletionStage<Done> f = source.take(4).runWith(Sink.foreach(System.out::println), system);
|
||||
// 42
|
||||
// 42
|
||||
// 42
|
||||
// 42
|
||||
// #repeat
|
||||
final Done result = f.toCompletableFuture().get(3, TimeUnit.SECONDS);
|
||||
assertEquals(Done.done(), result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mustBeAbleToUseQueue() throws Exception {
|
||||
final Pair<SourceQueueWithComplete<String>, CompletionStage<List<String>>> x =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue