diff options
author | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-02-19 19:09:00 +0000 |
---|---|---|
committer | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-02-19 19:09:00 +0000 |
commit | be30876e3a3872a7274c944995544836ff31913c (patch) | |
tree | 8901f10cf66eee34d9ca72adcd8c201051c3df5d /src/test | |
parent | fc779f51a624bfddc68328bf3fd3c74594ef31f6 (diff) |
Fix outstanding Sonar issues
Change-Id: I9699ee13321f136b4460d5c85d49ab13378f52b4
Issue-ID: AAI-2121
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test')
3 files changed, 41 insertions, 25 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 abe6f4d..5bb7763 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 @@ -132,10 +132,14 @@ public class YamlExtractorTest { /** * Call the extractor with the specified arguments and assert that an exception is thrown. * - * @param archive the compressed archive in the form of a byte array, expected to contain one or more YAML files - * @param name the name of the archive - * @param version the version of the archive - * @param expectedErrorMessage the text of the InvalidArchiveException thrown by the extractor + * @param archive + * the compressed archive in the form of a byte array, expected to contain one or more YAML files + * @param name + * the name of the archive + * @param version + * the version of the archive + * @param expectedErrorMessage + * the text of the InvalidArchiveException thrown by the extractor */ private void invalidArgumentsTest(byte[] archive, String name, String version, String expectedErrorMessage) { try { diff --git a/src/test/java/org/onap/aai/babel/logging/TestApplicationLogger.java b/src/test/java/org/onap/aai/babel/logging/TestApplicationLogger.java index 2719315..02df4e8 100644 --- a/src/test/java/org/onap/aai/babel/logging/TestApplicationLogger.java +++ b/src/test/java/org/onap/aai/babel/logging/TestApplicationLogger.java @@ -55,14 +55,15 @@ public class TestApplicationLogger { * Check that each message can be logged and that (by implication of successful logging) there is a corresponding * resource (message format). * - * @throws IOException if the log files cannot be read + * @throws IOException + * if the log files cannot be read */ @Test public void logAllMessages() throws IOException { Logger logger = LogHelper.INSTANCE; LogReader errorReader = new LogReader(LogHelper.getLogDirectory(), "error"); LogReader debugReader = new LogReader(LogHelper.getLogDirectory(), "debug"); - String[] args = { "1", "2", "3", "4" }; + String[] args = {"1", "2", "3", "4"}; for (ApplicationMsgs msg : Arrays.asList(ApplicationMsgs.values())) { if (msg.name().endsWith("ERROR")) { logger.error(msg, args); @@ -90,7 +91,8 @@ public class TestApplicationLogger { * Check that each message can be logged and that (by implication of successful logging) there is a corresponding * resource (message format). * - * @throws IOException if the log file cannot be read + * @throws IOException + * if the log file cannot be read */ @Test public void logDebugMessages() throws IOException { @@ -103,7 +105,8 @@ public class TestApplicationLogger { /** * Check logAudit with HTTP headers. * - * @throws IOException if the log file cannot be read + * @throws IOException + * if the log file cannot be read */ @Test public void logAuditMessage() throws IOException { @@ -135,7 +138,8 @@ public class TestApplicationLogger { /** * Check logAudit with no HTTP headers. * - * @throws IOException if the log file cannot be read + * @throws IOException + * if the log file cannot be read */ @Test public void logAuditMessageWithoutHeaders() throws IOException { @@ -152,7 +156,8 @@ public class TestApplicationLogger { /** * Check logMetrics. * - * @throws IOException if the log file cannot be read + * @throws IOException + * if the log file cannot be read */ @Test public void logMetricsMessage() throws IOException { @@ -207,13 +212,15 @@ public class TestApplicationLogger { /** * Call a logger method which is expected to throw an UnsupportedOperationException. * - * @param logMethod the logger method to invoke - * @param dummyMsg any Application Message enumeration value + * @param logMethod + * the logger method to invoke + * @param dummyMsg + * any Application Message enumeration value */ private void callUnsupportedOperationMethod(TriConsumer<Enum<?>, LogFields, String[]> logMethod, ApplicationMsgs dummyMsg) { try { - logMethod.accept(dummyMsg, new LogFields(), new String[] { "" }); + logMethod.accept(dummyMsg, new LogFields(), new String[] {""}); org.junit.Assert.fail("method should have thrown execption"); // NOSONAR as code not reached } catch (UnsupportedOperationException e) { // Expected to reach here @@ -223,10 +230,14 @@ public class TestApplicationLogger { /** * Assert that a log message was logged to the expected log file at the expected severity. * - * @param msg the Application Message enumeration value - * @param reader the log reader for the message - * @param severity log level - * @throws IOException if the log file cannot be read + * @param msg + * the Application Message enumeration value + * @param reader + * the log reader for the message + * @param severity + * log level + * @throws IOException + * if the log file cannot be read */ private void validateLoggedMessage(ApplicationMsgs msg, LogReader reader, String severity) throws IOException { String str = reader.getNewLines(); diff --git a/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java b/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java index 8d1a045..92b548a 100644 --- a/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java +++ b/src/test/java/org/onap/aai/babel/xml/generator/model/TestModel.java @@ -58,7 +58,7 @@ public class TestModel { * from the Artifact Generator properties. * * @throws IOException - * if the Artifact Generator properties file is not loaded + * if the Artifact Generator properties file is not loaded */ @Before public void setup() throws IOException { @@ -68,9 +68,10 @@ public class TestModel { String configLocation = System.getProperty(ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE); if (configLocation == null) { throw new IllegalArgumentException( - String.format(ArtifactGeneratorToscaParser.GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND, ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE)); + String.format(ArtifactGeneratorToscaParser.GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND, + ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE)); } - + ArtifactGeneratorToscaParser.initToscaMappingsConfiguration(configLocation); utils.loadWidgetToUuidMappings(); @@ -129,9 +130,9 @@ public class TestModel { * Assert that the TOSCA type String is mapped to the expected Widget Type. * * @param toscaType - * the TOSCA type or prefix + * the TOSCA type or prefix * @param widgetType - * the type of Widget expected from the mappings + * the type of Widget expected from the mappings */ private void assertMapping(String toscaType, Type widgetType) { assertThat(Model.getModelFor(toscaType).getWidgetType(), is(widgetType)); @@ -141,11 +142,11 @@ public class TestModel { * Assert that the TOSCA metadata type is mapped to the expected Widget Type. * * @param toscaType - * the name (or name prefix) of the TOSCA type + * the name (or name prefix) of the TOSCA type * @param metadataType - * the type specified in the TOSCA metadata + * the type specified in the TOSCA metadata * @param widgetType - * the type of Widget expected from the mappings + * the type of Widget expected from the mappings */ private void assertMapping(String toscaType, String metadataType, Type widgetType) { assertThat(Model.getModelFor(toscaType, metadataType).getWidgetType(), is(widgetType)); |