ResourcesIterable implements Iterable<T> { @Override public Iterator<T> iterator() { return new ResourceIterator(); } @SafeVarargs  ResourcesIterable(Iterable<T>... iterables); @Override Iterator<T> iterator();  }
@Test void next_should_move_to_the_next_element_and_return_it() { Collection<String> mutable = Lists.mutableOf("a"); Collection<String> immutable = Collections.singletonList("c"); ResourcesIterable<String> iterable = new ResourcesIterable<>(mutable, immutable); mutable.add("b"); Iterator<String> iterator = iterable.iterator(); Assertions.assertTrue(iterator.hasNext()); Assertions.assertEquals("a", iterator.next()); Assertions.assertEquals("b", iterator.next()); Assertions.assertEquals("c", iterator.next()); Assertions.assertFalse(iterator.hasNext()); }