### Question:
MessageRedirectManager { public RedirectResult redirectMessageToWhichQueue(SendMessageRequestHeader requestHeader, String flag) { if (hasRedirectConfig(flag, requestHeader.getTopic())) { ArrayList<Integer> grayQueueId = findCandidateQueueId(flag, requestHeader.getTopic()); if (grayQueueId.size() > 0) { int redirectQueueId = grayQueueId.get(Math.abs(random.nextInt()) % grayQueueId.size()); return new RedirectResult(RedirectStates.REDIRECT_OK, redirectQueueId); } else { return new RedirectResult(RedirectStates.NO_INSTANCE_FOUND, -1); } } else { return new RedirectResult(RedirectStates.NO_REDIRECT_CONFIG, -1); } } MessageRedirectManager(DeFiBrokerController deFiBrokerController); void shutdown(); RedirectResult redirectMessageToWhichQueue(SendMessageRequestHeader requestHeader, String flag); void updateConfigs(List<RedirectConfItem> list); List<RedirectConfItem> getConfigList();  }### Answer:
@Test public void testRedirectMessageToWhichQueue() throws Exception { MessageRedirectManager.RedirectResult result = messageRedirectManager.redirectMessageToWhichQueue(createSendMsgRequestHeader(),"flag"); assertThat(result.getStates()).isEqualTo(MessageRedirectManager.RedirectStates.REDIRECT_OK); assertThat(result.getRedirectQueueId()).isEqualTo(1); }