Update css file name in conf.py
[policy/engine.git] / ONAP-PAP-REST / src / test / java / org / onap / policy / pap / test / UpdateOthersPAPSTest.java
index 9990201..fcec4a6 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-PAP-REST
  * ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ 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 static org.mockito.ArgumentMatchers.anyString;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -35,7 +36,6 @@ import org.json.JSONObject;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
@@ -43,13 +43,16 @@ import org.onap.policy.pap.xacml.rest.UpdateOthersPAPS;
 import org.onap.policy.pap.xacml.rest.adapters.UpdateObjectData;
 import org.onap.policy.pap.xacml.rest.components.Policy;
 import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 import org.springframework.mock.web.MockHttpServletResponse;
 
 @RunWith(PowerMockRunner.class)
+@PowerMockIgnore({"com.sun.org.apache.xalan.*", "com.sun.org.apache.xerces.*", "jdk.internal.reflect.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
+@PrepareForTest(UpdateOthersPAPS.class)
 public class UpdateOthersPAPSTest {
 
     private static Logger logger = FlexLogger.getLogger(UpdateOthersPAPSTest.class);
@@ -65,20 +68,20 @@ public class UpdateOthersPAPSTest {
         request = mock(HttpServletRequest.class);
         response = new MockHttpServletResponse();
         List<Object> data = new ArrayList<>();
-        PolicyDBDaoEntity entity = new PolicyDBDaoEntity();
-        entity.setPolicyDBDaoUrl("http://localhost:8070/pap");
+        PolicyDbDaoEntity entity = new PolicyDbDaoEntity();
+        entity.setPolicyDbDaoUrl("http://localhost:8070/pap");
         entity.setUsername("test");
         entity.setPassword("test");
 
-        PolicyDBDaoEntity entity1 = new PolicyDBDaoEntity();
-        entity1.setPolicyDBDaoUrl("http://localhost:8071/pap");
+        PolicyDbDaoEntity entity1 = new PolicyDbDaoEntity();
+        entity1.setPolicyDbDaoUrl("http://localhost:8071/pap");
         entity1.setUsername("test");
         entity1.setPassword("test");
 
         data.add(entity);
         data.add(entity1);
         System.setProperty("xacml.rest.pap.url", "http://localhost:8070/pap");
-        when(commonClassDao.getData(PolicyDBDaoEntity.class)).thenReturn(data);
+        when(commonClassDao.getData(PolicyDbDaoEntity.class)).thenReturn(data);
     }
 
     @Test
@@ -110,7 +113,7 @@ public class UpdateOthersPAPSTest {
         when(Policy.getActionHome()).thenReturn("test");
         File mockedFile = Mockito.mock(File.class);
         Mockito.when(mockedFile.exists()).thenReturn(true);
-        PowerMockito.whenNew(File.class).withParameterTypes(String.class).withArguments(Matchers.anyString())
+        PowerMockito.whenNew(File.class).withParameterTypes(String.class).withArguments(anyString())
                 .thenReturn(mockedFile);
         updateOtherPaps.updateConfiguration(data, response);
         assertTrue(response.getStatus() == 200);