use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.
the class MeasurementDecodingTest method testValue.
@Test
public void testValue() {
assertThat(observation, is(notNullValue()));
final ObservationValue<?> ov = observation.getValue();
assertThat(ov, is(notNullValue()));
assertThat(ov.getValue(), is(instanceOf(QuantityValue.class)));
QuantityValue qv = (QuantityValue) ov.getValue();
assertThat(qv.getUnit(), is(equalTo("testunit1")));
assertThat(qv.getValue(), is(equalTo(new BigDecimal("123123"))));
}
use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.
the class MeasurementDecodingTest method testPhenomenonTime.
@Test
public void testPhenomenonTime() {
assertThat(observation, is(notNullValue()));
final ObservationValue<?> ov = observation.getValue();
assertThat(ov, is(notNullValue()));
final Time pt = ov.getPhenomenonTime();
assertThat(pt, is(notNullValue()));
assertThat(pt, is(instanceOf(TimeInstant.class)));
TimeInstant ti = (TimeInstant) pt;
assertThat(ti.getValue(), is(equalTo(phenomenonTime)));
}
use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.
the class TextObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_TEXT_OBSERVATION)));
final ObservationValue<?> value = observation.getValue();
assertThat(value, is(instanceOf(SingleObservationValue.class)));
assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
assertThat(value.getValue(), is(instanceOf(TextValue.class)));
TextValue v = (TextValue) value.getValue();
assertThat(v.getValue(), is(equalTo("Some Value")));
assertThat(v.getUnit(), is(nullValue()));
}
use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.
the class CategoryObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_CATEGORY_OBSERVATION)));
final ObservationValue<?> value = observation.getValue();
assertThat(value, is(instanceOf(SingleObservationValue.class)));
assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
assertThat(value.getValue(), is(instanceOf(CategoryValue.class)));
CategoryValue v = (CategoryValue) value.getValue();
assertThat(v.getValue(), is(equalTo("Some Value")));
assertThat(v.getUnit(), is(equalTo("http://52north.org/")));
}
use of org.n52.shetland.ogc.om.ObservationValue in project arctic-sea by 52North.
the class GeometryObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_GEOMETRY_OBSERVATION)));
final ObservationValue<?> value = observation.getValue();
assertThat(value, is(instanceOf(SingleObservationValue.class)));
assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
assertThat(value.getValue(), is(instanceOf(GeometryValue.class)));
GeometryValue v = (GeometryValue) value.getValue();
assertThat(v.getUnit(), is(nullValue()));
Geometry g = v.getValue();
assertThat(g, is(instanceOf(LineString.class)));
assertThat(g.getSRID(), is(2000));
assertThat(g.getNumPoints(), is(2));
assertThat(g.getCoordinates()[0], is(equalTo(new Coordinate(52, 7))));
assertThat(g.getCoordinates()[1], is(equalTo(new Coordinate(51, 7))));
}
Aggregations