From cf282dd15ce391eed832063aea956a8d55521278 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 7 Sep 2018 13:36:41 +0100 Subject: Remove changing of access on par fields Parameter handling refactored to remove changing of access on fields in parameters, new implementation requires getters to be defined for all fields. Note: This change causes a knock on into distribution Change-Id: I172f5d9310caf92d6ea825ff93292019c00a47c3 Issue-ID: POLICY-1095 Signed-off-by: liamfallon --- .../common/parameters/TestValidationErrors.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java') diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java index a489cc3f..2c1e2f18 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java @@ -26,6 +26,8 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.junit.Test; +import org.onap.policy.common.parameters.testclasses.ParameterGroupMissingGetter; +import org.onap.policy.common.parameters.testclasses.ParameterGroupPrivateGetter; import org.onap.policy.common.parameters.testclasses.ParameterGroupWithArray; import org.onap.policy.common.parameters.testclasses.ParameterGroupWithCollection; import org.onap.policy.common.parameters.testclasses.ParameterGroupWithIllegalMapKey; @@ -112,4 +114,28 @@ public class TestValidationErrors { + "map \"intMap\" is not a parameter group", e.getMessage()); } } + + @Test + public void testMissingGetter() { + ParameterGroupMissingGetter badGetterName = new ParameterGroupMissingGetter("BGN"); + try { + badGetterName.isValid(); + fail("test should throw an exception"); + } catch (ParameterRuntimeException e) { + assertEquals("could not get getter method for parameter \"value\"", e.getMessage()); + } + + } + + @Test + public void testPrivateGetter() { + ParameterGroupPrivateGetter privateGetter = new ParameterGroupPrivateGetter("privateGetter"); + try { + privateGetter.isValid(); + fail("test should throw an exception"); + } catch (ParameterRuntimeException e) { + assertEquals("could not get getter method for parameter \"value\"", e.getMessage()); + } + + } } -- cgit 1.2.3-korg