@Test
public void only_twoElements() {

  int result = Stream.of(2, 3).collect(onlyElements((a, b) -> a * b));
  assertThat(result).isEqualTo(6);
  IllegalArgumentException thrown =
      assertThrows(
          IllegalArgumentException.class, () -> Stream.of(1).collect(onlyElements((a, b) -> a * b)));
  assertThat(thrown).hasMessageThat().contains("size: 1");
}