public DirectIsSetNullPolicyAttributeSetNonNullTestCases(String name) throws Exception { super(name); setControlDocument(XML_RESOURCE); setControlJSON(JSON_RESOURCE); AbstractNullPolicy aNullPolicy = new IsSetNullPolicy(); // Alter unmarshal policy state aNullPolicy.setNullRepresentedByEmptyNode(false); // no effect aNullPolicy.setNullRepresentedByXsiNil(false); // no effect // Alter marshal policy state aNullPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.ABSENT_NODE); ((IsSetNullPolicy) aNullPolicy).setIsSetMethodName("isSetFirstName"); Project aProject = new DirectNodeNullPolicyProject(false); XMLDirectMapping aMapping = (XMLDirectMapping) aProject .getDescriptor(Employee.class) // .getMappingForAttributeName("firstName"); aMapping.setNullPolicy(aNullPolicy); setProject(aProject); }
public DirectIsSetNodeNullPolicyTrueTestCases(String name) throws Exception { super(name); setControlDocument(XML_RESOURCE); AbstractNullPolicy aNullPolicy = new IsSetNullPolicy(); // alter unmarshal policy state aNullPolicy.setNullRepresentedByEmptyNode(true); // no effect aNullPolicy.setNullRepresentedByXsiNil(false); // no effect // alter marshal policy state aNullPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL); // .EMPTY_NODE); ((IsSetNullPolicy) aNullPolicy).setIsSetMethodName("isSetFirstName"); Project aProject = new DirectNodeNullPolicyProject(true); XMLDescriptor employeeDescriptor = (XMLDescriptor) aProject.getDescriptor(Employee.class); NamespaceResolver namespaceResolver = new NamespaceResolver(); namespaceResolver.put(XMLConstants.SCHEMA_INSTANCE_PREFIX, XMLConstants.SCHEMA_INSTANCE_URL); employeeDescriptor.setNamespaceResolver(namespaceResolver); XMLDirectMapping aMapping = (XMLDirectMapping) employeeDescriptor.getMappingForAttributeName("firstName"); aMapping.setNullPolicy(aNullPolicy); setProject(aProject); }