From: Zihmin Hoover Date: Tue, 10 Apr 2018 19:19:16 +0000 (-0400) Subject: Add junit coverage to Constants class X-Git-Tag: v1.3.0~38 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=8ec10f3df82d388328ca4cdf4f6e6e85e7037fe6;p=appc.git Add junit coverage to Constants class Introduce junit-tests for Constants class Change-Id: Ic33aa704f0ca19d81f32a013cd0a98d52433172c Issue-ID: APPC-844 Signed-off-by: Zihmin Hoover --- 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 index 000000000..ccdd94505 --- /dev/null +++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/test/java/org/onap/appc/adapter/ssh/ConstantsTest.java @@ -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 c = Constants.class.getDeclaredConstructor(); + c.setAccessible(true); + c.newInstance(); + } +}