X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FPolicyControllerTest.java;h=554c40f90cce44daf48698783ed657ed9eee6b9f;hb=HEAD;hp=65077ae0168a145ae39642abb11d25adf05fd9e8;hpb=9db5a88dda1a9a32dd4c3ddc6ae1fb9b602a2a5b;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java index 65077ae01..554c40f90 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,15 +19,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.util.ArrayList; import java.util.List; + import javax.script.SimpleBindings; + import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; @@ -43,17 +47,20 @@ public class PolicyControllerTest { private static Logger logger = FlexLogger.getLogger(PolicyControllerTest.class); private static CommonClassDao commonClassDao; + /** + * setUp. + * + * @throws Exception Should not throw one + */ @Before public void setUp() throws Exception { logger.info("setUp: Entering"); commonClassDao = mock(CommonClassDao.class); PolicyController.setCommonClassDao(commonClassDao); - List data = new ArrayList<>(); String policyData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyData = IOUtils - .toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")); + policyData = IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")); } catch (Exception e1) { e1.printStackTrace(); } @@ -61,6 +68,7 @@ public class PolicyControllerTest { entity.setPolicyName("Config_SampleTest.1.xml"); entity.setPolicyData(policyData); entity.setScope("com"); + List data = new ArrayList<>(); data.add(entity); when(commonClassDao.getDataByQuery(