@SuppressWarnings("unchecked") @Test public void testListAll() { DawgPoundMongoService poundService = EasyMock.createMock(DawgPoundMongoService.class); DawgPoundRestController poundController = new DawgPoundRestController(); ReflectionTestUtils.setField(poundController, "service", poundService); Map<String,Object> deviceMap = new HashMap<String,Object>(); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); deviceMap.put("id", TestConstants.DEVICE_ID); list.add(deviceMap); EasyMock.expect(poundService.list()).andReturn(list.toArray(new Map[list.size()])); EasyMock.replay(poundService); Map<String,Object>[] actualDeviceMap = poundController.listAll(); Assert.assertEquals(actualDeviceMap.length, 1); Assert.assertEquals(actualDeviceMap[0].get("id"), TestConstants.DEVICE_ID); EasyMock.verify(poundService); }
@RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] listAll() { DawgPoundMongoService mongo = (DawgPoundMongoService) service; LOGGER.info("Request to list all devices in the datastore."); return mongo.list(); }
DawgPoundRestController { @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] listAll() { DawgPoundMongoService mongo = (DawgPoundMongoService) service; LOGGER.info("Request to list all devices in the datastore."); return mongo.list(); } }
DawgPoundRestController { @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] listAll() { DawgPoundMongoService mongo = (DawgPoundMongoService) service; LOGGER.info("Request to list all devices in the datastore."); return mongo.list(); }  }
DawgPoundRestController { @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] listAll() { DawgPoundMongoService mongo = (DawgPoundMongoService) service; LOGGER.info("Request to list all devices in the datastore."); return mongo.list(); }  @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] getReservered(@PathVariable String token); @RequestMapping(value = "unreserve/{id}", method = RequestMethod.POST) @ResponseBody String unreserve(@PathVariable String id); @RequestMapping(value = "reserve/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody String reservePolitely(@PathVariable String token,
            @PathVariable String id, @PathVariable String expiration); @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody boolean reserve(@PathVariable String token, @PathVariable String id,
            @PathVariable String expiration); @RequestMapping(value = "reserved/id/{id}", method = RequestMethod.GET) @ResponseBody Map<String, String> isReservered(@PathVariable String id); @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] listAll(); }
DawgPoundRestController { @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] listAll() { DawgPoundMongoService mongo = (DawgPoundMongoService) service; LOGGER.info("Request to list all devices in the datastore."); return mongo.list(); }  @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] getReservered(@PathVariable String token); @RequestMapping(value = "unreserve/{id}", method = RequestMethod.POST) @ResponseBody String unreserve(@PathVariable String id); @RequestMapping(value = "reserve/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody String reservePolitely(@PathVariable String token,
            @PathVariable String id, @PathVariable String expiration); @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody boolean reserve(@PathVariable String token, @PathVariable String id,
            @PathVariable String expiration); @RequestMapping(value = "reserved/id/{id}", method = RequestMethod.GET) @ResponseBody Map<String, String> isReservered(@PathVariable String id); @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] listAll();  }