@SuppressWarnings("unchecked") @Test public void testGetReservedWithValidReservedList() { Map<String, Object> deviceIds = new HashMap<String, Object>(); deviceIds.put("id", TestConstants.DEVICE_ID); ServerUtils serverUtil = new ServerUtils(); DawgPoundMongoService poundService = EasyMock.createMock(DawgPoundMongoService.class); DawgPoundRestController poundController = new DawgPoundRestController(); ReflectionTestUtils.setField(poundController, "serverUtils", serverUtil); ReflectionTestUtils.setField(poundController, "service", poundService); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); list.add(deviceIds); EasyMock.expect(poundService.getByReserver(TestConstants.PROCESSED_TOKEN)).andReturn(list.toArray(new Map[list.size()])); EasyMock.replay(poundService); Map<String,Object>[] reservers = poundController.getReservered(TestConstants.TOKEN); Assert.assertEquals(reservers.length, 1); EasyMock.verify(poundService); }
@RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] getReservered(@PathVariable String token) { token = clean(token); LOGGER.info("Request for reserved devices for token="+token); return service.getByReserver(token); }
DawgPoundRestController { @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] getReservered(@PathVariable String token) { token = clean(token); LOGGER.info("Request for reserved devices for token="+token); return service.getByReserver(token); } }
DawgPoundRestController { @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] getReservered(@PathVariable String token) { token = clean(token); LOGGER.info("Request for reserved devices for token="+token); return service.getByReserver(token); }  }
DawgPoundRestController { @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] getReservered(@PathVariable String token) { token = clean(token); LOGGER.info("Request for reserved devices for token="+token); return service.getByReserver(token); }  @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 = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody public Map<String,Object>[] getReservered(@PathVariable String token) { token = clean(token); LOGGER.info("Request for reserved devices for token="+token); return service.getByReserver(token); }  @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();  }