### Question:
SpillingResettableIterator implements ResettableIterator<T> { @Override public T next() { if (this.next != null || hasNext()) { final T out = this.next; this.next = null; return out; } else { throw new NoSuchElementException(); } } SpillingResettableIterator(Iterator<T> input, TypeSerializer<T> serializer, 
			MemoryManager memoryManager, IOManager ioManager,
			int numPages, AbstractInvokable parentTask);  SpillingResettableIterator(Iterator<T> input, TypeSerializer<T> serializer,
			MemoryManager memoryManager, IOManager ioManager, List<MemorySegment> memory); private  SpillingResettableIterator(Iterator<T> input, TypeSerializer<T> serializer,
			MemoryManager memoryManager, IOManager ioManager,
			List<MemorySegment> memory, boolean releaseMemOnClose); void open(); void reset(); @Override boolean hasNext(); @Override T next(); @Override void remove(); List<MemorySegment> close();  }### Answer:
@Test public void testNext() { try { SpillingResettableIterator<IntValue> iterator = new SpillingResettableIterator<IntValue>( this.reader, this.serializer, this.memman, this.ioman, 2, this.memOwner); iterator.open(); IntValue record; int cnt = 0; while (cnt < NUM_TESTRECORDS) { record = iterator.next(); Assert.assertTrue("Record was not read from iterator", record != null); cnt++; } try { record = iterator.next(); Assert.fail("Too many records were read from iterator."); } catch (NoSuchElementException nseex) { } iterator.close(); } catch (Exception ex) { ex.printStackTrace(); Assert.fail("Test encountered an exception."); } }