X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fxml%2Fgenerator%2FTestAaiArtifactGenerator.java;h=fc2522f4024284df075dc892924f92830056f34e;hb=refs%2Fchanges%2F58%2F137458%2F1;hp=2668e1e8018bf32811f29056953f3fa120cfc862;hpb=550216df935437b1380b6d4425fd422ea7c013f5;p=aai%2Fbabel.git diff --git a/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java b/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java index 2668e1e..fc2522f 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/TestAaiArtifactGenerator.java @@ -23,13 +23,14 @@ package org.onap.aai.babel.xml.generator; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.aai.babel.csar.extractor.InvalidArchiveException; import org.onap.aai.babel.parser.ArtifactGeneratorToscaParser; import org.onap.aai.babel.testdata.CsarTest; @@ -50,7 +51,7 @@ public class TestAaiArtifactGenerator { private ArtifactTestUtils testUtils; - @Before + @BeforeEach public void setup() { testUtils = new ArtifactTestUtils(); testUtils.setGeneratorSystemProperties(); @@ -84,20 +85,21 @@ public class TestAaiArtifactGenerator { * @throws XmlArtifactGenerationException * if the configured widget mappings do not support processed widget type(s) */ - @Test(expected = IllegalArgumentException.class) + @Test public void testParserWithIncompleteMappings() throws SdcToscaParserException, IOException, XmlArtifactGenerationException { - testUtils.loadWidgetMappings(); - testUtils.loadWidgetToUuidMappings(); + assertThrows(IllegalArgumentException.class, () -> { + testUtils.loadWidgetMappings(); - AaiArtifactGenerator artifactGenerator = new AaiArtifactGenerator(); - WidgetType.clearElements(); // Remove all WidgetTypes so that the generator fails + AaiArtifactGenerator artifactGenerator = new AaiArtifactGenerator(); + WidgetType.clearElements(); // Remove all WidgetTypes so that the generator fails - ISdcCsarHelper csarHelper = SdcToscaParserFactory.getInstance() - .getSdcCsarHelper(TestAaiArtifactGenerator.class.getClassLoader() - .getResource(ArtifactTestUtils.CSAR_INPUTS_FOLDER + CsarTest.VNF_VENDOR_CSAR.getName()) - .getFile().toString()); - artifactGenerator.generateAllArtifacts("1.0", csarHelper); + ISdcCsarHelper csarHelper = SdcToscaParserFactory.getInstance() + .getSdcCsarHelper(TestAaiArtifactGenerator.class.getClassLoader() + .getResource(ArtifactTestUtils.CSAR_INPUTS_FOLDER + CsarTest.VNF_VENDOR_CSAR.getName()) + .getFile().toString()); + artifactGenerator.generateAllArtifacts("1.0", csarHelper); + }); } /**