@Test public void testGetPersonNull() { Mockito.when(personManager.getPerson(req)).thenReturn(null); ModelAndView modelAndView = peopleRESTControllerV50.getPerson(USER_NAME, req, res); Assert.assertEquals(401, res.getStatus()); Assert.assertEquals(null, modelAndView); }
@RequestMapping(value = "/{username}", method = RequestMethod.GET) public ModelAndView getPerson( @PathVariable String username, HttpServletRequest request, HttpServletResponse response) { final IPerson searcher = personManager.getPerson(request); if (searcher == null) { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return null; } final IPersonAttributes person = lookupHelper.findPerson(searcher, username); if (person == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return null; } return new ModelAndView("json", person.getAttributes()); }
PeopleRESTControllerV50 { @RequestMapping(value = "/{username}", method = RequestMethod.GET) public ModelAndView getPerson( @PathVariable String username, HttpServletRequest request, HttpServletResponse response) { final IPerson searcher = personManager.getPerson(request); if (searcher == null) { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return null; } final IPersonAttributes person = lookupHelper.findPerson(searcher, username); if (person == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return null; } return new ModelAndView("json", person.getAttributes()); } }
PeopleRESTControllerV50 { @RequestMapping(value = "/{username}", method = RequestMethod.GET) public ModelAndView getPerson( @PathVariable String username, HttpServletRequest request, HttpServletResponse response) { final IPerson searcher = personManager.getPerson(request); if (searcher == null) { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return null; } final IPersonAttributes person = lookupHelper.findPerson(searcher, username); if (person == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return null; } return new ModelAndView("json", person.getAttributes()); }  }
PeopleRESTControllerV50 { @RequestMapping(value = "/{username}", method = RequestMethod.GET) public ModelAndView getPerson( @PathVariable String username, HttpServletRequest request, HttpServletResponse response) { final IPerson searcher = personManager.getPerson(request); if (searcher == null) { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return null; } final IPersonAttributes person = lookupHelper.findPerson(searcher, username); if (person == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return null; } return new ModelAndView("json", person.getAttributes()); }  @Autowired void setJsonMapper(ObjectMapper jsonMapper); @Autowired void setPersonManager(IPersonManager personManager); @Autowired(required = true) void setPersonLookupHelper(PersonLookupHelperImpl lookupHelper); @RequestMapping(method = RequestMethod.GET) void searchPeople(
            @RequestParam Map<String, Object> query,
            HttpServletRequest request,
            HttpServletResponse response); @RequestMapping(value = "/{username}", method = RequestMethod.GET) ModelAndView getPerson(
            @PathVariable String username,
            HttpServletRequest request,
            HttpServletResponse response); @RequestMapping(value = "/me", method = RequestMethod.GET) ModelAndView getMe(HttpServletRequest request, HttpServletResponse response); }
PeopleRESTControllerV50 { @RequestMapping(value = "/{username}", method = RequestMethod.GET) public ModelAndView getPerson( @PathVariable String username, HttpServletRequest request, HttpServletResponse response) { final IPerson searcher = personManager.getPerson(request); if (searcher == null) { response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return null; } final IPersonAttributes person = lookupHelper.findPerson(searcher, username); if (person == null) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return null; } return new ModelAndView("json", person.getAttributes()); }  @Autowired void setJsonMapper(ObjectMapper jsonMapper); @Autowired void setPersonManager(IPersonManager personManager); @Autowired(required = true) void setPersonLookupHelper(PersonLookupHelperImpl lookupHelper); @RequestMapping(method = RequestMethod.GET) void searchPeople(
            @RequestParam Map<String, Object> query,
            HttpServletRequest request,
            HttpServletResponse response); @RequestMapping(value = "/{username}", method = RequestMethod.GET) ModelAndView getPerson(
            @PathVariable String username,
            HttpServletRequest request,
            HttpServletResponse response); @RequestMapping(value = "/me", method = RequestMethod.GET) ModelAndView getMe(HttpServletRequest request, HttpServletResponse response);  }