diff options
author | Bogumil Zebek <bogumil.zebek@nokia.com> | 2018-06-22 12:28:07 +0200 |
---|---|---|
committer | Bogumil Zebek <bogumil.zebek@nokia.com> | 2018-06-22 12:28:07 +0200 |
commit | cdfc83e750b72b6ab79a50a5bbbc31456c103673 (patch) | |
tree | 6701e5105ce5290b1213e490a35399d91dd5a724 /aai-utils/src/test/java/org | |
parent | 75370173d19e97967d34b3c117f1e3c0820c2553 (diff) |
Add missing tests
Change-Id: I27b9210430c877d7d2bd0d3440ed12f702282fe1
Issue-ID: AAI-1235
Signed-off-by: Bogumil Zebek <bogumil.zebek@nokia.com>
Diffstat (limited to 'aai-utils/src/test/java/org')
-rw-r--r-- | aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java index deb9b6ed..22a1673d 100644 --- a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java +++ b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java @@ -19,14 +19,33 @@ */ package org.onap.aaiutils.oxm; +import java.util.regex.Pattern; +import org.junit.Assert; +import org.junit.Rule; import org.junit.Test; - -import static org.junit.Assert.*; +import org.junit.rules.ExpectedException; public class OxmModelLoaderTest { + + @Rule + public ExpectedException thrown = ExpectedException.none(); + @Test - public void loadModels() throws Exception { - OxmModelLoader.loadModels(); - assertTrue( OxmModelLoader.getVersionContextMap().size() > 0); + public void shouldLoadOxmModelsWhichMatchToPattern() throws Exception { + OxmModelLoader.loadModels("classpath*:test_aai_oxm*.xml", Pattern.compile("test_aai_oxm_(.*).xml")); + + Assert.assertTrue(OxmModelLoader.getVersionContextMap().size() == 2); + Assert.assertFalse(OxmModelLoader.getVersionContextMap().containsKey("v7")); + Assert.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v8")); + Assert.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v9")); } + + @Test + public void shouldReportAnErrorWhenOxmModelsAreNotAvailable() throws Exception { + thrown.expect(Exception.class); + thrown.expectMessage("Failed to load schema"); + + OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml", Pattern.compile("non_existing_aai_oxm_(.*).xml")); + } + }
\ No newline at end of file |