Ejemplo n.º 1
0
 @Test
 public void iteratingNullIsEmptyIterable() {
   assertThat(on((String) null), sameInstance(Iterate.<Character>none()));
   assertThat(on((Integer[]) null), sameInstance(Iterate.<Integer>none()));
   assertThat(on((Iterable<Integer>) null), sameInstance(Iterate.<Integer>none()));
   assertThat(on((byte[]) null), sameInstance(Iterate.<Byte>none()));
 }
Ejemplo n.º 2
0
 @Test
 public void bridgeArrayYieldingFunctionToIterableYieldingFunction() {
   Fn<Object, Integer[]> oneTwoThree =
       new Fn<Object, Integer[]>() {
         @Override
         public Integer[] $(Object value) {
           return new Integer[] {1, 2, 3};
         }
       };
   assertThat(optional("").split(Iterate.toIterable(oneTwoThree)), contains(1, 2, 3));
 }
Ejemplo n.º 3
0
 @Test
 public void iterateEmptyJavaCollectionYieldsNoneInstance() {
   assertThat(on(new ArrayList<>()), sameInstance(Iterate.none()));
 }