diff options
Diffstat (limited to 'common-parameters/src/test/java/org')
13 files changed, 30 insertions, 23 deletions
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java index 6d0aae5e..ae4dbd2c 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java @@ -24,6 +24,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + import java.io.FileReader; import java.io.IOException; import java.nio.file.Files; @@ -32,8 +35,6 @@ import java.nio.file.Paths; import org.junit.Test; import org.onap.policy.common.parameters.testclasses.TestParametersL00; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; public class TestJsonInput { @@ -45,7 +46,8 @@ public class TestJsonInput { try { // Read the parameters from JSON using Gson final Gson gson = new GsonBuilder().create(); - testParameterGroup = gson.fromJson(new FileReader("src/test/resources/parameters/TestParameters.json"), TestParametersL00.class); + testParameterGroup = gson.fromJson(new FileReader("src/test/resources/parameters/TestParameters.json"), + TestParametersL00.class); } catch (final Exception e) { fail("test should not throw an exception here: " + e.getMessage()); } @@ -53,7 +55,7 @@ public class TestJsonInput { GroupValidationResult validationResult = testParameterGroup.validate(); assertTrue(validationResult.isValid()); assertEquals("l00NameFromFile", testParameterGroup.getName()); - + String expectedResult = new String(Files.readAllBytes( Paths.get("src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt"))) .replaceAll("\\s+", ""); 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 7d803525..e24f1c8e 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 @@ -42,7 +42,8 @@ public class TestYamlInput { 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); + 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()); } @@ -50,7 +51,7 @@ public class TestYamlInput { GroupValidationResult validationResult = testParameterGroup.validate(); assertTrue(validationResult.isValid()); assertEquals("l00NameFromFile", testParameterGroup.getName()); - + String expectedResult = new String(Files.readAllBytes( Paths.get("src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt"))) .replaceAll("\\s+", ""); diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java index f545ce65..681eb693 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java @@ -20,8 +20,8 @@ package org.onap.policy.common.parameters.testclasses; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class EmptyParameterGroup implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java index cdab1272..fcb2bb1b 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java @@ -20,8 +20,8 @@ package org.onap.policy.common.parameters.testclasses; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithArray implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java index 0f993099..75ae45b8 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java @@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses; import java.util.ArrayList; import java.util.List; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithCollection implements ParameterGroup { private String name; @@ -32,11 +32,12 @@ public class ParameterGroupWithCollection implements ParameterGroup { /** * Create a test parameter group. + * * @param name the parameter group name */ public ParameterGroupWithCollection(final String name) { this.name = name; - + intArrayList.add(1); intArrayList.add(2); intArrayList.add(3); @@ -45,12 +46,12 @@ public class ParameterGroupWithCollection implements ParameterGroup { public List<Integer> getIntArrayList() { return intArrayList; } - + @Override public String getName() { return name; } - + @Override public GroupValidationResult validate() { return new GroupValidationResult(this); diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java index 3de3270e..ca441060 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java @@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses; import java.util.LinkedHashMap; import java.util.Map; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithIllegalMapKey implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java index 8eb697a4..9253f158 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java @@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses; import java.util.LinkedHashMap; import java.util.Map; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithIllegalMapValue implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java index 37399da3..0d113dc6 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java @@ -22,8 +22,8 @@ package org.onap.policy.common.parameters.testclasses; import java.util.List; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithNullCollection implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java index 80f55355..9e1601c3 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java @@ -22,8 +22,8 @@ package org.onap.policy.common.parameters.testclasses; import java.util.Map; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithNullMapValue implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java index e7d1de75..5ece07b4 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java @@ -23,8 +23,8 @@ package org.onap.policy.common.parameters.testclasses; import java.util.ArrayList; import java.util.List; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ParameterGroup; public class ParameterGroupWithParameterGroupCollection implements ParameterGroup { private String name; diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java index 6b8460cd..6cd65603 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java @@ -24,9 +24,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterConstants; +import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ValidationStatus; public class TestParametersL00 implements ParameterGroup { @@ -38,9 +38,10 @@ public class TestParametersL00 implements ParameterGroup { private Map<String, TestParametersLGeneric> l00LGenericNestedMap = new LinkedHashMap<>(); /** - * Default constructor + * Default constructor. */ public TestParametersL00() { + // Default Cnstructor } /** diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java index 94a67ec7..6efddac0 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java @@ -24,9 +24,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterConstants; +import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ValidationStatus; public class TestParametersL10 implements ParameterGroup { @@ -38,9 +38,10 @@ public class TestParametersL10 implements ParameterGroup { private Map<String, TestParametersLGeneric> l10LGenericNestedMap = new LinkedHashMap<>(); /** - * Default constructor + * Default constructor. */ public TestParametersL10() { + // Default Constructor } /** diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java index ce368bac..2e678da0 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java @@ -20,9 +20,9 @@ package org.onap.policy.common.parameters.testclasses; -import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterConstants; +import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ValidationStatus; public class TestParametersLGeneric implements ParameterGroup { @@ -31,9 +31,10 @@ public class TestParametersLGeneric implements ParameterGroup { private String lgenericStringField = "Legal " + this.getClass().getCanonicalName(); /** - * Default constructor + * Default constructor. */ public TestParametersLGeneric() { + // Default Constructor } /** |