@Test
public void testPutMessagePositionInfo_buildCQRepeatedly() throws Exception {

    DefaultMessageStore messageStore = null;
    try {
        messageStore = gen();
        int totalMessages = 10;
        for (int i = 0; i < totalMessages; i++) {
            putMsg(messageStore);
        }
        Thread.sleep(5);
        ConsumeQueue cq = messageStore.getConsumeQueueTable().get(topic).get(queueId);
        Method method = cq.getClass().getDeclaredMethod("putMessagePositionInfo", long.class, int.class, long.class, long.class);
        assertThat(method).isNotNull();
        method.setAccessible(true);
        SelectMappedBufferResult result = messageStore.getCommitLog().getData(0);
        assertThat(result != null).isTrue();
        DispatchRequest dispatchRequest = messageStore.getCommitLog().checkMessageAndReturnSize(result.getByteBuffer(), false, false);
        assertThat(cq).isNotNull();
        Object dispatchResult = method.invoke(cq, dispatchRequest.getCommitLogOffset(),
            dispatchRequest.getMsgSize(), dispatchRequest.getTagsCode(), dispatchRequest.getConsumeQueueOffset());
        assertThat(Boolean.parseBoolean(dispatchResult.toString())).isTrue();
    } finally {
        if (messageStore != null) {
            messageStore.shutdown();
            messageStore.destroy();
        }
        deleteDirectory(storePath);
    }
}