@Test(dataProvider = "populateTestDataProvider") public void testPopulateWithToken(Boolean isToOverrideMetaData) { HouseRestController houseController = EasyMock.createMock(HouseRestController.class); EasyMock.expect(houseController.populate((String) EasyMock.anyObject(), (Boolean) EasyMock.anyObject())).andReturn(1); EasyMock.replay(houseController); String token = "abc"; ParkService mockParkService = new MockParkService(); Assert.assertTrue(mockParkService.getSavedTokens().isEmpty()); PopulateController controller = new PopulateController(); ReflectionTestUtils.setField(controller, "parkService", mockParkService); ReflectionTestUtils.setField(controller, "houseController", houseController); Assert.assertEquals(controller.populate(token, isToOverrideMetaData), 1); Assert.assertFalse(mockParkService.getSavedTokens().isEmpty()); Assert.assertEquals(mockParkService.getSavedTokens().get(0).getToken(), token); }
@RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; } }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }  }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }  @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody int populate(@PathVariable String token,
            @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData); @RequestMapping(value = "populate") String populate(Model model); @RequestMapping(value = "populateTable") String populateTable(Model model); @Scheduled(fixedRate=1*12*60*60*1000) void populate(); @RequestMapping(value = "repopulate") String repopulate(Model model); }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }  @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody int populate(@PathVariable String token,
            @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData); @RequestMapping(value = "populate") String populate(Model model); @RequestMapping(value = "populateTable") String populateTable(Model model); @Scheduled(fixedRate=1*12*60*60*1000) void populate(); @RequestMapping(value = "repopulate") String repopulate(Model model);  }