diff options
3 files changed, 39 insertions, 3 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java b/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java index f8afd549..1d9cb549 100644 --- a/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java +++ b/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java @@ -95,7 +95,7 @@ public class OnapCommandParameterCache { try { OnapCommandUtils.persistParams(params, this.profileName); } catch (OnapCommandPersistProfileFailed e) { - throw new RuntimeException(e); + throw new RuntimeException(e); // NOSONAR } } @@ -104,7 +104,7 @@ public class OnapCommandParameterCache { try { params = OnapCommandUtils.loadParamFromCache(this.profileName); } catch (OnapCommandLoadProfileFailed e) { - throw new RuntimeException(e); + throw new RuntimeException(e); // NOSONAR } for (Param p : params) { diff --git a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java index dd42cdc5..704d4704 100644 --- a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java +++ b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java @@ -275,6 +275,10 @@ public class OnapCommandErrorTest { OnapCommandPersistProfileFailed failed = new OnapCommandPersistProfileFailed("error"); assertEquals("0x1302::Failed to persist profile details, error", failed.getMessage()); + + failed = new OnapCommandPersistProfileFailed(new Exception("error")); + + assertEquals("0x1302::Failed to persist profile details, error", failed.getMessage()); } @@ -283,5 +287,9 @@ public class OnapCommandErrorTest { OnapCommandLoadProfileFailed failed = new OnapCommandLoadProfileFailed("error"); assertEquals("0x1301::Failed to load profile details, error", failed.getMessage()); + + failed = new OnapCommandLoadProfileFailed(new Exception("error")); + + assertEquals("0x1301::Failed to load profile details, error", failed.getMessage()); } } diff --git a/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java b/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java index f052cbd1..092ef8d8 100644 --- a/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java +++ b/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java @@ -160,43 +160,71 @@ public class OnapCliMainTest { } catch (Exception e) { } - mockConsole("microservice-create -h"); + cli = new OnapCli(new String[] {}); + mockConsole("sample-test -h"); try { cli.handleInteractive(); } catch (Exception e) { } + cli = new OnapCli(new String[] {}); + mockConsole("use cli-1.0"); + try { + cli.handleInteractive(); + } catch (Exception e) { + } + + cli = new OnapCli(new String[] {}); mockConsole("set a=b"); try { cli.handleInteractive(); } catch (Exception e) { } + cli = new OnapCli(new String[] {}); + mockConsole("set"); + try { + cli.handleInteractive(); + } catch (Exception e) { + } + + cli = new OnapCli(new String[] {}); + mockConsole("set a="); + try { + cli.handleInteractive(); + } catch (Exception e) { + } + + cli = new OnapCli(new String[] {}); mockConsole("unset a"); try { cli.handleInteractive(); } catch (Exception e) { } + cli = new OnapCli(new String[] {}); mockConsole("profile test"); try { cli.handleInteractive(); } catch (Exception e) { } + cli = new OnapCli(new String[] {}); mockConsole("version"); try { cli.handleInteractive(); } catch (Exception e) { } + cli = new OnapCli(new String[] {}); mockConsole("help"); try { cli.handleInteractive(); } catch (Exception e) { } + cli = new OnapCli(new String[] {}); mockConsoleReader(); cli.handleInteractive(); |