summaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test/java/org/onap')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/PapConstantsTest.java9
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java16
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java2
3 files changed, 11 insertions, 16 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/PapConstantsTest.java b/main/src/test/java/org/onap/policy/pap/main/PapConstantsTest.java
index 4733f91e..6d5d303a 100644
--- a/main/src/test/java/org/onap/policy/pap/main/PapConstantsTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/PapConstantsTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP PAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,15 +21,14 @@
package org.onap.policy.pap.main;
-import org.assertj.core.api.Assertions;
+import static org.assertj.core.api.Assertions.assertThat;
+
import org.junit.Test;
-import org.powermock.reflect.Whitebox;
public class PapConstantsTest {
@Test
public void test() {
- // verify that constructor does not throw an exception
- Assertions.assertThatCode(() -> Whitebox.invokeConstructor(PapConstants.class)).doesNotThrowAnyException();
+ assertThat(PapConstants.PAP_NAME).startsWith("pap").isNotEqualTo("pap");
}
}
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java
index 1ea13119..f64a77b3 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupCreateOrUpdateProvider.java
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -50,6 +49,7 @@ import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.pap.main.PapConstants;
public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper {
private static final String EXPECTED_EXCEPTION = "expected exception";
@@ -292,10 +292,12 @@ public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper {
assertEquals(2, pdpUpdates.size());
PdpUpdate pdpUpdate = pdpUpdates.get(0);
+ assertEquals(PapConstants.PAP_NAME, pdpUpdate.getSource());
assertEquals(PDP2, pdpUpdate.getName());
assertNull(pdpUpdate.getPdpGroup());
pdpUpdate = pdpUpdates.get(1);
+ assertEquals(PapConstants.PAP_NAME, pdpUpdate.getSource());
assertEquals(PDP4, pdpUpdate.getName());
assertNull(pdpUpdate.getPdpGroup());
@@ -304,10 +306,12 @@ public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper {
assertEquals(2, changes.size());
PdpStateChange change = changes.get(0);
+ assertEquals(PapConstants.PAP_NAME, change.getSource());
assertEquals(PDP2, change.getName());
assertEquals(PdpState.PASSIVE, change.getState());
change = changes.get(1);
+ assertEquals(PapConstants.PAP_NAME, change.getSource());
assertEquals(PDP4, change.getName());
assertEquals(PdpState.PASSIVE, change.getState());
}
@@ -541,16 +545,6 @@ public class TestPdpGroupCreateOrUpdateProvider extends ProviderSuper {
assertNoGroupAction();
}
- protected void assertUpdate(List<PdpUpdate> updates, String groupName, String pdpType, String pdpName) {
-
- PdpUpdate update = updates.remove(0);
-
- assertEquals(groupName, update.getPdpGroup());
- assertEquals(pdpType, update.getPdpSubgroup());
- assertEquals(pdpName, update.getName());
- assertTrue(update.getPoliciesToBeDeployed().contains(policy1));
- }
-
private void assertNoGroupAction() throws Exception {
verify(dao, never()).createPdpGroups(any());
verify(dao, never()).updatePdpGroups(any());
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java
index ce032647..49eec772 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestProviderBase.java
@@ -49,6 +49,7 @@ import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
+import org.onap.policy.pap.main.PapConstants;
import org.powermock.reflect.Whitebox;
public class TestProviderBase extends ProviderSuper {
@@ -279,6 +280,7 @@ public class TestProviderBase extends ProviderSuper {
PdpUpdate update = updates.remove(0);
+ assertEquals(PapConstants.PAP_NAME, update.getSource());
assertEquals(groupName, update.getPdpGroup());
assertEquals(pdpType, update.getPdpSubgroup());
assertEquals(pdpName, update.getName());