@Test
public void when_twoElements() {

  assertThat(Stream.of(2, 3).collect(when((a, b) -> a * b))).hasValue(6);
  assertThat(Stream.of(2, 3, 4).collect(when((a, b) -> a * b))).isEmpty();
  assertThat(Stream.of(2, 3).collect(when((x, y) -> x < y, (a, b) -> a * b))).hasValue(6);
  assertThat(Stream.of(2, 3).collect(when((x, y) -> x > y, (a, b) -> a * b))).isEmpty();
}