use of org.n52.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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)));
}
use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class FieldDecoderTest method testBoolean.
@Test
public void testBoolean() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.BOOLEAN_TYPE);
SweField field = checkCommon(json, false);
assertThat(field.getElement(), is(instanceOf(SweBoolean.class)));
}
use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.
the class FieldDecoderTest method testQuantityRangeWithValue.
@Test
public void testQuantityRangeWithValue() throws DecodingException {
ObjectNode json = createField().put(JSONConstants.TYPE, JSONConstants.QUANTITY_RANGE_TYPE).put(JSONConstants.UOM, UOM);
json.putArray(JSONConstants.VALUE).add(QUANTITY_VALUE_START).add(QUANTITY_VALUE_END);
SweField field = checkCommon(json, true);
assertThat(field.getElement(), is(instanceOf(SweQuantityRange.class)));
SweQuantityRange swe = (SweQuantityRange) field.getElement();
errors.checkThat(swe.getUom(), is(UOM));
errors.checkThat(swe.getValue(), is(notNullValue()));
errors.checkThat(swe.getValue().getRangeStart().doubleValue(), is(QUANTITY_VALUE_START));
errors.checkThat(swe.getValue().getRangeEnd().doubleValue(), is(QUANTITY_VALUE_END));
}
Aggregations