use of net.opengis.swe.x101.CategoryDocument.Category in project arctic-sea by 52North.
the class SweCommonDecoderV101Test method should_decode_Quantity_with_Quality_Category.
@Test
public void should_decode_Quantity_with_Quality_Category() throws DecodingException {
final QuantityDocument xbQuantity = QuantityDocument.Factory.newInstance();
final String categoryValue = "quality-category";
xbQuantity.addNewQuantity().addNewQuality().addNewCategory().setValue(categoryValue);
final Object decodedObject = new SweCommonDecoderV101().decode(xbQuantity);
assertThat(decodedObject, is(instanceOf(SweQuantity.class)));
final SweQuantity sweQuantity = (SweQuantity) decodedObject;
assertThat(sweQuantity.isSetQuality(), is(true));
assertThat(sweQuantity.getQuality().size(), is(1));
assertThat(sweQuantity.getQuality().iterator().next(), is(instanceOf(SweCategory.class)));
assertThat(((SweCategory) sweQuantity.getQuality().iterator().next()).getValue(), is(categoryValue));
}
use of net.opengis.swe.x101.CategoryDocument.Category in project arctic-sea by 52North.
the class SweCommonEncoderv101Test method should_encode_count_with_quality_Category.
@Test
public void should_encode_count_with_quality_Category() throws EncodingException {
final String qualityCategoryValue = "quality-category-value";
final SweCount sosCount = (SweCount) new SweCount().setQuality(Lists.newArrayList((SweQuality) new SweCategory().setValue(qualityCategoryValue)));
final XmlObject encode = sweCommonEncoderv101.encode(sosCount);
assertThat(encode, instanceOf(Count.class));
final Count xbCount = (Count) encode;
assertThat(xbCount.getQualityArray(), is(not(nullValue())));
assertThat(xbCount.getQualityArray().length, is(1));
assertThat(xbCount.getQualityArray(0).isSetCategory(), is(true));
assertThat(xbCount.getQualityArray(0).getCategory().getValue(), is(qualityCategoryValue));
}
Aggregations