summaryrefslogtreecommitdiffstats
path: root/adaptors/netconf-adaptor
diff options
context:
space:
mode:
authorGanesh <ganesh.c@samsung.com>2022-06-24 19:18:42 +0530
committerGanesh <ganesh.c@samsung.com>2022-06-24 19:19:05 +0530
commitd3b56a45e948a2e3d0cf8c5514cdaf4e08a0b4fe (patch)
tree1eac0203f255f2f03b0b575956a87b86a5f8b100 /adaptors/netconf-adaptor
parentd3811b9fbac20e066157bce96cb0844e12de5aa8 (diff)
sonar issue, Change the assertion arguments to not compare a primitive value with null
Signed-off-by: Ganesh <ganesh.c@samsung.com> Change-Id: Idc8fcd5e6b2c7dce0da0b8f04721634ece05c5c7 Issue-ID: CCSDK-3476
Diffstat (limited to 'adaptors/netconf-adaptor')
-rw-r--r--adaptors/netconf-adaptor/netconf-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/netconf/NetconfConnectionDetailsTest.java235
1 files changed, 117 insertions, 118 deletions
diff --git a/adaptors/netconf-adaptor/netconf-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/netconf/NetconfConnectionDetailsTest.java b/adaptors/netconf-adaptor/netconf-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/netconf/NetconfConnectionDetailsTest.java
index 2d0bea92c..544b149b4 100644
--- a/adaptors/netconf-adaptor/netconf-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/netconf/NetconfConnectionDetailsTest.java
+++ b/adaptors/netconf-adaptor/netconf-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/netconf/NetconfConnectionDetailsTest.java
@@ -1,118 +1,117 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : APPC
-* ================================================================================
-* Copyright 2018 TechMahindra
-* ================================================================================
-* Modifications Copyright (C) 2019 Ericsson
-*=================================================================================
-* 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.ccsdk.sli.adaptors.netconf;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NetconfConnectionDetailsTest {
- private NetconfConnectionDetails netconfConnectionDetails;
- private List<String> capabilities;
- private Properties additionalProperties;
-
- @Before
- public void SetUp() {
- netconfConnectionDetails = new NetconfConnectionDetails();
- }
-
- @Test
- public void testGetHost() {
- netconfConnectionDetails.setHost("host1");
- Assert.assertNotNull(netconfConnectionDetails.getHost());
- Assert.assertEquals("host1", netconfConnectionDetails.getHost());
- }
-
- @Test
- public void testGetPort() {
- netconfConnectionDetails.setPort(123);
- Assert.assertNotNull(netconfConnectionDetails.getPort());
- Assert.assertEquals(123, netconfConnectionDetails.getPort());
- }
-
- @Test
- public void testGetUsername() {
- netconfConnectionDetails.setUsername("ABC");
- Assert.assertNotNull(netconfConnectionDetails.getUsername());
- Assert.assertEquals("ABC", netconfConnectionDetails.getUsername());
- }
-
- @Test
- public void testGetPassword() {
- netconfConnectionDetails.setPassword("pass1");
- Assert.assertNotNull(netconfConnectionDetails.getPassword());
- Assert.assertEquals("pass1", netconfConnectionDetails.getPassword());
- }
-
- @Test
- public void testNullCapabilities() {
- capabilities = new ArrayList<String>();
- Assert.assertNull(netconfConnectionDetails.getCapabilities());
- }
-
- @Test
- public void testCapabilitiesWithValues() {
- capabilities = new ArrayList<String>();
- capabilities.add("capabilities1");
- capabilities.add("capabilities2");
- netconfConnectionDetails.setCapabilities(capabilities);
- Assert.assertTrue(capabilities.contains("capabilities2"));
- }
-
- @Test
- public void testCapabilities_Size() {
- capabilities = new ArrayList<String>();
- capabilities.add("capabilities1");
- capabilities.add("capabilities2");
- netconfConnectionDetails.setCapabilities(capabilities);
- Assert.assertEquals(2, capabilities.size());
- }
-
- @Test
- public void testAdditionalProperties() {
- additionalProperties = new Properties();
- Assert.assertNull(netconfConnectionDetails.getAdditionalProperties());
- }
-
- @Test
- public void testAdditionalPropertiesWithValues() {
- additionalProperties = new Properties();
- additionalProperties.put("A", "a");
- additionalProperties.put("B", "b");
- netconfConnectionDetails.setAdditionalProperties(additionalProperties);
- Assert.assertEquals("a", netconfConnectionDetails.getAdditionalProperties().get("A"));
- }
-
- @Test
- public void testAdditionalProperties_Size() {
- additionalProperties = new Properties();
- additionalProperties.put("A", "a");
- additionalProperties.put("B", "b");
- additionalProperties.put("C", "c");
- netconfConnectionDetails.setAdditionalProperties(additionalProperties);
- Assert.assertNotNull(netconfConnectionDetails.getAdditionalProperties());
- Assert.assertEquals(3, additionalProperties.size());
- }
-}
+/*
+* ============LICENSE_START=======================================================
+* ONAP : APPC
+* ================================================================================
+* Copyright 2018 TechMahindra
+* ================================================================================
+* Modifications Copyright (C) 2019 Ericsson
+*=================================================================================
+* 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.ccsdk.sli.adaptors.netconf;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NetconfConnectionDetailsTest {
+ private NetconfConnectionDetails netconfConnectionDetails;
+ private List<String> capabilities;
+ private Properties additionalProperties;
+
+ @Before
+ public void SetUp() {
+ netconfConnectionDetails = new NetconfConnectionDetails();
+ }
+
+ @Test
+ public void testGetHost() {
+ netconfConnectionDetails.setHost("host1");
+ Assert.assertNotNull(netconfConnectionDetails.getHost());
+ Assert.assertEquals("host1", netconfConnectionDetails.getHost());
+ }
+
+ @Test
+ public void testGetPort() {
+ netconfConnectionDetails.setPort(123);
+ Assert.assertEquals(123, netconfConnectionDetails.getPort());
+ }
+
+ @Test
+ public void testGetUsername() {
+ netconfConnectionDetails.setUsername("ABC");
+ Assert.assertNotNull(netconfConnectionDetails.getUsername());
+ Assert.assertEquals("ABC", netconfConnectionDetails.getUsername());
+ }
+
+ @Test
+ public void testGetPassword() {
+ netconfConnectionDetails.setPassword("pass1");
+ Assert.assertNotNull(netconfConnectionDetails.getPassword());
+ Assert.assertEquals("pass1", netconfConnectionDetails.getPassword());
+ }
+
+ @Test
+ public void testNullCapabilities() {
+ capabilities = new ArrayList<String>();
+ Assert.assertNull(netconfConnectionDetails.getCapabilities());
+ }
+
+ @Test
+ public void testCapabilitiesWithValues() {
+ capabilities = new ArrayList<String>();
+ capabilities.add("capabilities1");
+ capabilities.add("capabilities2");
+ netconfConnectionDetails.setCapabilities(capabilities);
+ Assert.assertTrue(capabilities.contains("capabilities2"));
+ }
+
+ @Test
+ public void testCapabilities_Size() {
+ capabilities = new ArrayList<String>();
+ capabilities.add("capabilities1");
+ capabilities.add("capabilities2");
+ netconfConnectionDetails.setCapabilities(capabilities);
+ Assert.assertEquals(2, capabilities.size());
+ }
+
+ @Test
+ public void testAdditionalProperties() {
+ additionalProperties = new Properties();
+ Assert.assertNull(netconfConnectionDetails.getAdditionalProperties());
+ }
+
+ @Test
+ public void testAdditionalPropertiesWithValues() {
+ additionalProperties = new Properties();
+ additionalProperties.put("A", "a");
+ additionalProperties.put("B", "b");
+ netconfConnectionDetails.setAdditionalProperties(additionalProperties);
+ Assert.assertEquals("a", netconfConnectionDetails.getAdditionalProperties().get("A"));
+ }
+
+ @Test
+ public void testAdditionalProperties_Size() {
+ additionalProperties = new Properties();
+ additionalProperties.put("A", "a");
+ additionalProperties.put("B", "b");
+ additionalProperties.put("C", "c");
+ netconfConnectionDetails.setAdditionalProperties(additionalProperties);
+ Assert.assertNotNull(netconfConnectionDetails.getAdditionalProperties());
+ Assert.assertEquals(3, additionalProperties.size());
+ }
+}