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);
}
assertEquals("0xb002::Command schema is missing for command Test", failed.getMessage());
}
+ @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");
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));