### Question:
ConfigApiController { @RequestMapping(value = "/{name}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_UTF8_VALUE, MediaType.TEXT_PLAIN_VALUE }) @ResponseBody public Object getConfig(@PathVariable("name") String name) { log.debug("Get [{}] configuration", name); return configService.getConfigAsJson(name); }  @RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_UTF8_VALUE }) @ResponseBody List<Map<String, String>> getInfo(); @RequestMapping(value = "/{name}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_UTF8_VALUE, MediaType.TEXT_PLAIN_VALUE }) @ResponseBody Object getConfig(@PathVariable("name") String name); ConfigService getConfigService(); void setConfigService(ConfigService configService);  }### Answer:
@Test public void getConfig() throws Exception { mockHttpSession.setAttribute("acm_ip_address", "ipAddress"); expect(mockConfigService.getConfigAsJson("config")).andReturn("{\"some1\":\"value1\"}"); expect(mockAuthentication.getName()).andReturn("userName").atLeastOnce(); replayAll(); MvcResult result = mockMvc.perform(get("/api/v1/service/config/{name}", "config") .accept(MediaType.parseMediaType("application/json;charset=UTF-8")).session(mockHttpSession).principal(mockAuthentication)) .andReturn(); verifyAll(); assertEquals(HttpStatus.OK.value(), result.getResponse().getStatus()); assertTrue(result.getResponse().getContentType().startsWith(MediaType.APPLICATION_JSON_VALUE)); String returned = result.getResponse().getContentAsString(); assertNotNull(returned); ObjectMapper om = new ObjectMapper(); JsonNode actualObj = om.readTree(returned); JsonNode someNode = actualObj.path("some1"); String someValue = someNode.textValue(); assertEquals(someValue, "value1"); }