@Test
    void verifyPreparePeerEntitySamlEndpointContext() {
        val context = new MessageContext();
        val adaptor = mock(SamlRegisteredServiceMetadataAdaptor.class);

        val service = getSamlRegisteredServiceForTestShib();
        servicesManager.save(service);
        val authnRequest = mock(AuthnRequest.class);
        val issuer = mock(Issuer.class);
        when(issuer.getValue()).thenReturn(service.getServiceId());
        when(authnRequest.getIssuer()).thenReturn(issuer);

        when(adaptor.containsAssertionConsumerServices()).thenReturn(false);
        assertThrows(SamlException.class,
            () -> SamlIdPUtils.preparePeerEntitySamlEndpointContext(Pair.of(authnRequest, context), context, adaptor, SAMLConstants.SAML2_POST_BINDING_URI));

        when(adaptor.containsAssertionConsumerServices()).thenReturn(true);
        when(authnRequest.isSigned()).thenReturn(true);
        assertThrows(SamlException.class,
            () -> SamlIdPUtils.preparePeerEntitySamlEndpointContext(Pair.of(authnRequest, context), context, adaptor, SAMLConstants.SAML2_POST_BINDING_URI));
    }
This is {@link SamlIdPUtilsTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-saml-idp/src/test/java/org/apereo/cas/support/saml/util/SamlIdPUtilsTests.java