static Integer findNextUnusedIdFromGap(NavigableSet<Integer> setWithGaps)  {
        int next = 0;

        while (setWithGaps.contains(next))  {
            next++;
        }

        return next;
    }
@Test
    public void testFindingIdsInGaps() {
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 2))), is(1));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 2, 3, 4, 5))), is(1));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 1, 3, 4, 5))), is(2));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 1, 2, 4, 5))), is(3));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 1, 2, 3, 5))), is(4));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 3, 4, 5))), is(1));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 4, 5))), is(1));
        assertThat(NodeIdAssignor.findNextUnusedIdFromGap(new TreeSet<>(Set.of(0, 5))), is(1));
    }