diff options
Diffstat (limited to 'validate/validation')
-rw-r--r-- | validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java b/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java index 181ae515..e94de60a 100644 --- a/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java +++ b/validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java @@ -17,6 +17,7 @@ package org.onap.cli.validation; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.io.File; @@ -48,6 +49,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + public class OnapValidationTest { public static final String SAMPLE_VERSION = "open_cli_sample_version"; @@ -64,6 +68,7 @@ public class OnapValidationTest { OnapCli cli = new OnapCli(); private static Logger LOG = LoggerFactory.getLogger(OnapValidationTest.class); + private static Gson gson = new GsonBuilder().serializeNulls().create(); private void handle(String[] args) { cli.resetExitCode(); @@ -261,4 +266,11 @@ public class OnapValidationTest { onapCli.handle(); assertEquals(OnapCliConstants.EXIT_SUCCESS, onapCli.getExitCode()); } + @Test + public void testOnapCommandSchemaInfoForUnknownFields(){ + OnapCommandSchemaInfo ocsi = new OnapCommandSchemaInfo(); + String testExp = "{\"schemaName\":\"testSchema\",\"schemaURI\":\"testUri\",\"unknownField\":\"unknown\"}"; + ocsi= gson.fromJson(testExp,OnapCommandSchemaInfo.class); + assertNotNull(ocsi); + } } |