@Test public void testGetLastPlantedTrees() throws Exception { _dbInjecter.injectTreeToProject("wood", "Adam", 9, 900000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Bert", 8, 800000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Claus", 7, 700000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Adam", 6, 600000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Bert", 5, 500000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Claus", 4, 400000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Adam", 3, 300000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Bert", 2, 200000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Claus", 1, 100000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Adam", 1, 100000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Bert", 1, 100000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Claus", 1, 100000L, "Project"); mockMvc.perform(get(Uris.RANKING_LAST_PLANTED_TREES).accept("application/json")).andExpect(status().isOk()).andExpect(jsonPath("$.[0].name").value("Adam")) .andExpect(jsonPath("$.[0].amount").value(9)).andExpect(jsonPath("$.[0].plantedOn").value(900000)); }
@RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) public Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size) { return _rankingRepository.getLastPlantedTrees(PageRequest.of(page, size)); }
RankingController { @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) public Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size) { return _rankingRepository.getLastPlantedTrees(PageRequest.of(page, size)); } }
RankingController { @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) public Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size) { return _rankingRepository.getLastPlantedTrees(PageRequest.of(page, size)); }  }
RankingController { @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) public Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size) { return _rankingRepository.getLastPlantedTrees(PageRequest.of(page, size)); }  @RequestMapping(value = Uris.RANKING_BEST_USER, method = RequestMethod.GET) Page<TreeRankedUserData> getBestUser(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size, @RequestParam(value = "lastYear") boolean lastYear); @RequestMapping(value = Uris.RANKING_LAST_CREATED_USER, method = RequestMethod.GET) List<TimeRankedUserData> getLastUser(); @RequestMapping(value = Uris.RANKING_BEST_ORGANIZATION_TYPE + "{organizationType}", method = RequestMethod.GET) Page<TreeRankedUserData> getBestUserFromOrganizationType(@PathVariable OrganizationType organizationType, @Param(value = "page") int page, @Param(value = "size") int size,
            @RequestParam(value = "lastYear") boolean lastYear); @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size); @RequestMapping(value = Uris.RANKING_BEST_TEAM, method = RequestMethod.GET) Page<TreeRankedUserData> getBestTeams(@Param(value = "page") int page, @Param(value = "size") int size, @RequestParam(value = "lastYear") boolean lastYear); @RequestMapping(value = Uris.RANKING_BEST_USER_FOR_TIMERANGE + "{timeRange}", method = RequestMethod.GET) List<TreeRankedUserData> getBestUserFromTimeRange(@PathVariable String timeRange); @RequestMapping(value = Uris.RANKING_BEST_USER_FOR_PROJECT, method = RequestMethod.GET) Page<TreeRankedUserData> getBestUserForProject(@Param(value = "projectName") String projectName, @Param(value = "page") int page, @Param(value = "size") int size); @RequestMapping(value = Uris.RANKING_BEST_TEAM_FOR_PROJECT, method = RequestMethod.GET) Page<TreeRankedUserData> getBestTeamsForProject(@Param(value = "projectName") String projectName, @Param(value = "page") int page, @Param(value = "size") int size); @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES_IN_PROJECT, method = RequestMethod.GET) Page<TimeRankedTreeData> getLastPlantedTreesInProject(@Param(value = "projectName") String projectName, @Param(value = "page") int page, @Param(value = "size") int size); }
RankingController { @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) public Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size) { return _rankingRepository.getLastPlantedTrees(PageRequest.of(page, size)); }  @RequestMapping(value = Uris.RANKING_BEST_USER, method = RequestMethod.GET) Page<TreeRankedUserData> getBestUser(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size, @RequestParam(value = "lastYear") boolean lastYear); @RequestMapping(value = Uris.RANKING_LAST_CREATED_USER, method = RequestMethod.GET) List<TimeRankedUserData> getLastUser(); @RequestMapping(value = Uris.RANKING_BEST_ORGANIZATION_TYPE + "{organizationType}", method = RequestMethod.GET) Page<TreeRankedUserData> getBestUserFromOrganizationType(@PathVariable OrganizationType organizationType, @Param(value = "page") int page, @Param(value = "size") int size,
            @RequestParam(value = "lastYear") boolean lastYear); @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES, method = RequestMethod.GET) Page<TimeRankedTreeData> getLastPlantedTrees(@Param(value = "page") int page, @Param(value = "size") int size); @RequestMapping(value = Uris.RANKING_BEST_TEAM, method = RequestMethod.GET) Page<TreeRankedUserData> getBestTeams(@Param(value = "page") int page, @Param(value = "size") int size, @RequestParam(value = "lastYear") boolean lastYear); @RequestMapping(value = Uris.RANKING_BEST_USER_FOR_TIMERANGE + "{timeRange}", method = RequestMethod.GET) List<TreeRankedUserData> getBestUserFromTimeRange(@PathVariable String timeRange); @RequestMapping(value = Uris.RANKING_BEST_USER_FOR_PROJECT, method = RequestMethod.GET) Page<TreeRankedUserData> getBestUserForProject(@Param(value = "projectName") String projectName, @Param(value = "page") int page, @Param(value = "size") int size); @RequestMapping(value = Uris.RANKING_BEST_TEAM_FOR_PROJECT, method = RequestMethod.GET) Page<TreeRankedUserData> getBestTeamsForProject(@Param(value = "projectName") String projectName, @Param(value = "page") int page, @Param(value = "size") int size); @RequestMapping(value = Uris.RANKING_LAST_PLANTED_TREES_IN_PROJECT, method = RequestMethod.GET) Page<TimeRankedTreeData> getLastPlantedTreesInProject(@Param(value = "projectName") String projectName, @Param(value = "page") int page, @Param(value = "size") int size);  }