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

    /*
     * MULTIPLE FEATURE AND OBSERVATION TYPES
     */
    final String obsType1 = "observation-type-1";
    final String obsType2 = "observation-type-2";
    final String foiType1 = "feature-type-1";
    final String foiType2 = "feature-type-2";
    createParamConWithMandatoryInsertSensorValues();
    parameters.addParameterShell(REGISTER_SENSOR_OBSERVATION_TYPE, obsType1,obsType2);
    parameters.addParameterShell(REGISTER_SENSOR_FEATURE_TYPE_PARAMETER, foiType1,foiType2);
    parameters.addParameterShell(REGISTER_SENSOR_OBSERVED_PROPERTY_PARAMETER,
            TEST_OBSERVABLE_PROPERTY_1);
    String registerSensor = builder.buildRegisterSensorRequest(parameters);
    InsertSensorType insertSensorType = InsertSensorDocument.Factory.parse(registerSensor).getInsertSensor();
    assertThat(insertSensorType.getMetadataArray().length,is(1));
    SosInsertionMetadataType insertionMetadata = SosInsertionMetadataDocument.Factory.parse(
            insertSensorType.getMetadataArray()[0].xmlText()).getSosInsertionMetadata();
    assertThat(insertionMetadata.getObservationTypeArray().length,is(2));
    assertThat(insertionMetadata.getFeatureOfInterestTypeArray().length,is(2));
    assertThat(insertionMetadata.getObservationTypeArray(),hasItemInArray(obsType1));
    assertThat(insertionMetadata.getObservationTypeArray(),hasItemInArray(obsType2));
    assertThat(insertionMetadata.getFeatureOfInterestTypeArray(),hasItemInArray(foiType1));
    assertThat(insertionMetadata.getFeatureOfInterestTypeArray(),hasItemInArray(foiType2));
    /*
     * SINGLE FEATURE AND OBSERVATION TYPE
     */
    parameters = new ParameterContainer();
    createParamConWithMandatoryInsertSensorValues();
    parameters.addParameterShell(REGISTER_SENSOR_OBSERVATION_TYPE, obsType1);
    parameters.addParameterShell(REGISTER_SENSOR_FEATURE_TYPE_PARAMETER, foiType1);
    parameters.addParameterShell(REGISTER_SENSOR_OBSERVED_PROPERTY_PARAMETER,
            TEST_OBSERVABLE_PROPERTY_1);
    registerSensor = builder.buildRegisterSensorRequest(parameters);
    insertSensorType = InsertSensorDocument.Factory.parse(registerSensor).getInsertSensor();
    assertThat(insertSensorType.getMetadataArray().length,is(1));
    insertionMetadata = SosInsertionMetadataDocument.Factory.parse(insertSensorType.getMetadataArray()[0]
            .xmlText()).getSosInsertionMetadata();
    assertThat(insertionMetadata.getObservationTypeArray().length,is(1));
    assertThat(insertionMetadata.getFeatureOfInterestTypeArray().length,is(1));
    assertThat(insertionMetadata.getObservationTypeArray(),hasItemInArray(obsType1));
    assertThat(insertionMetadata.getFeatureOfInterestTypeArray(),hasItemInArray(foiType1));
}