@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
@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
@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
}
}
+ 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.
*/