@Test public void generateInfiniteStream() throws Exception {

  Stream<Integer> generated = MoreStreams.generate(1, i -> Stream.of(i + 1));
  assertThat(generated.limit(10).collect(toList()))
      .containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}