PolicyRolesController extends RestrictedBaseController { @RequestMapping( value = {"/get_PolicyRolesScopeData"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) public void getPolicyScopesEntityData(HttpServletRequest request, HttpServletResponse response) { try { scopelist = new ArrayList<>(); Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); List<String> scopesData = commonClassDao.getDataByColumn(PolicyEditorScopes.class, "scopeName"); model.put("scopeDatas", mapper.writeValueAsString(scopesData)); response.getWriter().write(new JSONObject(new JsonMessage(mapper.writeValueAsString(model))).toString()); } catch (Exception e) { LOGGER.error("Exception Occured" + e); } }  void setCommonClassDao(CommonClassDao commonClassDao); @RequestMapping( value = {"/get_RolesData"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getPolicyRolesEntityData(HttpServletRequest request, HttpServletResponse response); @RequestMapping( value = {"/save_NonSuperRolesData"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST}) ModelAndView SaveRolesEntityData(HttpServletRequest request, HttpServletResponse response); @RequestMapping( value = {"/get_PolicyRolesScopeData"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getPolicyScopesEntityData(HttpServletRequest request, HttpServletResponse response);  }
@Test public void testGetPolicyScopesEntityData() { try { controller.getPolicyScopesEntityData(request, response); assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("scopeDatas")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); fail(); } }