@Override
    public ModuleState build() {
        ModuleState moduleState = new ModuleState(RaftSysConstants.RAFT_STATE);
        moduleState.newState(RaftSysConstants.RAFT_ELECTION_TIMEOUT_MS,
                Math.max(stringToInt(RaftSysConstants.RAFT_ELECTION_TIMEOUT_MS, RaftSysConstants.DEFAULT_ELECTION_TIMEOUT),
                        RaftSysConstants.DEFAULT_ELECTION_TIMEOUT));
        
        moduleState.newState(RaftSysConstants.RAFT_SNAPSHOT_INTERVAL_SECS,
                stringToInt(RaftSysConstants.RAFT_SNAPSHOT_INTERVAL_SECS, RaftSysConstants.DEFAULT_RAFT_SNAPSHOT_INTERVAL_SECS));
        
        moduleState.newState(RaftSysConstants.RAFT_CORE_THREAD_NUM,
                stringToInt(RaftSysConstants.RAFT_CORE_THREAD_NUM, 8));
        
        moduleState.newState(RaftSysConstants.RAFT_CLI_SERVICE_THREAD_NUM,
                stringToInt(RaftSysConstants.RAFT_CLI_SERVICE_THREAD_NUM, RaftSysConstants.DEFAULT_RAFT_CLI_SERVICE_THREAD_NUM));
        
        moduleState.newState(RaftSysConstants.RAFT_READ_INDEX_TYPE,
                getProperty(RaftSysConstants.RAFT_READ_INDEX_TYPE));
        
        moduleState.newState(RaftSysConstants.RAFT_READ_INDEX_TYPE,
                getProperty(RaftSysConstants.RAFT_READ_INDEX_TYPE));
        
        moduleState.newState(RaftSysConstants.RAFT_RPC_REQUEST_TIMEOUT_MS,
                stringToInt(RaftSysConstants.RAFT_RPC_REQUEST_TIMEOUT_MS, RaftSysConstants.DEFAULT_RAFT_RPC_REQUEST_TIMEOUT_MS));
        
        moduleState.newState(RaftSysConstants.MAX_BYTE_COUNT_PER_RPC,
                stringToInt(RaftSysConstants.MAX_BYTE_COUNT_PER_RPC, RaftSysConstants.DEFAULT_MAX_BYTE_COUNT_PER_RPC));
        
        moduleState.newState(RaftSysConstants.MAX_ENTRIES_SIZE,
                stringToInt(RaftSysConstants.MAX_ENTRIES_SIZE, RaftSysConstants.DEFAULT_MAX_ENTRIES_SIZE));
        
        moduleState.newState(RaftSysConstants.MAX_BODY_SIZE,
                stringToInt(RaftSysConstants.MAX_BODY_SIZE, RaftSysConstants.DEFAULT_MAX_BODY_SIZE));
        
        moduleState.newState(RaftSysConstants.MAX_APPEND_BUFFER_SIZE,
                stringToInt(RaftSysConstants.MAX_APPEND_BUFFER_SIZE, RaftSysConstants.DEFAULT_MAX_APPEND_BUFFER_SIZE));
        
        moduleState.newState(RaftSysConstants.MAX_ELECTION_DELAY_MS,
                stringToInt(RaftSysConstants.MAX_ELECTION_DELAY_MS, RaftSysConstants.DEFAULT_MAX_ELECTION_DELAY_MS));
        
        moduleState.newState(RaftSysConstants.ELECTION_HEARTBEAT_FACTOR,
                stringToInt(RaftSysConstants.ELECTION_HEARTBEAT_FACTOR, RaftSysConstants.DEFAULT_ELECTION_HEARTBEAT_FACTOR));
        
        moduleState.newState(RaftSysConstants.APPLY_BATCH,
                stringToInt(RaftSysConstants.APPLY_BATCH, RaftSysConstants.DEFAULT_APPLY_BATCH));
    
        moduleState.newState(RaftSysConstants.SYNC,
                stringToBoolean(RaftSysConstants.SYNC, RaftSysConstants.DEFAULT_SYNC));
        
        moduleState.newState(RaftSysConstants.SYNC_META,
                stringToBoolean(RaftSysConstants.SYNC_META, RaftSysConstants.DEFAULT_SYNC_META));
        
        moduleState.newState(RaftSysConstants.DISRUPTOR_BUFFER_SIZE,
                stringToInt(RaftSysConstants.DISRUPTOR_BUFFER_SIZE, RaftSysConstants.DEFAULT_DISRUPTOR_BUFFER_SIZE));
        
        moduleState.newState(RaftSysConstants.REPLICATOR_PIPELINE,
                stringToBoolean(RaftSysConstants.REPLICATOR_PIPELINE, RaftSysConstants.DEFAULT_REPLICATOR_PIPELINE));
        
        moduleState.newState(RaftSysConstants.MAX_REPLICATOR_INFLIGHT_MSGS,
                stringToInt(RaftSysConstants.MAX_REPLICATOR_INFLIGHT_MSGS, RaftSysConstants.DEFAULT_MAX_REPLICATOR_INFLIGHT_MSGS));
        
        moduleState.newState(RaftSysConstants.ENABLE_LOG_ENTRY_CHECKSUM,
                stringToBoolean(RaftSysConstants.ENABLE_LOG_ENTRY_CHECKSUM, RaftSysConstants.DEFAULT_ENABLE_LOG_ENTRY_CHECKSUM));
        return moduleState;
    }
