summaryrefslogtreecommitdiffstats
path: root/ONAP-REST
diff options
context:
space:
mode:
authorbobbymander <bobby.mander@att.com>2018-02-28 16:31:24 -0500
committerbobbymander <bobby.mander@att.com>2018-03-01 08:35:39 -0500
commitd417cdaf516523c2d3bc998ca246d0cf6a2c55ec (patch)
treea3dc61581c720922b3f2b49516d35153889c2e58 /ONAP-REST
parent10f11fafcf434c70cc9c302d2ab4a801601b71f7 (diff)
JUnit additions for PAP-REST,REST,XACML
Issue-ID: POLICY-603 Change-Id: I78c5e302c474613cbb22a80e0d931b4f47dd3b63 Signed-off-by: bobbymander <bobby.mander@att.com>
Diffstat (limited to 'ONAP-REST')
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java5
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java13
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java12
3 files changed, 29 insertions, 1 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
index 73cb0f07e..e52a4110e 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
@@ -452,4 +452,9 @@ public class XACMLRestProperties extends XACMLProperties {
* */
public static final String PROP_PAP_INCOMINGNOTIFICATION_TRIES = "xacml.rest.pap.incomingnotification.tries";
+
+ // Static class, hide constructor
+ private XACMLRestProperties() {
+ super();
+ }
}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
index 419b14daa..9b4cc3ffb 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
@@ -20,9 +20,13 @@
package org.onap.policy.rest;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -95,6 +99,13 @@ public class XACMLRestTest extends Mockito{
} catch (Exception e) {
fail();
}
-
+ }
+
+ @Test
+ public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ Constructor<XACMLRestProperties> constructor = XACMLRestProperties.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
}
} \ No newline at end of file
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java
index a153efe25..320c30213 100644
--- a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopPolicyAdaptersTest.java
@@ -21,6 +21,10 @@ package org.onap.policy.rest.adapter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -164,4 +168,12 @@ public class ClosedLoopPolicyAdaptersTest {
assertEquals(ClosedLoopPolicyStatus.ACTIVE.toString(), "active");
assertEquals(ClosedLoopPolicyStatus.INACTIVE.toString(), "inactive");
}
+
+ @Test
+ public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
+ Constructor<ClosedLoopPerformanceMetrics> constructor = ClosedLoopPerformanceMetrics.class.getDeclaredConstructor();
+ assertTrue(Modifier.isPrivate(constructor.getModifiers()));
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ }
}