@Test public void verifyClearPassWithUsernameMissingInCache() throws Exception { final ClearPassController controller = new ClearPassController(this.map); final MockHttpServletRequest req = new MockHttpServletRequest(); req.setRemoteUser("casuser"); final ModelAndView mv = controller.handleRequestInternal(req, new MockHttpServletResponse()); assertEquals(mv.getViewName(), ClearPassController.DEFAULT_SERVICE_FAILURE_VIEW_NAME); assertTrue(mv.getModel().containsKey(ClearPassController.MODEL_FAILURE_DESCRIPTION)); }
@Test public void verifyClearPassSuccess() throws Exception { final ClearPassController controller = new ClearPassController(this.map); final MockHttpServletRequest req = new MockHttpServletRequest(); req.setRemoteUser("casuser"); this.map.put("casuser", "password"); final ModelAndView mv = controller.handleRequestInternal(req, new MockHttpServletResponse()); assertEquals(mv.getViewName(), ClearPassController.DEFAULT_SERVICE_SUCCESS_VIEW_NAME); assertTrue(mv.getModel().containsKey(ClearPassController.MODEL_CLEARPASS)); assertTrue(mv.getModel().containsValue("password")); }