private Attribute createAttribute(final String friendlyName, final String name, final String value) {
        val attributeBuilder = (SAMLObjectBuilder<Attribute>)this.builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME);

        val attr = attributeBuilder.buildObject();
        attr.setFriendlyName(friendlyName);
        attr.setName(name);

        val attrValue = mock(XMLObject.class);
        val dom = mock(Element.class);
        when(dom.getTextContent()).thenReturn(value);
        when(attrValue.getDOM()).thenReturn(dom);
        when(attrValue.getSchemaType()).thenReturn(new QName(" http://www.w3.org/2001/XMLSchema", "string", "xs"));

        attr.getAttributeValues().add(attrValue);
        return attr;
    }
This is {@link SAML2AuthenticatorTests}.
@author Misagh Moayyed
pac4j-saml/src/test/java/org/pac4j/saml/credentials/authenticator/SAML2AuthenticatorTests.java