ArrayIterable implements Iterable<T> { @NotNull @Override public Iterator<T> iterator() { return new ArrayIterator(); } ArrayIterable(Object array); @NotNull @Override Iterator<T> iterator();  }
@Test void next_should_move_to_the_next_element_and_return_it() { ArrayIterable<String> arrayIterable = new ArrayIterable<>(new String[]{"a", "b", "c"}); Iterator<String> iterator = arrayIterable.iterator(); Assertions.assertTrue(iterator.hasNext()); Assertions.assertEquals("a", iterator.next()); Assertions.assertEquals("b", iterator.next()); Assertions.assertEquals("c", iterator.next()); Assertions.assertFalse(iterator.hasNext()); }