Search in sources :

Example 1 with Text

use of net.opengis.swe.x101.TextDocument.Text in project arctic-sea by 52North.

the class SweCommonDecoderV101Test method should_decode_Count_with_Quality_Text.

@Test
public void should_decode_Count_with_Quality_Text() throws DecodingException {
    final CountDocument xbCount = CountDocument.Factory.newInstance();
    final String textValue = "quality-text";
    xbCount.addNewCount().addNewQuality().addNewText().setValue(textValue);
    final Object decodedObject = new SweCommonDecoderV101().decode(xbCount);
    assertThat(decodedObject, is(instanceOf(SweCount.class)));
    final SweCount sweCount = (SweCount) decodedObject;
    assertThat(sweCount.isSetQuality(), is(true));
    assertThat(sweCount.getQuality().size(), is(1));
    assertThat(sweCount.getQuality().iterator().next(), is(instanceOf(SweText.class)));
    assertThat(((SweText) sweCount.getQuality().iterator().next()).getValue(), is(textValue));
}
Also used : CountDocument(net.opengis.swe.x101.CountDocument) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) Test(org.junit.Test)

Example 2 with Text

use of net.opengis.swe.x101.TextDocument.Text in project arctic-sea by 52North.

the class SweCommonEncoderv101Test method should_encode_count_with_quality_text.

@Test
public void should_encode_count_with_quality_text() throws EncodingException {
    final String qualityTextValue = "quality-text-value";
    final SweCount sosCount = (SweCount) new SweCount().setQuality(Lists.newArrayList((SweQuality) new SweText().setValue(qualityTextValue)));
    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).isSetText(), is(true));
    assertThat(xbCount.getQualityArray(0).getText().getValue(), is(qualityTextValue));
}
Also used : SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) XmlObject(org.apache.xmlbeans.XmlObject) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) Count(net.opengis.swe.x101.CountDocument.Count) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)2 CountDocument (net.opengis.swe.x101.CountDocument)1 Count (net.opengis.swe.x101.CountDocument.Count)1 XmlObject (org.apache.xmlbeans.XmlObject)1 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)1