@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())); }
@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)); }
@Test public void iterateEmptyJavaCollectionYieldsNoneInstance() { assertThat(on(new ArrayList<>()), sameInstance(Iterate.none())); }