@Test public void homePageFetchStates() { List<State> states = controller.fetchStatesJson(); assertNotNull(states); assertEquals(50, states.size()); assertEquals("ALABAMA", states.get(0).getName()); }
@RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<State> fetchStatesJson() { logger.info("fetching JSON states"); return getStates(); }
HomeController { @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<State> fetchStatesJson() { logger.info("fetching JSON states"); return getStates(); } }
HomeController { @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<State> fetchStatesJson() { logger.info("fetching JSON states"); return getStates(); }  }
HomeController { @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<State> fetchStatesJson() { logger.info("fetching JSON states"); return getStates(); }  @RequestMapping(method = RequestMethod.GET) String home(); @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") @ResponseBody List<State> fetchStatesJson(); @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/xml") @ResponseBody StateList fetchStatesXml(); @RequestMapping(value = "state/{abbreviation}", method = RequestMethod.GET, produces = "application/json") @ResponseBody State fetchStateJson(@PathVariable String abbreviation); @RequestMapping(value = "state/{abbreviation}", method = RequestMethod.GET, produces = "application/xml") @ResponseBody State fetchStateXml(@PathVariable String abbreviation); @RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "text/plain") @ResponseBody String sendMessage(@RequestBody String message); @RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "application/json") @ResponseBody String sendMessageJson(@RequestBody Message message); @RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "application/xml") @ResponseBody String sendMessageXml(@RequestBody Message message); @RequestMapping(value = "sendmessagemap", method = RequestMethod.POST) @ResponseBody String sendMessageMap(@RequestBody LinkedMultiValueMap<String, String> map); }
HomeController { @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") public @ResponseBody List<State> fetchStatesJson() { logger.info("fetching JSON states"); return getStates(); }  @RequestMapping(method = RequestMethod.GET) String home(); @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/json") @ResponseBody List<State> fetchStatesJson(); @RequestMapping(value = "states", method = RequestMethod.GET, produces = "application/xml") @ResponseBody StateList fetchStatesXml(); @RequestMapping(value = "state/{abbreviation}", method = RequestMethod.GET, produces = "application/json") @ResponseBody State fetchStateJson(@PathVariable String abbreviation); @RequestMapping(value = "state/{abbreviation}", method = RequestMethod.GET, produces = "application/xml") @ResponseBody State fetchStateXml(@PathVariable String abbreviation); @RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "text/plain") @ResponseBody String sendMessage(@RequestBody String message); @RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "application/json") @ResponseBody String sendMessageJson(@RequestBody Message message); @RequestMapping(value = "sendmessage", method = RequestMethod.POST, consumes = "application/xml") @ResponseBody String sendMessageXml(@RequestBody Message message); @RequestMapping(value = "sendmessagemap", method = RequestMethod.POST) @ResponseBody String sendMessageMap(@RequestBody LinkedMultiValueMap<String, String> map);  }