aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/test/java/org
diff options
context:
space:
mode:
authorGanesh <ganesh.c@samsung.com>2022-07-01 18:43:23 +0530
committerGanesh <ganesh.c@samsung.com>2022-07-01 18:43:46 +0530
commitd4482ed550d32c237ba92410d72aa85ad3338b9f (patch)
tree23ff0efe6b09b570a364c10848306338b611d321 /framework/src/test/java/org
parentaaaf2801945c81f8822f748a3bcefc21e24d3aaf (diff)
ValidateSchemaTest sonar issue, Replace these 3 tests with a single Parameterized one
Signed-off-by: Ganesh <ganesh.c@samsung.com> Change-Id: I7f65fcecea7ac6ba574f2cb9bd128a200fbae4e1 Issue-ID: CLI-444
Diffstat (limited to 'framework/src/test/java/org')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java29
1 files changed, 7 insertions, 22 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
index 00c311fc..5c83342a 100644
--- a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
@@ -35,15 +35,18 @@ public class ValidateSchemaTest {
@Test(expected = OnapCommandInvalidSchema.class)
public void invalidateTest1() throws OnapCommandException {
-
OnapCommand cmd = new OnapCommand() {
@Override
protected void run() throws OnapCommandException {}
};
- OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds.yaml", true, true);
+ try {
+ OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds", true, true);
+ } catch(Exception e) {
+ assertEquals(e.getClass(), OnapCommandInvalidSchema.class);
+ }
+ OnapCommandSchemaLoader.loadSchema(cmd, "schema-invalid-file.yaml", true, true);
}
-
@Test
public void validateTestMerge() throws OnapCommandException {
@@ -60,22 +63,13 @@ public class ValidateSchemaTest {
@Override
protected void run() throws OnapCommandException {}
};
- OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds", true, true);
- }
-
- @Test(expected = OnapCommandInvalidSchema.class)
- public void invalidateTest4() throws OnapCommandException {
- OnapCommand cmd = new OnapCommand() {
- @Override
- protected void run() throws OnapCommandException {}
- };
OnapCommandSchemaLoader.loadSchema(cmd,
ValidateSchemaTest.class.getClassLoader().getResource("open-cli.properties").getFile(),
true, true);
}
@Test(expected = OnapCommandInvalidSchema.class)
- public void invalidateTest5() throws OnapCommandException {
+ public void invalidateTest3() throws OnapCommandException {
OnapCommand cmd = new OnapCommand() {
@Override
protected void run() throws OnapCommandException {}
@@ -95,15 +89,6 @@ public class ValidateSchemaTest {
assertTrue(list.isEmpty());
}
- @Test(expected = OnapCommandInvalidSchema.class)
- public void invalidateTest3() throws OnapCommandException {
- OnapCommand cmd = new OnapCommand() {
- @Override
- protected void run() throws OnapCommandException {}
- };
- OnapCommandSchemaLoader.loadSchema(cmd, "schema-invalid-file.yaml", true, true);
- }
-
@Test
public void validateTest() throws OnapCommandException {