JUnit workaround for PAP-REST, sonar bug 83/34283/1
authorbobbymander <bobby.mander@att.com>
Tue, 6 Mar 2018 14:53:30 +0000 (09:53 -0500)
committerbobbymander <bobby.mander@att.com>
Tue, 6 Mar 2018 14:53:37 +0000 (09:53 -0500)
Issue-ID: POLICY-600
Change-Id: I9d4d986b0703c67f65b67eedabca8d0d56965f2d
Signed-off-by: bobbymander <bobby.mander@att.com>
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/MicroServicePolicyTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java

index fa4bd20..39b21f1 100644 (file)
@@ -40,7 +40,6 @@ import java.io.File;
 import java.util.Collections;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({MicroServiceConfigPolicy.class, CreateNewMicroServiceModel.class})
 public class MicroServicePolicyTest {
        @Rule
     public ExpectedException thrown = ExpectedException.none();
@@ -60,6 +59,7 @@ public class MicroServicePolicyTest {
                assertNull(policy.getCorrectPolicyDataObject());
        }
        
+       @PrepareForTest({MicroServiceConfigPolicy.class})
        @Test
        public void testPrepareToSave() throws Exception {
                // Need to mock internal dictionary retrieval
@@ -84,6 +84,7 @@ public class MicroServicePolicyTest {
                assertNotNull(model);
        }
        
+       @PrepareForTest({CreateNewMicroServiceModel.class})
        @Test
        public void testCreateModel() throws Exception {
                // Mock file retrieval
index 9e9da17..3941593 100644 (file)
@@ -46,7 +46,6 @@ import java.util.List;
 import javax.persistence.EntityManager;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({DeleteHandler.class, XACMLPapServlet.class})
 public class DeleteHandlerTest {
        @Test
        public void testGets() {
@@ -62,6 +61,7 @@ public class DeleteHandlerTest {
                assertNotNull(handler);
        }
        
+       @PrepareForTest({DeleteHandler.class, XACMLPapServlet.class})
        @Test
        public void testDeletes() throws Exception {
                // Mock request