@Test public void poppingFromStack_modificationWhileStreaming() {

  Deque<String> stack = new ArrayDeque<>();
  stack.push("one");
  assertThat(
          whileNotNull(stack::poll)
              .peek(v -> {
                if (v.equals("one")) stack.push("two");
              }))
      .containsExactly("one", "two").inOrder();
  assertThat(stack).isEmpty();
}