AdminTabController extends RestrictedBaseController { @RequestMapping( value = {"/get_LockDownData"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) public void getAdminTabEntityData(HttpServletRequest request, HttpServletResponse response) { try { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); model.put("lockdowndata", mapper.writeValueAsString(commonClassDao.getData(GlobalRoleSettings.class))); response.getWriter().write(new JSONObject(new JsonMessage(mapper.writeValueAsString(model))).toString()); } catch (Exception e) { LOGGER.error("Exception Occured" + e); } } AdminTabController(); @Autowired private  AdminTabController(CommonClassDao commonClassDao); static CommonClassDao getCommonClassDao(); static void setCommonClassDao(CommonClassDao commonClassDao); @RequestMapping( value = {"/get_LockDownData"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getAdminTabEntityData(HttpServletRequest request, HttpServletResponse response); @RequestMapping( value = {"/adminTabController/save_LockDownValue.htm"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST}) ModelAndView saveAdminTabLockdownValue(HttpServletRequest request, HttpServletResponse response);  }
@SuppressWarnings("unchecked") @Test public void testGetAdminTabEntityDataException() throws IOException { HttpServletResponse mockResponse = Mockito.mock(HttpServletResponse.class); when(mockResponse.getWriter()).thenThrow(IOException.class); admin.getAdminTabEntityData(request, mockResponse); verify(mockResponse).getWriter(); }