[ https://issues.apache.org/jira/browse/POLYGENE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Niclas Hedhman closed POLYGENE-309.
-----------------------------------
Resolution: Fixed
Already resolved
> @Optional in ValueBuilder does not work if field not touched
> ------------------------------------------------------------
>
> Key: POLYGENE-309
> URL: https://issues.apache.org/jira/browse/POLYGENE-309
> Project: Polygene
> Issue Type: New Feature
> Reporter: Niclas Hedhman
> Priority: Major
>
> The code below will not fail, although it should. Instead it will output "title":null
> If the comments are removed, the exception will be thrown. This is not what is expected,
all non-Optional properties must be disallowed.
> {code:java}
> public class RegressionTest extends AbstractPolygeneTest
> {
> @Test(expected = ConstraintViolationException.class )
> public void givenNullValueWhenInstantiatingValueCompositeExpectException()
> {
> ValueBuilder<Value> builder = valueBuilderFactory.newValueBuilder( Value.class
);
> // Value prototype = builder.prototype();
> // prototype.title().set( null );
> System.out.println(builder.newInstance());
> }
> @Override
> public void assemble( ModuleAssembly module )
> throws AssemblyException
> {
> module.defaultServices();
> module.values( Value.class );
> }
> public interface Value
> {
> Property<String> title();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
|