OptimizationDictionaryController { @RequestMapping(value = {"/oof_dictionary/remove_model"}, method = {RequestMethod.POST}) public void removeOptimizationModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException { DictionaryUtils dUtils = getDictionaryUtilsInstance(); dUtils.removeData(request, response, optimizationModelsDictionaryDatas, OptimizationModels.class); } OptimizationDictionaryController(); @Autowired  OptimizationDictionaryController(CommonClassDao commonClassDao); static void setCommonClassDao(CommonClassDao commonClassDao); @RequestMapping( value = {"/get_OptimizationModelsData"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getOptimizationModelsDictionaryEntityData(HttpServletResponse response); @RequestMapping( value = {"/get_OptimizationModelsDataByName"}, method = {RequestMethod.GET}, produces = MediaType.APPLICATION_JSON_VALUE) void getOptimizationModelsDictionaryByNameEntityData(HttpServletResponse response); @RequestMapping(value = {"/oof_dictionary/save_model"}, method = {RequestMethod.POST}) ModelAndView saveOptimizationModelsDictionary(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = {"/oof_dictionary/remove_model"}, method = {RequestMethod.POST}) void removeOptimizationModelsDictionary(HttpServletRequest request, HttpServletResponse response);  }
@Test public void testRemoveOptimizationModelsDictionary() { logger.info("testRemoveOptimizationModelsDictionary: Entering"); MockHttpServletResponse response = new MockHttpServletResponse(); request = mock(HttpServletRequest.class); try { jsonString = "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\"," + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0," + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\"," + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false}," + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"}," + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\"," + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\"," + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\"," + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\"," + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}}," + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}"; BufferedReader br = new BufferedReader(new StringReader(jsonString)); when(request.getReader()).thenReturn(br); controller.removeOptimizationModelsDictionary(request, response); logger.info("response.getContentAsString(): " + response.getContentAsString()); assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("optimizationModelsDictionaryDatas")); } catch (Exception e) { fail("Exception: " + e); } logger.info("testRemoveOptimizationModelsDictionary: exit"); }