    @Test
    public void testForJoinOrderNext() throws Exception {

        repeat(5, i -> {
            List<ClusterNode> nodesList = new ArrayList<>();

            repeat(5, j -> nodesList.add(newNode(newNodeId(), i == j /* <- Local node. */, null, null, j)));

            ClusterNode expected;

            if (i == 4) {
                // If last is local then should take the first one.
                expected = nodesList.get(0);
            } else {
                // Otherwise should take node that is next after the local.
                expected = nodesList.get(i + 1);
            }

            assertEquals(singletonList(expected), ClusterFilters.forNextInJoinOrder().apply(nodesList));
        });
    }