Ejemplo n.º 1
1
 @Test
 public void shouldConvertToJavaStream() {
   final Value<Integer> value = of(1, 2, 3);
   final java.util.stream.Stream<Integer> s1 = value.toJavaStream();
   if (value.isSingleValued()) {
     final java.util.stream.Stream<Integer> s2 = java.util.stream.Stream.of(1);
     assertThat(List.ofAll(s1::iterator)).isEqualTo(List.ofAll(s2::iterator));
   } else {
     final java.util.stream.Stream<Integer> s2 = java.util.stream.Stream.of(1, 2, 3);
     assertThat(List.ofAll(s1::iterator)).isEqualTo(List.ofAll(s2::iterator));
   }
 }
Ejemplo n.º 2
0
 @Test
 public void shouldConvertToList() {
   final Value<Integer> value = of(1, 2, 3);
   final List<Integer> list = value.toList();
   if (value.isSingleValued()) {
     assertThat(list).isEqualTo(List.of(1));
   } else {
     assertThat(list).isEqualTo(List.of(1, 2, 3));
   }
 }