### Question:
MonitorController extends BaseController { @ApiOperation(value = "queryDatabaseState", notes = "QUERY_DATABASE_STATE_NOTES") @GetMapping(value = "/database") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_DATABASE_STATE_ERROR) public Result queryDatabaseState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) { logger.info("login user: {}, query database state", loginUser.getUserName()); Map<String, Object> result = monitorService.queryDatabaseState(loginUser); return returnDataList(result); }  @ApiOperation(value = "listMaster", notes = "MASTER_LIST_NOTES") @GetMapping(value = "/master/list") @ResponseStatus(HttpStatus.OK) @ApiException(LIST_MASTERS_ERROR) Result listMaster(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser); @ApiOperation(value = "listWorker", notes = "WORKER_LIST_NOTES") @GetMapping(value = "/worker/list") @ResponseStatus(HttpStatus.OK) @ApiException(LIST_WORKERS_ERROR) Result listWorker(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser); @ApiOperation(value = "queryDatabaseState", notes = "QUERY_DATABASE_STATE_NOTES") @GetMapping(value = "/database") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_DATABASE_STATE_ERROR) Result queryDatabaseState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser); @ApiOperation(value = "queryZookeeperState", notes = "QUERY_ZOOKEEPER_STATE_NOTES") @GetMapping(value = "/zookeeper/list") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ZOOKEEPER_STATE_ERROR) Result queryZookeeperState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser);  }### Answer:
@Test public void testQueryDatabaseState() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/monitor/database") .header(SESSION_ID, sessionId) ) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); result.getCode().equals(Status.SUCCESS.getCode()); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); }