@Test
public void buildInsertObservation_should_add_single_measurement_with_foi_ref() throws OXFException, XmlException {

    addServiceAndVersion();
    addObservationValues();
    final String insertObservation = builder.buildInsertObservationRequest(parameters);
    final InsertObservationType insertObservationType = InsertObservationDocument.Factory.parse(insertObservation)
            .getInsertObservation();
    assertThat(insertObservationType.getOfferingArray().length, is(1));
    assertThat(insertObservationType.getOfferingArray(0), is(offering));
    assertThat(insertObservationType.getObservationArray().length, is(1));
    final OMObservationType observation = insertObservationType.getObservationArray(0).getOMObservation();
    assertThat(observation.getId(), not(isEmptyOrNullString()));
    assertThat(observation.getType().getHref(),
            is("http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"));
    // phentime
    assertThat(
            ((TimeInstantType)observation.getPhenomenonTime().getAbstractTimeObject()).getTimePosition()
                    .getStringValue(),
            is(phenTime.toISO8601Format()));
    assertThat(observation.getPhenomenonTime().getAbstractTimeObject().getId(),is("phenomenonTime"));
    // res time
    assertThat(observation.getResultTime().getTimeInstant().getTimePosition().getStringValue(),
            is(resultTime.toISO8601Format()));
    assertThat(observation.getResultTime().getTimeInstant().getId(),is("resultTime"));
    assertThat(observation.getProcedure().getHref(),is(procedure)); // proc
    assertThat(observation.getObservedProperty().getHref(),is(obsProp)); // obsProp
    assertThat(observation.getFeatureOfInterest().getHref(),is(foiId)); // foiId
    final MeasureType result = (MeasureType) observation.getResult();
    assertThat(result.getStringValue(),is(value)); // result value
    assertThat(result.getUom(),is(uom)); // result uom
}