@Test
    void verifyTransformFails() {
        val builder = new NonInflatingSaml20ObjectBuilder(openSamlConfigBean);
        val attr = builder.newNameID(NameIDType.TRANSIENT, "value");
        val xml = SamlUtils.transformSamlObject(openSamlConfigBean, attr).toString();
        assertThrows(SamlException.class, () -> SamlUtils.transformSamlObject(openSamlConfigBean,
            xml.getBytes(StandardCharsets.UTF_8), AuthnRequest.class));

        assertNull(SamlUtils.transformSamlObject(mock(OpenSamlConfigBean.class),
            ArrayUtils.EMPTY_BYTE_ARRAY, XMLObject.class));

        assertThrows(SamlException.class, () -> SamlUtils.transformSamlObject(mock(OpenSamlConfigBean.class),
            "whatever".getBytes(StandardCharsets.UTF_8), XMLObject.class));
        assertThrows(SamlException.class, () -> SamlUtils.transformSamlObject(mock(OpenSamlConfigBean.class), mock(XMLObject.class)));
        assertThrows(SamlException.class, () -> SamlUtils.logSamlObject(mock(OpenSamlConfigBean.class), mock(XMLObject.class)));
    }
This is {@link SamlUtilsTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-saml-core/src/test/java/org/apereo/cas/support/saml/SamlUtilsTests.java