Add junit coverage to Constants class 85/41985/5
authorZihmin Hoover <zh4590@att.com>
Tue, 10 Apr 2018 19:19:16 +0000 (15:19 -0400)
committerPatrick Brady <pb071s@att.com>
Wed, 11 Apr 2018 20:41:54 +0000 (20:41 +0000)
Introduce junit-tests for Constants class

Change-Id: Ic33aa704f0ca19d81f32a013cd0a98d52433172c
Issue-ID: APPC-844
Signed-off-by: Zihmin Hoover <zh4590@att.com>
appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/test/java/org/onap/appc/adapter/ssh/ConstantsTest.java [new file with mode: 0644]

diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/test/java/org/onap/appc/adapter/ssh/ConstantsTest.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/test/java/org/onap/appc/adapter/ssh/ConstantsTest.java
new file mode 100644 (file)
index 0000000..ccdd945
--- /dev/null
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.adapter.ssh;
+
+import static org.junit.Assert.assertEquals;
+import java.lang.reflect.Constructor;
+import org.junit.Test;
+
+public class ConstantsTest {
+
+    @Test
+    public void test() {
+        String payLoad = Constants.PAYLOAD;
+        assertEquals(payLoad, "payload");
+
+        assertEquals(Constants.NETCONF_SCHEMA, "sdnctl");
+        assertEquals(Constants.SDNCTL_SCHEMA, "sdnctl" );
+        assertEquals(Constants.DEVICE_AUTHENTICATION_TABLE_NAME, "DEVICE_AUTHENTICATION" );
+        assertEquals(Constants.CONFIGFILES_TABLE_NAME, "CONFIGFILES" );
+        assertEquals(Constants.DEVICE_INTERFACE_LOG_TABLE_NAME, "DEVICE_INTERFACE_LOG" );
+        assertEquals(Constants.FILE_CONTENT_TABLE_FIELD_NAME, "FILE_CONTENT" );
+        assertEquals(Constants.FILE_NAME_TABLE_FIELD_NAME, "FILE_NAME" );
+
+        assertEquals(Constants.VM_NAMES[0], "fe1");
+        assertEquals(Constants.VM_NAMES[1], "fe2");
+        assertEquals(Constants.VM_NAMES[2], "be1");
+        assertEquals(Constants.VM_NAMES[3], "be2");
+        assertEquals(Constants.VM_NAMES[4], "be3");
+        assertEquals(Constants.VM_NAMES[5], "be4");
+        assertEquals(Constants.VM_NAMES[6], "be5");
+        assertEquals(Constants.VM_NAMES[7], "smp1");
+        assertEquals(Constants.VM_NAMES[8], "smp2");
+
+        assertEquals(Constants.DG_ERROR_FIELD_NAME, "org.openecom.appc.dg.error");
+
+    }
+    @Test
+    public void testValidatesThatClassConstantsIsNotInstantiable() throws Exception {
+        Constructor<Constants> c = Constants.class.getDeclaredConstructor();
+        c.setAccessible(true);
+        c.newInstance();
+    }
+}