Ejemplo n.º 1
0
 @Test
 public void shouldConvertToJavaMap() {
   final Value<Integer> value = of(1, 2, 3);
   final java.util.Map<Integer, Integer> map = value.toJavaMap(v -> Tuple.of(v, v));
   if (value.isSingleValued()) {
     assertThat(map).isEqualTo(JavaCollections.javaMap(1, 1));
   } else {
     assertThat(map).isEqualTo(JavaCollections.javaMap(1, 1, 2, 2, 3, 3));
   }
 }
Ejemplo n.º 2
0
 @Test
 public void shouldConvertToMap() {
   final Value<Integer> value = of(1, 2, 3);
   final Map<Integer, Integer> map = value.toMap(v -> Tuple.of(v, v));
   if (value.isSingleValued()) {
     assertThat(map).isEqualTo(HashMap.of(1, 1));
   } else {
     assertThat(map).isEqualTo(HashMap.empty().put(1, 1).put(2, 2).put(3, 3));
   }
 }