### Question:
HeaderPartIterator implements Iterator<String> { int endsAt() { checkState(this.partStart<this.partEnd,ERROR_ITERATION_HAS_NOT_STARTED); return this.partEnd; } private  HeaderPartIterator(final String str); @Override boolean hasNext(); @Override String next(); @Override void remove();  }### Answer:
@Test public void endsAtIsNotAvailableBeforeStartingIteration() throws Exception { final HeaderPartIterator sut = createSut(""); try { sut.endsAt(); fail("Should not retrieve end position before starting iteration"); } catch(final IllegalStateException e) { assertThat(e.getMessage(),equalTo("Iteration has not started")); } }