ProjectsController { @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody public Map<String, Object> getProjects() { Map<String, Object> resp = new HashMap<>(); resp.put("projects", pm.getProjects().values()); int lastProjectId = pm.getLastProject(); if (lastProjectId >= 0) { resp.put("lastProject", lastProjectId); } return resp; }  @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody Map<String, Object> getProjects(); @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseBody Project addProject(@RequestParam String path); @RequestMapping(value = "/{projectId}", method = RequestMethod.GET) @ResponseBody Project getProject(@PathVariable int projectId); @RequestMapping(value = "/{projectId}", method = RequestMethod.DELETE) @ResponseBody ResponseEntity<?> removeProject(@PathVariable int projectId); @RequestMapping(value = "/reset", method = RequestMethod.GET) @ResponseBody ResponseEntity<?> resetProject(); @RequestMapping(value = "/{projectId}/initialize", method = RequestMethod.POST) @ResponseBody Project initializeProject(@PathVariable int projectId, @RequestBody JsonNode hubConfigDelta); @RequestMapping(value = "/{projectId}/defaults", method = RequestMethod.GET) @ResponseBody synchronized HubSettings getDefaults(@PathVariable int projectId);  }
@Test public void getProjects() { assertEquals(0, ((Collection<ProjectInfo>)pc.getProjects().get("projects")).size()); assertEquals(false, pc.getProjects().keySet().contains("lastProject")); pc.addProject(projectPath); assertEquals(1, ((Collection<ProjectInfo>)pc.getProjects().get("projects")).size()); assertEquals(null, pc.getProjects().get("lastProject")); }