diff options
Diffstat (limited to 'src/test/java/org/onap/dcae/common/JsonDataLoader.java')
-rw-r--r-- | src/test/java/org/onap/dcae/common/JsonDataLoader.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/test/java/org/onap/dcae/common/JsonDataLoader.java b/src/test/java/org/onap/dcae/common/JsonDataLoader.java index 8c2fdd6d..fd06025a 100644 --- a/src/test/java/org/onap/dcae/common/JsonDataLoader.java +++ b/src/test/java/org/onap/dcae/common/JsonDataLoader.java @@ -2,7 +2,8 @@ * ============LICENSE_START======================================================= * VES Collector * ================================================================================ - * Copyright (C) 2020 Nokia. All rights reserved.s + * Copyright (C) 2020 Nokia. All rights reserved. + * Copyright (C) 2023 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +21,8 @@ package org.onap.dcae.common; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; @@ -27,7 +30,7 @@ import java.nio.file.Paths; /** * This class is static and does not have public constructor. - * It is responsible for data loading fot test cases. + * It is responsible for data loading for test cases. * * @author Zebek */ @@ -42,10 +45,11 @@ public final class JsonDataLoader { * @param path to file that will be loaded * @return contend of the file located under path, given in parameters, as string * @throws IOException when file under given path was not found + * @throws URISyntaxException */ - public static String loadContent(String path) throws IOException { - URL resource = JsonDataLoader.class.getResource(path); - Path resourcePath = Paths.get(resource.getPath()); + public static String loadContent(String path) throws IOException, URISyntaxException { + URI resource = JsonDataLoader.class.getResource(path).toURI(); + Path resourcePath = Paths.get(resource); return new String(Files.readAllBytes(resourcePath)); } } |