X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PDP%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fxacml%2Fpdp%2Fstd%2Ffunctions%2FPolicyListTest.java;fp=ONAP-PDP%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpdp%2Ftest%2FTestRunner.java;h=17f509da4b0303e4eaf6c9430ed4d2261b9d09e7;hb=e64508463caed53e661e4e02e1de971b21f642a7;hp=b131964d4c09007445c5ca8e5e5c7a04333f2a2e;hpb=65ef62c9c8de81bf21817e6fb968a555dd87ae25;p=policy%2Fengine.git diff --git a/ONAP-PDP/src/test/java/org/onap/policy/pdp/test/TestRunner.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java similarity index 51% rename from ONAP-PDP/src/test/java/org/onap/policy/pdp/test/TestRunner.java rename to ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java index b131964d4..17f509da4 100644 --- a/ONAP-PDP/src/test/java/org/onap/policy/pdp/test/TestRunner.java +++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java @@ -17,30 +17,47 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.onap.policy.xacml.pdp.std.functions; -package org.onap.policy.pdp.test; +import static org.junit.Assert.*; -import org.junit.runner.JUnitCore; -import org.junit.runner.Result; -import org.junit.runner.notification.Failure; +import org.junit.Before; +import org.junit.Test; -public class TestRunner { - private static Result results; +public class PolicyListTest { - public static void main(String[] args) { - Result result = JUnitCore.runClasses(PDPTest.class); - for(Failure failure: result.getFailures()) { - System.out.println("Failed Test: " + failure.toString()); + @Before + public void setUp() throws Exception { + PolicyList.addPolicyID("Test"); + } + + @Test + public final void testGetpolicyList() { + try{ + assertTrue(PolicyList.getpolicyList().size() ==1); + }catch(Exception e){ + fail("operation failed, e="+e); + } + } + + @Test + public final void testAddPolicyID() { + try{ + PolicyList.addPolicyID("Test"); + assertTrue(PolicyList.getpolicyList().size() == 1); + }catch(Exception e){ + fail("operation failed, e="+e); } - results = null; - if(result.wasSuccessful()) { - System.out.println("Test Results... "); - System.out.println("Stats: \nRun Time: " + (results.getRunTime()+result.getRunTime()) + "\nTotal Tests:" + results.getRunCount()+ result.getRunCount() - + "\nFailures: " + results.getFailureCount()+ result.getFailureCount()); - System.exit(1); + } + + @Test + public final void testClearPolicyList() { + try{ + PolicyList.clearPolicyList(); + assertTrue(PolicyList.getpolicyList().size() == 0); + }catch(Exception e){ + fail("operation failed, e="+e); } - System.out.println("Tests Failed..."); - System.out.println("Stats: \nRun Time: " + result.getRunTime() + "\nTests:" + result.getRunCount() - + "\nFailures: " + result.getFailureCount()); } + }