X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fhandler%2FDeleteHandlerTest.java;h=17967a4bbf346d0656ec21a49fd731dc4f447bb3;hp=008f2629e156634ec80f26033f83d5d1b473f14e;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java index 008f2629e..17967a4bb 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java @@ -26,10 +26,13 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; + import com.mockrunner.mock.web.MockHttpServletRequest; import com.mockrunner.mock.web.MockHttpServletResponse; + import java.util.Collections; import java.util.List; + import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; @@ -93,31 +96,30 @@ public class DeleteHandlerTest { PolicyElasticSearchController controller = Mockito.mock(PolicyElasticSearchController.class); PowerMockito.whenNew(PolicyElasticSearchController.class).withNoArguments().thenReturn(controller); - // Test deletion from PAP - MockHttpServletResponse response = new MockHttpServletResponse(); - try { - handler.doApiDeleteFromPap(request, response); - } catch (Exception ex) { - fail("Not expecting an exception: " + ex); - } + // Test deletion from PAP + MockHttpServletResponse response = new MockHttpServletResponse(); + try { + handler.doApiDeleteFromPap(request, response); + } catch (Exception ex) { + fail("Not expecting an exception: " + ex); + } // Test deletion from PDP OnapLoggingContext loggingContext = Mockito.mock(OnapLoggingContext.class); try { handler.doApiDeleteFromPdp(request, response, loggingContext); - } - catch (Exception ex) { + } catch (Exception ex) { fail("Not expecting an exception: " + ex); } - // Test delete entity - PolicyEntity policyEntity = new PolicyEntity(); - policyEntity.setPolicyName("testVal"); - String result = DeleteHandler.deletePolicyEntityData(policyEntity); - assertEquals(result, "success"); + // Test delete entity + PolicyEntity policyEntity = new PolicyEntity(); + policyEntity.setPolicyName("testVal"); + String result = DeleteHandler.deletePolicyEntityData(policyEntity); + assertEquals(result, "success"); - // Test check entity - List peResult = Collections.emptyList(); - assertEquals(DeleteHandler.checkPolicyGroupEntity(peResult), false); - } + // Test check entity + List peResult = Collections.emptyList(); + assertEquals(DeleteHandler.checkPolicyGroupEntity(peResult), false); + } }