use of net.opengis.swe.x101.UomPropertyType in project arctic-sea by 52North.
the class SweCommonDecoderV101Test method should_decode_QuantityRange.
@Test
public void should_decode_QuantityRange() throws DecodingException {
final QuantityRangeDocument xbQuantityRange = QuantityRangeDocument.Factory.newInstance();
final ArrayList<BigDecimal> values = Lists.newArrayList(BigDecimal.valueOf(1.0), BigDecimal.valueOf(2.0));
final QuantityRange xbQuantityRangeType = xbQuantityRange.addNewQuantityRange();
xbQuantityRangeType.setValue(values);
final String definition = "definition";
xbQuantityRangeType.setDefinition(definition);
final String axisId = "axis-id";
xbQuantityRangeType.setAxisID(axisId);
final String description = "description";
xbQuantityRangeType.addNewDescription().setStringValue(description);
final UomPropertyType xbUom = xbQuantityRangeType.addNewUom();
final String uomCode = "uom-code";
xbUom.setCode(uomCode);
final Object decodedObject = new SweCommonDecoderV101().decode(xbQuantityRange);
assertThat(decodedObject, is(instanceOf(SweQuantityRange.class)));
final SweQuantityRange sweQuantityRange = (SweQuantityRange) decodedObject;
assertThat(sweQuantityRange.isSetDefinition(), is(true));
assertThat(sweQuantityRange.getDefinition(), is(definition));
assertThat(sweQuantityRange.isSetUom(), is(true));
assertThat(sweQuantityRange.getUom(), is(uomCode));
assertThat(sweQuantityRange.isSetAxisID(), is(true));
assertThat(sweQuantityRange.getAxisID(), is(axisId));
assertThat(sweQuantityRange.isSetDescription(), is(true));
assertThat(sweQuantityRange.getDescription(), is(description));
assertThat(sweQuantityRange.isSetValue(), is(true));
assertThat(sweQuantityRange.getValue().getRangeStart(), is(values.get(0)));
assertThat(sweQuantityRange.getValue().getRangeEnd(), is(values.get(1)));
}
Aggregations