@Test
  void iteratorReturnsIteratorWithEntriesWhenNotEmpty() {
    final HostAndPort locator1 = new HostAndPort("locator1", 1234);
    final HostAndPort locator2 = new HostAndPort("locator2", 1234);
    final Iterator<@NotNull HostAndPort> iterator = new LocatorList(asList(locator1, locator2))
        .iterator();

    assertThat(iterator).hasNext();
    assertThat(iterator.next()).isSameAs(locator1);
    assertThat(iterator).hasNext();
    assertThat(iterator.next()).isSameAs(locator2);
    assertThat(iterator).isExhausted();
    assertThatThrownBy(iterator::next).isInstanceOf(NoSuchElementException.class);
  }
The explicit order of these isn't important, only that it be consistent.
geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorListTest.java