use of org.n52.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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));
}
use of org.n52.svalbard.decode.exception.DecodingException 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.svalbard.decode.exception.DecodingException 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()));
}
Aggregations