private int getNodeId() {
        int nodeId = getNodeId(System.nanoTime());
        assert nodeId > 0 || nodeId == NODE_ID_OUT_OF_RANGE : "getNodeId() returned invalid value: " + nodeId;
        return nodeId;
    }
@Test
    public void givenNodeIdUninitialized_whenNodeIdRequestedConcurrently_thenItNeverReturnUninitializedId() throws Exception {
        when(clusterService.getMemberListJoinVersion()).thenReturn(20);
        int threadCount = 20;
        int iterationCount = 5_000;

        ExecutorService executorService = Executors.newFixedThreadPool(threadCount);
        AtomicInteger errorCounter = new AtomicInteger();
        FlakeIdGeneratorConfig genConfig = new FlakeIdGeneratorConfig();
        for (int i = 0; i < iterationCount; i++) {
            initialize(genConfig);
            FlakeIdGeneratorProxy localGen = gen;
            Runnable getNodeId = () -> {
                if (localGen.getNodeId(0) == -1) { // see FlakeIdGeneratorProxy#NODE_ID_NOT_YET_SET
                    errorCounter.incrementAndGet();
                }
            };
            for (int z = 0; z < threadCount; z++) {
                executorService.submit(getNodeId);
            }
        }
        executorService.shutdown();
        executorService.awaitTermination(30, SECONDS);
        assertEquals(0, errorCounter.get());
    }