public long nextId() {
        waitIfNecessary();
        long next = timestampAndSequence.incrementAndGet();
        long timestampWithSequence = next & timestampAndSequenceMask;
        return workerId | timestampWithSequence;
    }
@Test
    void testNextId() {
        IdWorker worker = new IdWorker(null);
        long id1 = worker.nextId();
        long id2 = worker.nextId();
        assertEquals(1L, id2 - id1, "increment step should be 1");
    }