X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fbabel.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fxml%2Fgenerator%2Fmodel%2FTestModel.java;h=f1a579e3ea5443dab76423b16bbe68bde002a7c3;hp=ed4f5c15642a74ff076e655eda735f88da338d3c;hb=f6107af893b29094f84fb2eea2b9dd8acc78dc53;hpb=d2215b5d8b6c8976a9540a9e4706c7bebca80aa2 diff --git a/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java b/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java index ed4f5c1..f1a579e 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java @@ -73,9 +73,35 @@ public class TestModel { assertMapping("org.openecomp.resource.vfc", "an.unknown.type", WidgetType.valueOf("VSERVER")); } + /** + * Test that there is no exception if processing a Model that has no metadata properties. + */ + @Test + public void testNullIdentProperties() { + createTestModel().populateModelIdentificationInformation(null); + } + + /** + * Test that an exception occurs if calling code passes an unsupported Widget Type value to the base implementation + * of the hasWidgetType() method. + */ + @Test(expected = IllegalArgumentException.class) + public void testUnknownWidgetType() { + createTestModel().hasWidgetType(null); + } + + /** + * Create any Model with a valid WidgetType, for method testing. + * + * @return a valid Model for testing purposes + */ + private Model createTestModel() { + return new Resource(WidgetType.valueOf("VSERVER"), false); + } + /** * Assert that the TOSCA type String is mapped to the expected Widget Type. - * + * * @param toscaType * the TOSCA type or prefix * @param widgetType @@ -87,7 +113,7 @@ public class TestModel { /** * Assert that the TOSCA metadata type is mapped to the expected Widget Type. - * + * * @param toscaType * the name (or name prefix) of the TOSCA type * @param metadataType