public void testIterate(){
  final Range range=createRange(1,5);
  int next=1;
  final Iterator iter=range.iterator();
  while (iter.hasNext()) {
    final Object value=iter.next();
    assertEquals("wrong next value",createValue(next++),value);
  }
  assertEquals("wrong number of elements in iteration",6,next);
  try {
    iter.next();
    fail("successfully got element from exhausted iterator");
  }
 catch (  NoSuchElementException ignore) {
  }
}

public void testIterate ( ) { final Range range = createRange ( 1 , 5 ) ; int next = 1 ; final Iterator iter = range . iterator ( ) ; while ( iter . hasNext ( ) ) { final Object value = iter . next ( ) ; assertEquals ( "wrong next value" , createValue ( next ++ ) , value ) ; } assertEquals ( "wrong number of elements in iteration" , 6 , next ) ; try { iter . next ( ) ; fail ( "successfully got element from exhausted iterator" ) ; } catch ( NoSuchElementException ignore ) { } }
tests iterating over a non - reversed range .
