diff options
Diffstat (limited to 'utils/src/test/java')
-rw-r--r-- | utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java b/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java index 5fb92f8e..7da4eccd 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/properties/BeanConfiguratorTest.java @@ -951,18 +951,8 @@ public class BeanConfiguratorTest { @Test(expected = PropertyInvalidException.class) public void testCheckDefaultValue_Empty_EmptyOk_Invalid() throws PropertyException { - class Config { - - @Property(name = THE_VALUE, defaultValue = "", accept = "empty") - private long value; - - @SuppressWarnings("unused") - public void setValue(long value) { - this.value = value; - } - } - beancfg.configureFromProperties(new Config(), props); + beancfg.configureFromProperties(new PrimLongDefaultBlankAcceptEmptyConfig(), props); } @Test @@ -996,18 +986,8 @@ public class BeanConfiguratorTest { @Test(expected = PropertyMissingException.class) public void testIsEmptyOkPropertyString_False() throws PropertyException { - class Config { - @Property(name = THE_VALUE, defaultValue = "", accept = "") - private long value; - - @SuppressWarnings("unused") - public void setValue(long value) { - this.value = value; - } - } - - beancfg.configureFromProperties(new Config(), props); + beancfg.configureFromProperties(new PrimLongDefaultBlankAcceptBlankConfig(), props); } @Test @@ -1031,18 +1011,8 @@ public class BeanConfiguratorTest { @Test(expected = PropertyMissingException.class) public void testIsEmptyOkProperty_False() throws PropertyException { - class Config { - - @Property(name = THE_VALUE, defaultValue = "", accept = "") - private long value; - @SuppressWarnings("unused") - public void setValue(long value) { - this.value = value; - } - } - - beancfg.configureFromProperties(new Config(), props); + beancfg.configureFromProperties(new PrimLongDefaultBlankAcceptBlankConfig(), props); } @Test @@ -1411,6 +1381,26 @@ public class BeanConfiguratorTest { } } + class PrimLongDefaultBlankAcceptEmptyConfig { + + @Property(name = THE_VALUE, defaultValue = "", accept = "empty") + private long value; + + public void setValue(long value) { + this.value = value; + } + } + + class PrimLongDefaultBlankAcceptBlankConfig { + + @Property(name = THE_VALUE, defaultValue = "", accept = "") + private long value; + + public void setValue(long value) { + this.value = value; + } + } + /** * This is just used as a mix-in to ensure that the configuration ignores interfaces. */ |