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=176c445bbeb5e47011ff2ca4816c00dd0f6ea779;hp=b29d0d7d946db465399b182f1c1e84f851b2de18;hpb=811169825805a7160a6dd28abb281f64a4a56c71;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 b29d0d7..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,19 +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(); + 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); + }); } /**