X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Futil%2FArtifactTestUtils.java;h=a98b7c2a5eecb70eb28814d08cfce0f62109209f;hb=60457e41054465e9fa10c8e6bfdbfa62a45d1f0a;hp=066911ec6daae553ffb858ca416d057733dfa0b7;hpb=5f1b6e4eb654639de6aaae9b7d862eb01b991f55;p=aai%2Fbabel.git diff --git a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java index 066911e..a98b7c2 100644 --- a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java +++ b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java @@ -65,7 +65,7 @@ public class ArtifactTestUtils { /** * Load the Widget type mappings (resource). - * + * * @throws IOException * if the configuration file is not loaded */ @@ -127,7 +127,11 @@ public class ArtifactTestUtils { } public String loadResourceAsString(String resourceName) throws IOException { + try { return IOUtils.toString(getResource(resourceName), Charset.defaultCharset()); + } catch (NullPointerException e) { + throw new IllegalArgumentException("No such resource " + resourceName); + } } public String getRequestJson(String resource) throws IOException { @@ -144,7 +148,7 @@ public class ArtifactTestUtils { /** * Create Properties from the content of the named resource (e.g. a file on the classpath). - * + * * @param resourceName * the resource name * @return Properties loaded from the named resource