void () { String o = "1"; assertTrue(myQueue.add(o)); HashSetQueue.PositionalIterator<String> iterator = myQueue.iterator(); HashSetQueue.PositionalIterator.IteratorPosition<String> position = iterator.position(); try { position.peek(); fail("Must have thrown ISE"); } catch (IllegalStateException ignored) { } HashSetQueue.PositionalIterator.IteratorPosition<String> nextPos = position.next(); assertThat(position).isLessThan(nextPos); assertThat(position).isEqualByComparingTo(position); assertThat(nextPos).isGreaterThan(position); assertSame(o, nextPos.peek()); assertNull(nextPos.next()); HashSetQueue.PositionalIterator.IteratorPosition<String> nextPos2 = position.next(); assertThat(nextPos2).isEqualByComparingTo(nextPos); assertSame(o, nextPos2.peek()); assertTrue(iterator.hasNext()); assertSame(o, iterator.next()); assertSame(o, nextPos.peek()); assertNull(nextPos.next()); }