@Override
    public void updateNextNode(int level, long node) {
        Preconditions.checkArgument(
                level >= 0 && level <= topLevel,
                "invalid level " + level + " current top level is " + topLevel);

        if (level == 0) {
            nextNode = node;
        } else {
            levelIndex[level - 1] = node;
        }
    }
@Test
    void testUpdateNextNode() {
        // test update next node of level 0
        int level = 0;
        long node1 = random.nextLong(Long.MAX_VALUE);
        heapHeadIndex.updateNextNode(level, node1);
        assertThat(heapHeadIndex.getNextNode(level)).isEqualTo(node1);
        // Increase one level and make sure everything still works
        heapHeadIndex.updateLevel(++level);
        long node2 = random.nextLong(Long.MAX_VALUE);
        heapHeadIndex.updateNextNode(level, node2);
        assertThat(heapHeadIndex.getNextNode(level)).isEqualTo(node2);
        assertThat(heapHeadIndex.getNextNode(level - 1)).isEqualTo(node1);
    }