use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method testQuantity.
@Test
public void testQuantity() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.QUANTITY_TYPE).put(JSONConstants.UOM, UOM);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweQuantity.class)));
SweQuantity swe = (SweQuantity) field.getElement();
errors.checkThat(swe.getUom(), is(UOM));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method testCountRange.
@Test
public void testCountRange() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.COUNT_RANGE_TYPE);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweCountRange.class)));
SweCountRange swe = (SweCountRange) field.getElement();
assertThat(swe.getValue(), is(nullValue()));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method timeWithValue.
@Test
public void timeWithValue() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_TYPE).put(JSONConstants.UOM, UOM).put(JSONConstants.VALUE, TIME_START);
SweField field = checkCommon(json, true);
assertThat(field.getElement(), is(instanceOf(SweTime.class)));
SweTime swe = (SweTime) field.getElement();
errors.checkThat(swe.getValue(), is(timeStart));
errors.checkThat(swe.getUom(), is(UOM));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method timeRangeWithValue.
@Test
public void timeRangeWithValue() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.TIME_RANGE_TYPE).put(JSONConstants.UOM, UOM);
json.putArray(JSONConstants.VALUE).add(TIME_START).add(TIME_END);
SweField field = checkCommon(json, true);
assertThat(field.getElement(), is(instanceOf(SweTimeRange.class)));
SweTimeRange swe = (SweTimeRange) field.getElement();
errors.checkThat(swe.getUom(), is(UOM));
errors.checkThat(swe.getValue(), is(notNullValue()));
errors.checkThat(swe.getValue().getRangeStart(), is(timeStart));
errors.checkThat(swe.getValue().getRangeEnd(), is(timeEnd));
}
use of org.n52.shetland.ogc.swe.SweField in project arctic-sea by 52North.
the class FieldDecoderTest method testCount.
@Test
public void testCount() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.COUNT_TYPE);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweCount.class)));
}
Aggregations