def METHOD_NAME(
    self, _, sp_xml_metadata, idp_xml_metadata, patron_id_regular_expression, expected_validation_result
):
    """Ensure that SAMLSettingsValidator correctly validates the input data.
    :param sp_xml_metadata: SP SAML metadata
    :type sp_xml_metadata: str
    :param idp_xml_metadata: IdP SAML metadata
    :type idp_xml_metadata: str
    :param patron_id_regular_expression: Regular expression used to extract a unique patron ID from SAML attributes
    :type patron_id_regular_expression: str
    :param expected_validation_result: Expected result: ProblemDetail object if validation must fail, None otherwise
    :type expected_validation_result: Optional[ProblemDetail]
    """
    # Arrange
    submitted_form_data = MultiDict()
    if sp_xml_metadata is not None:
        submitted_form_data.add(
            SAMLConfiguration.service_provider_xml_metadata.key, sp_xml_metadata
        )
    if idp_xml_metadata is not None:
        submitted_form_data.add(
            SAMLConfiguration.non_federated_identity_provider_xml_metadata.key,
            idp_xml_metadata,
        )
    if patron_id_regular_expression is not None:
        submitted_form_data.add(
            SAMLConfiguration.patron_id_regular_expression.key,
            patron_id_regular_expression,
        )
    submitted_form = {"form": submitted_form_data}
    metadata_parser = SAMLMetadataParser()
    parser = DSLParser()
    visitor = DSLEvaluationVisitor()
    evaluator = DSLEvaluator(parser, visitor)
    subject_filter = SAMLSubjectFilter(evaluator)
    validator = SAMLSettingsValidator(metadata_parser, subject_filter)
    # Act
    settings = list(SAMLWebSSOAuthenticationProvider.SETTINGS)
    result = validator.validate(settings, submitted_form)
    # Assert
    if isinstance(result, ProblemDetail):
        assert expected_validation_result.response == result.response
    else:
        assert expected_validation_result == result