@Test
void testSync() throws InterruptedException {

    final RoundRobinSet<RoundRobinSetTestObject> rrList = new RoundRobinSet<>();
    rrList.add(new RoundRobinSetTestObject(1));
    rrList.add(new RoundRobinSetTestObject(2));
    rrList.add(new RoundRobinSetTestObject(N3));
    rrList.add(new RoundRobinSetTestObject(N4));
    final MutableLong failureCount = new MutableLong(0);
    final ExecutorService executorService = Executors.newCachedThreadPool();
    for (int i = 0; i < 10; i++) {
        executorService.execute(() -> {
            try {
                for (int j = 0; j < 100; j++) {
                    Thread.sleep(10);
                    try {
                        getString(rrList);
                    } catch (final RuntimeException e) {
                        System.err.println(e.getMessage());
                        failureCount.increment();
                    }
                }
            } catch (final InterruptedException e) {
                // Continue to interrupt this thread.
                Thread.currentThread().interrupt();
            }
        });
    }
    executorService.shutdown();
    executorService.awaitTermination(2, TimeUnit.MINUTES);
    assertThat(failureCount.longValue()).isEqualTo(0);
}