Update model-loader to spring-boot 2.4
[aai/model-loader.git] / src / test / java / org / onap / aai / modelloader / util / ArtifactTestUtils.java
index 752f389..e5db2a5 100644 (file)
@@ -22,6 +22,8 @@ package org.onap.aai.modelloader.util;
 
 import java.io.IOException;
 import java.net.URL;
+import java.nio.charset.Charset;
+
 import org.apache.commons.io.IOUtils;
 import org.onap.aai.babel.service.data.BabelArtifact;
 
@@ -34,6 +36,15 @@ public class ArtifactTestUtils {
                 ArtifactTestUtils.loadResourceAsString(resource));
     }
 
+    /**
+     * Finds the resource with the given name and returns it as an array of bytes.
+     *
+     * @param resourceName
+     *        the /-separated path to the resource
+     * @return the requested resource contents as a byte array
+     * @throws IOException
+     *         if the resource could not be found (using current privileges)
+     */
     public byte[] loadResource(String resourceName) throws IOException {
         URL resource = getResource(resourceName);
         if (resource != null) {
@@ -44,7 +55,7 @@ public class ArtifactTestUtils {
     }
 
     public static String loadResourceAsString(String resourceName) throws IOException {
-        return IOUtils.toString(getResource(resourceName));
+        return IOUtils.toString(getResource(resourceName), Charset.defaultCharset());
     }
 
     private static URL getResource(String resourceName) {