diff options
3 files changed, 13 insertions, 6 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSample.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSample.java index 8d2d7c7a..32e5cf65 100644 --- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSample.java +++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSample.java @@ -28,10 +28,6 @@ public class OnapCommandInvalidSample extends OnapCommandException { private static final String ERROR_MSG = "Invalid command sample "; - public OnapCommandInvalidSample(String error) { - this(ERROR_CODE, error); - } - public OnapCommandInvalidSample(String schema, String error) { super(ERROR_CODE, ERROR_MSG + schema + ", " + error); } 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 e56eac03..cc12cfc0 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 @@ -256,6 +256,17 @@ public class OnapCommandErrorTest { } @Test + public void onapCommandSampleInvalidTest() { + OnapCommandInvalidSample failed = new OnapCommandInvalidSample("Test", "error"); + + assertEquals("0xf001::Invalid command sample Test, error", failed.getMessage()); + + failed = new OnapCommandInvalidSample("Test", new Exception("error")); + + assertEquals("0xf001::Invalid command sample Test, error", failed.getMessage()); + } + + @Test public void onapCommandServiceNotFoundTest() { OnapCommandServiceNotFound failed = new OnapCommandServiceNotFound("Service"); diff --git a/validation/src/test/java/org/onap/cli/moco/OnapCommandHttpMocoServer.java b/validation/src/test/java/org/onap/cli/moco/OnapCommandHttpMocoServer.java index f92e0c00..7f84704c 100644 --- a/validation/src/test/java/org/onap/cli/moco/OnapCommandHttpMocoServer.java +++ b/validation/src/test/java/org/onap/cli/moco/OnapCommandHttpMocoServer.java @@ -105,13 +105,13 @@ public class OnapCommandHttpMocoServer { try { values = (Map<String, ?>) new Yaml().load(file.getInputStream()); } catch (Exception e) { - throw new OnapCommandInvalidSample("Invalid sample", e); + throw new OnapCommandInvalidSample(file.getFilename(), e); } OnapCommandSample sample = new OnapCommandSample(); if (!this.getValue(values, SAMPLE_VERSION).equals(SAMPLE_VERSION_1_0)) { - throw new OnapCommandInvalidSample("Invalid sample version " + this.getValue(values, SAMPLE_VERSION)); + throw new OnapCommandInvalidSample(file.getFilename(), "Invalid sample version " + this.getValue(values, SAMPLE_VERSION)); } sample.setCommandName(this.getValue(values, SAMPLE_COMMAND_NAME)); |