* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
* ============LICENSE_START=======================================================
* ONAP Policy Engine
* ================================================================================
* ================================================================================
* Modifications Copyright (C) 2019 Samsung
* ================================================================================
* ================================================================================
* Modifications Copyright (C) 2019 Samsung
* ================================================================================
* limitations under the License.
* ============LICENSE_END=========================================================
*/
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.onap.policy.controller;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
package org.onap.policy.controller;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.web.servlet.ModelAndView;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.web.servlet.ModelAndView;
PolicyNotificationController controller = new PolicyNotificationController();
controller.commonClassDao = dao;
MockHttpServletRequest request = new MockHttpServletRequest();
PolicyNotificationController controller = new PolicyNotificationController();
controller.commonClassDao = dao;
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView model = controller.watchPolicy(request, response);
assertNull(model);
assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
// Negative test watch
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView model = controller.watchPolicy(request, response);
assertNull(model);
assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
// Negative test watch
- request.setBodyContent(
- "{\n\"watchData\": {\"name\": \"testVal\",\"nopath\": \"testPath\"\n}}\n");
+ request.setBodyContent("{\n\"watchData\": {\"name\": \"testVal\",\"nopath\": \"testPath\"\n}}\n");
response = new MockHttpServletResponse();
model = controller.watchPolicy(request, response);
assertNull(model);
response = new MockHttpServletResponse();
model = controller.watchPolicy(request, response);
assertNull(model);