diff options
author | 2017-09-29 17:17:31 +0530 | |
---|---|---|
committer | 2017-09-29 17:17:31 +0530 | |
commit | 3d11865921346189147f02eab887b7acc2dbd843 (patch) | |
tree | a913cf2d30c09e7b62209e60a638c07e5ae1a0d2 /framework/src/test/java/org/onap | |
parent | 789552ac35830642855c6a5d6c16afa3c4eed109 (diff) |
Enable exception to get traced
CLI-2
Change-Id: Ib16490d6800a07d69c995f2301d34bebf3f78c28
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/test/java/org/onap')
3 files changed, 10 insertions, 10 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java index c26678d7..6ba7f11e 100644 --- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java +++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java @@ -108,7 +108,7 @@ public class OnapCommandRegistrarTest { registerar.get("Test2"); fail("This should have thrown an exception"); } catch (OnapCommandRegistrationFailed e) { - assertTrue(e.getMessage().contains("0x0018::Command Test2 is failed to register")); + assertEquals("0x0018", e.getErrorCode()); } } 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 704d4704..d031cc77 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 @@ -27,7 +27,7 @@ public class OnapCommandErrorTest { OnapCommandDiscoveryFailed failed = new OnapCommandDiscoveryFailed("name"); assertEquals("0x0010::Failed auto discover schema files from name under class path, ", failed.getMessage()); failed = new OnapCommandDiscoveryFailed("directory", "name"); - assertEquals("0x0010::Failed auto generate json file 'name' under class path directory 'directory' , ", + assertEquals("0x0010::Failed auto generate json file 'name' under class path directory 'directory'", failed.getMessage()); } @@ -40,8 +40,8 @@ public class OnapCommandErrorTest { @Test public void onapCommandResultMapProcessingFailedTest() { OnapCommandResultMapProcessingFailed failed = new OnapCommandResultMapProcessingFailed("name", - new Exception("")); - assertEquals("0x0028::Failed to process the result map name in http section, ", failed.getMessage()); + new Exception("failed")); + assertEquals("0x0028::Failed to parse the result format of command name, failed", failed.getMessage()); } @Test @@ -155,7 +155,7 @@ public class OnapCommandErrorTest { public void onapCommandInvalidSchemaTest() { OnapCommandInvalidSchema failed = new OnapCommandInvalidSchema("Schema", "Failed"); - assertEquals("0x0007::Command schema Schema is invalid, Failed", failed.getMessage()); + assertEquals("0x0007::Invalid command schema Schema, Failed", failed.getMessage()); } @Test @@ -185,7 +185,7 @@ public class OnapCommandErrorTest { assertEquals("0x0010::Logout failed, Failed", failed.getMessage()); failed = new OnapCommandLogoutFailed(200); - assertEquals("200::0x0010::Logout failed, ", failed.getMessage()); + assertEquals("200::0x0010::Logout failed", failed.getMessage()); } @Test @@ -237,7 +237,7 @@ public class OnapCommandErrorTest { public void onapCommandRegistrationFailedTest() { OnapCommandRegistrationFailed failed = new OnapCommandRegistrationFailed("Test", "error"); - assertEquals("0x0018::Command Test is failed to register, error", failed.getMessage()); + assertEquals("0x0018::Failed to register the command Test, error", failed.getMessage()); } @Test @@ -245,14 +245,14 @@ public class OnapCommandErrorTest { OnapCommandResultInitialzationFailed failed = new OnapCommandResultInitialzationFailed("Test", new Exception("error")); - assertEquals("0x0022::Command Test result format is failed, error", failed.getMessage()); + assertEquals("0x0022::Failed to parse the result format of command Test, error", failed.getMessage()); } @Test public void onapCommandSchemaNotFoundTest() { OnapCommandSchemaNotFound failed = new OnapCommandSchemaNotFound("Test"); - assertEquals("0x0019::Command schema Test is not found, ", failed.getMessage()); + assertEquals("0x0019::Command schema is missing for command Test", failed.getMessage()); } @Test diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java index 47ee2c7a..adc088a5 100644 --- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java +++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java @@ -198,7 +198,7 @@ public class OnapCommandUtilsTest { try { OnapCommandUtils.loadSchema(cmd, "sample-test-schema.yaml"); } catch (OnapCommandInvalidSchema e) { - assertTrue(e.getMessage().contains("0x0007::Command schema sample-test-schema.yaml is invalid")); + assertEquals("0x0007", e.getErrorCode()); } } |