added test case to SshJcraftWrapperTest 03/65403/2
authorSandeep J <sandeejh@in.ibm.com>
Sun, 9 Sep 2018 20:09:35 +0000 (01:39 +0530)
committerSandeep Jha <sandeejh@in.ibm.com>
Sun, 9 Sep 2018 20:15:08 +0000 (20:15 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: Ic40b87f63f4b14b70870fa717bcf01f206dc982f
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/SshJcraftWrapperTest.java

index ce2b385..7bf6b77 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * =============================================================================
  * 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
@@ -20,7 +22,7 @@
  *
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.appc.ccadaptor;
 
 import static org.junit.Assert.assertEquals;
@@ -66,6 +68,7 @@ import org.junit.runner.RunWith;
 import org.mockito.InOrder;
 import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.appc.ccadaptor.SshJcraftWrapper.MyUserInfo;
 import org.apache.commons.io.IOUtils;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -137,4 +140,22 @@ public class SshJcraftWrapperTest {
         SshJcraftWrapper wrapper = new SshJcraftWrapper();
         wrapper.checkIfReceivedStringMatchesDelimeter(3, "test");
     }
+    
+    @Test(expected=IOException.class)
+    public void testConnect() throws IOException{
+        SshJcraftWrapper wrapper = new SshJcraftWrapper();
+        wrapper.connect("testHost", "testUser", "testPswd", "3000", 1000);
+    }
+    
+    @Test
+    public void testMyUserInfoGetPassword() {
+        MyUserInfo myUserInfo=new MyUserInfo();
+        assertNull(myUserInfo.getPassword());
+    }
+    
+    @Test
+    public void testMyUserInfoPromptYesNo() {
+        MyUserInfo myUserInfo=new MyUserInfo();
+        assertFalse(myUserInfo.promptYesNo(""));
+    }
 }