diff options
Diffstat (limited to 'src/test')
3 files changed, 11 insertions, 8 deletions
diff --git a/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java b/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java index 5bb7763..20c3434 100644 --- a/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java +++ b/src/test/java/org/onap/aai/babel/csar/extractor/YamlExtractorTest.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,7 +91,7 @@ public class YamlExtractorTest { @Test public void testInvalidContentSupplied() { invalidArgumentsTest("This is a piece of nonsense and not a zip file".getBytes(), FOO, FOO, - "An error occurred trying to create a ZipFile. Is the content being converted really a csar file?"); + "An error occurred trying to create a ZipFile. Is the content being converted really a CSAR file?"); } @Test @@ -102,7 +102,7 @@ public class YamlExtractorTest { } catch (Exception e) { assertTrue("An instance of InvalidArchiveException should have been thrown.", e instanceof InvalidArchiveException); - assertEquals("Incorrect message was returned", "No valid YAML files were found in the csar file.", + assertEquals("Incorrect message was returned", "No valid YAML files were found in the CSAR file.", e.getMessage()); } } diff --git a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java index 0673d04..55311a6 100644 --- a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java +++ b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java @@ -152,8 +152,7 @@ public class TestGenerateArtifactsServiceImpl { * if the resource cannot be loaded */ private Response processJsonRequest(CsarTest csar) throws IOException, URISyntaxException { - String jsonString = csar.getJsonRequest(); - return invokeService(jsonString); + return invokeService(csar.getJsonRequest()); } /** 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 |