Additional VNF Configuration test scenarios
[aai/babel.git] / src / test / java / org / onap / aai / babel / csar / vnfcatalog / VnfVendorImageExtractorTest.java
index de5ea3f..49784c1 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.babel.csar.vnfcatalog;
 
 import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
@@ -56,6 +58,18 @@ public class VnfVendorImageExtractorTest {
         extractArtifact("Duff.txt");
     }
 
+    @Test
+    public void createVendorImageMappingsMoreThanOneVnfConfigurationExists() throws IOException {
+        try {
+            extractArtifact("catalog_csar_too_many_vnfConfigurations.csar");
+        } catch (Exception e) {
+            assertThat(e, is(instanceOf(ToscaToCatalogException.class)));
+            assertThat(e.getLocalizedMessage(),
+                    is(equalTo("An error occurred trying to get the vnf catalog from a csar file. "
+                            + "2 vnfConfigurations were found in the csar file and only one is allowed.")));
+        }
+    }
+
     @Test
     public void createVendorImageMappingsNoVnfConfigurationExists() throws IOException, ToscaToCatalogException {
         assertThat(extractArtifact("noVnfConfiguration.csar"), is(nullValue()));