@Test public void shouldReturnDefaultNullValueWhenSpecified() throws Exception { final String testXmlString = "<types>" + " <type name=\"testTypeDefaultCharNullValue\" primitiveType=\"char\"/>" + "</types>"; final Map<String, Type> map = parseTestXmlWithMap("/types/type", testXmlString); Assert.assertNull(((EncodedDataType)map.get("testTypeDefaultCharNullValue")).nullValue()); }
@Test public void shouldReturnCorrectNullValueWhenSpecified() throws Exception { final String nullVal = "10"; final String testXmlString = "<types>" + " <type name=\"testTypeInt8NullValue\" primitiveType=\"int8\" presence=\"optional\" nullValue=\"" + nullVal + "\"/>" + "</types>"; final Map<String, Type> map = parseTestXmlWithMap("/types/type", testXmlString); assertThat((((EncodedDataType)map.get("testTypeInt8NullValue")).nullValue()), is(parse(nullVal, PrimitiveType.INT8))); }
@Test public void shouldHandleCompositeHasNullableType() throws Exception { final String nullValStr = "9223372036854775807"; final String testXmlString = "<types>" + "<composite name=\"PRICENULL\" description=\"Price NULL\" semanticType=\"Price\">" + " <type name=\"mantissa\" description=\"mantissa\" presence=\"optional\" nullValue=\"" + nullValStr + "\" primitiveType=\"int64\"/>" + " <type name=\"exponent\" description=\"exponent\" presence=\"constant\" primitiveType=\"int8\">" + "-7</type>" + "</composite>" + "</types>"; final Map<String, Type> map = parseTestXmlWithMap("/types/composite", testXmlString); final CompositeType c = (CompositeType)map.get("PRICENULL"); final EncodedDataType mantissa = (EncodedDataType)c.getType("mantissa"); assertThat(mantissa.nullValue(), is(PrimitiveValue.parse(nullValStr, PrimitiveType.INT64))); }
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;
.minValue(type.minValue()) .maxValue(type.maxValue()) .nullValue(type.nullValue()); break;