@Test
    void testBuild() {
        ModuleState actual = new RaftModuleStateBuilder().build();
        Map<String, Object> states = actual.getStates();
        assertEquals(RaftSysConstants.RAFT_STATE, actual.getModuleName());
        assertEquals(RaftSysConstants.DEFAULT_ELECTION_TIMEOUT, states.get(RaftSysConstants.RAFT_ELECTION_TIMEOUT_MS));
        assertEquals(RaftSysConstants.DEFAULT_RAFT_SNAPSHOT_INTERVAL_SECS, states.get(RaftSysConstants.RAFT_SNAPSHOT_INTERVAL_SECS));
        assertEquals(RaftSysConstants.DEFAULT_RAFT_CLI_SERVICE_THREAD_NUM, states.get(RaftSysConstants.RAFT_CLI_SERVICE_THREAD_NUM));
        assertNull(states.get(RaftSysConstants.RAFT_READ_INDEX_TYPE));
        assertEquals(RaftSysConstants.DEFAULT_RAFT_RPC_REQUEST_TIMEOUT_MS, states.get(RaftSysConstants.RAFT_RPC_REQUEST_TIMEOUT_MS));
        assertEquals(RaftSysConstants.DEFAULT_MAX_BYTE_COUNT_PER_RPC, states.get(RaftSysConstants.MAX_BYTE_COUNT_PER_RPC));
        assertEquals(RaftSysConstants.DEFAULT_MAX_ENTRIES_SIZE, states.get(RaftSysConstants.MAX_ENTRIES_SIZE));
        assertEquals(RaftSysConstants.DEFAULT_MAX_BODY_SIZE, states.get(RaftSysConstants.MAX_BODY_SIZE));
        assertEquals(RaftSysConstants.DEFAULT_MAX_APPEND_BUFFER_SIZE, states.get(RaftSysConstants.MAX_APPEND_BUFFER_SIZE));
        assertEquals(RaftSysConstants.DEFAULT_MAX_ELECTION_DELAY_MS, states.get(RaftSysConstants.MAX_ELECTION_DELAY_MS));
        assertEquals(RaftSysConstants.DEFAULT_ELECTION_HEARTBEAT_FACTOR, states.get(RaftSysConstants.ELECTION_HEARTBEAT_FACTOR));
        assertEquals(RaftSysConstants.DEFAULT_APPLY_BATCH, states.get(RaftSysConstants.APPLY_BATCH));
        assertEquals(RaftSysConstants.DEFAULT_SYNC, states.get(RaftSysConstants.SYNC));
        assertEquals(RaftSysConstants.DEFAULT_SYNC_META, states.get(RaftSysConstants.SYNC_META));
        assertEquals(RaftSysConstants.DEFAULT_DISRUPTOR_BUFFER_SIZE, states.get(RaftSysConstants.DISRUPTOR_BUFFER_SIZE));
        assertEquals(RaftSysConstants.DEFAULT_REPLICATOR_PIPELINE, states.get(RaftSysConstants.REPLICATOR_PIPELINE));
        assertEquals(RaftSysConstants.DEFAULT_MAX_REPLICATOR_INFLIGHT_MSGS, states.get(RaftSysConstants.MAX_REPLICATOR_INFLIGHT_MSGS));
        assertEquals(RaftSysConstants.DEFAULT_ENABLE_LOG_ENTRY_CHECKSUM, states.get(RaftSysConstants.ENABLE_LOG_ENTRY_CHECKSUM));
    }