use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method testBooleanWithValueTrue.
@Test
public void testBooleanWithValueTrue() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE).put(JSONConstants.VALUE, true);
SweField field = checkCommon(json, true);
assertThat(field.getElement(), is(instanceOf(SweBoolean.class)));
SweBoolean swe = (SweBoolean) field.getElement();
errors.checkThat(swe.getValue(), is(true));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method timeRange.
@Test
public void timeRange() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_RANGE_TYPE).put(JSONConstants.UOM, UOM);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweTimeRange.class)));
SweTimeRange swe = (SweTimeRange) field.getElement();
errors.checkThat(swe.getUom(), is(UOM));
errors.checkThat(swe.getValue(), is(nullValue()));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method testCountRangeWithValue.
@Test
public void testCountRangeWithValue() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.COUNT_RANGE_TYPE);
json.putArray(JSONConstants.VALUE).add(COUNT_VALUE_START).add(COUNT_VALUE_END);
SweField field = checkCommon(json, true);
assertThat(field.getElement(), is(instanceOf(SweCountRange.class)));
SweCountRange swe = (SweCountRange) field.getElement();
assertThat(swe.getValue(), is(notNullValue()));
errors.checkThat(swe.getValue().getRangeStart(), is(COUNT_VALUE_START));
errors.checkThat(swe.getValue().getRangeEnd(), is(COUNT_VALUE_END));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method testCategory.
@Test
public void testCategory() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.CATEGORY_TYPE).put(JSONConstants.CODESPACE, CODESPACE);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweCategory.class)));
SweCategory swe = (SweCategory) field.getElement();
errors.checkThat(swe.getValue(), is(nullValue()));
errors.checkThat(swe.getCodeSpace(), is(CODESPACE));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method time.
@Test
public void time() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_TYPE).put(JSONConstants.UOM, UOM);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweTime.class)));
SweTime swe = (SweTime) field.getElement();
errors.checkThat(swe.getValue(), is(nullValue()));
errors.checkThat(swe.getUom(), is(UOM));
}
Aggregations