aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/test
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-01-10 10:16:16 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-01-10 10:16:22 -0500
commit7d6464baa60086d83c7f3c4f2034175b14158e0d (patch)
treee45cea9e87b461dcbd38333dbe270dd0de6a258e /mso-catalog-db/src/test
parent9d77758d706d13c1c2ea46ada1837d757adbf9ba (diff)
removed powermock dependecy and added it to
removed powermock dependecy and added it to enforcer plugin Issue-ID: SO-2597 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ib2dff9818fffaef1b356db03795fdca238dfed75
Diffstat (limited to 'mso-catalog-db/src/test')
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java51
1 files changed, 18 insertions, 33 deletions
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index d87ed517f4..66fc0f5dc5 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -19,42 +19,33 @@
*/
package org.onap.so.db.catalog.client;
+
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityNotFoundException;
-import org.junit.Before;
+import javax.ws.rs.core.UriBuilder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.ArgumentMatchers;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import uk.co.blackpepper.bowman.Client;
import org.onap.so.db.catalog.beans.Workflow;
+import uk.co.blackpepper.bowman.Client;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(CatalogDbClient.class)
+@RunWith(MockitoJUnitRunner.class)
public class CatalogDbClientTest {
+ @Spy
private CatalogDbClient catalogDbClient;
-
- private CatalogDbClient mockedCatalogDbClient;
-
- @Before
- public void init() {
- catalogDbClient = new CatalogDbClient();
- mockedCatalogDbClient = PowerMockito.spy(catalogDbClient);
- }
-
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -190,19 +181,13 @@ public class CatalogDbClientTest {
@Test
public final void testFindWorkflowByPnfModelUUID() throws Exception {
String pnfResourceModelUUID = "f2d1f2b2-88bb-49da-b716-36ae420ccbff";
- Workflow wf = new Workflow();
- wf.setArtifactUUID("b2fd5627-55e4-4f4f-8064-9e6f443e9152");
- wf.setArtifactName("DummyPnfWorkflow");
- wf.setVersion(1.0);
- List<Workflow> wfList = new ArrayList<Workflow>();
- wfList.add(wf);
-
- PowerMockito.doReturn(wfList).when(mockedCatalogDbClient, "getMultipleResources",
- ArgumentMatchers.<Client<Workflow>>any(), ArgumentMatchers.anyObject());
- List<Workflow> results = mockedCatalogDbClient.findWorkflowByPnfModelUUID(pnfResourceModelUUID);
- assertEquals(wf.getArtifactUUID(), results.get(0).getArtifactUUID());
- assertEquals(wf.getArtifactName(), results.get(0).getArtifactName());
- assertEquals(wf.getVersion(), results.get(0).getVersion());
+
+ doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any());
+ List<Workflow> results = catalogDbClient.findWorkflowByPnfModelUUID(pnfResourceModelUUID);
+ verify(catalogDbClient).getMultipleResources(any(Client.class),
+ eq(UriBuilder.fromUri("/findWorkflowByPnfModelUUID")
+ .queryParam(CatalogDbClient.PNF_RESOURCE_MODEL_UUID, pnfResourceModelUUID).build()));
+
}
}