diff options
author | Jim Hahn <jrh3@att.com> | 2019-06-12 14:32:25 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-06-12 17:36:59 -0400 |
commit | ea262e6da52fd4da0733f02998f87aebaf502ddb (patch) | |
tree | a7cded567521f0141f31d9f8c185eccdaf2a8979 /common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java | |
parent | e671e9fa5d09ec696cb24aeefaf10ddbc7c705d7 (diff) |
Apply simple sonar fixes
Note: A number of these were identified, by SonarLint, in the Test
classes, which are not typically scanned by Sonar.
Removed unnecessary imports.
Removed unneeded "throws Xxx".
Replaced lambda with method references.
Replaced duplicate strings with constants.
Replaced try-fail-catch with assert-j methods to eliminate sonar
complaints about duplicate failure messages.
Added missing @Override annotations.
Use map.computeIfAbsent() where appropriate.
Also fixed some minor checkstyle issues.
Removed unneeded "volatile" declarations.
Replaced some if-else constructs with "?:" construct, per sonar.
Replaced Object.wait() with CountDownLatch.await(); according to sonar
(and javadocs), Object.wait() can return due to "spurious wakeups".
Fixed issue whereby CryptoUtilsTest wouldn't run in my Eclipse.
Change-Id: Ib6b71ed65662cfd6209400dac57ed69279bf29ec
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java')
-rw-r--r-- | common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java index e24f1c8e..66656844 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 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. @@ -22,13 +23,11 @@ package org.onap.policy.common.parameters; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.io.FileReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; - import org.junit.Test; import org.onap.policy.common.parameters.testclasses.TestParametersL00; import org.yaml.snakeyaml.Yaml; @@ -38,15 +37,10 @@ public class TestYamlInput { public void testYamlInput() throws IOException { TestParametersL00 testParameterGroup = null; - // Read the parameters - try { - // Read the parameters from JSON using Gson - final Yaml yaml = new Yaml(); - testParameterGroup = yaml.loadAs(new FileReader("src/test/resources/parameters/TestParameters.yaml"), - TestParametersL00.class); - } catch (final Exception e) { - fail("test should not throw an exception here: " + e.getMessage()); - } + // Read the parameters from JSON using Gson + final Yaml yaml = new Yaml(); + testParameterGroup = yaml.loadAs(new FileReader("src/test/resources/parameters/TestParameters.yaml"), + TestParametersL00.class); GroupValidationResult validationResult = testParameterGroup.validate(); assertTrue(validationResult.isValid()); |