SafePolicyController { @RequestMapping(value = {"/sp_dictionary/remove_SafePolicyWarning"}, method = {RequestMethod.POST}) public void removeSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils utils = getDictionaryUtilsInstance(); utils.removeData(request, response, safePolicyWarningDatas, SafePolicyWarning.class); } @Autowired  SafePolicyController(CommonClassDao commonClassDao);  SafePolicyController(); void setCommonClassDao(CommonClassDao commonClassDao); @RequestMapping( value = {"/get_RiskTypeDataByName"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getRiskTypeDictionaryByNameEntityData(HttpServletResponse response); @RequestMapping( value = {"/get_RiskTypeData"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getRiskTypeDictionaryEntityData(HttpServletResponse response); @RequestMapping(value = {"/sp_dictionary/save_riskType"}, method = {RequestMethod.POST}) ModelAndView saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = {"/sp_dictionary/remove_riskType"}, method = {RequestMethod.POST}) void removeRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response); @RequestMapping( value = {"/get_SafePolicyWarningDataByName"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getSafePolicyWarningEntityDataByName(HttpServletResponse response); @RequestMapping( value = {"/get_SafePolicyWarningData"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getSafePolicyWarningeEntityData(HttpServletResponse response); @RequestMapping(value = {"/sp_dictionary/save_safePolicyWarning"}, method = {RequestMethod.POST}) ModelAndView saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = {"/sp_dictionary/remove_SafePolicyWarning"}, method = {RequestMethod.POST}) void removeSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response);  }
@Test public void testRemoveSafePolicyWarningDictionary() { jsonString = "{\"userid\":\"demo\",\"data\":{\"id\":1,\"description\":\"test\",\"name\":\"Test\"}}"; try (BufferedReader br = new BufferedReader(new StringReader(jsonString))) { when(request.getReader()).thenReturn(br); controller.removeSafePolicyWarningDictionary(request, response); assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("safePolicyWarningDatas")); } catch (Exception e) { logger.error("Exception" + e); } }