### Question:
CloseableIterableOnce implements CloseableIterable<T> { @Override public void close() { iterator.set(null); } CloseableIterableOnce(Iterator<T> iterator); @Override Iterator<T> iterator(); @Override void close();  }### Answer:
@Test public void testClose() { List<String> list = ImmutableList.of("foo"); CloseableIterable<String> iterable = new CloseableIterableOnce<>(list.iterator()); iterable.close(); thrown.expect(IllegalStateException.class); iterable.iterator(); }