@Override
    public Member next() {
        Member memberToReturn = nextMember;
        nextMember = null;
        if (memberToReturn != null) {
            return memberToReturn;
        }
        if (!advance()) {
            throw new NoSuchElementException("no more elements");
        }
        memberToReturn = nextMember;
        nextMember = null;
        return memberToReturn;
    }
@Test(expected = HazelcastException.class)
    public void testRestart_withMaxRetriesExhausted_nextThrowsException() {
        int maxRetries = 0;
        addClusterMember();

        RestartingMemberIterator iterator = new RestartingMemberIterator(mockClusterService, maxRetries);
        // start iterating
        iterator.next();

        // topologoy change -> this should restart iteration, but there are no retry attempt left
        addClusterMember();

        // this has to throw the Exception
        iterator.next();
    }