@Test
    void verifyOperation() throws Throwable {
        val request = new MockHttpServletRequest();
        request.addHeader(HttpHeaders.USER_AGENT, "test");
        val response = new MockHttpServletResponse();

        val registeredService = getSamlRegisteredServiceForTestShib();
        val authnRequest = getAuthnRequestFor(registeredService);
        val adaptor = SamlRegisteredServiceMetadataAdaptor.get(
            samlRegisteredServiceCachingMetadataResolver, registeredService, authnRequest).orElseThrow();
        val encoder = new SamlResponseArtifactEncoder(velocityEngine, adaptor, request, response, samlArtifactMap);
        assertEquals(SAMLConstants.SAML2_ARTIFACT_BINDING_URI, encoder.getBinding());

        val tgt = new MockTicketGrantingTicket("casuser");
        ticketRegistry.addTicket(tgt);
        ticketGrantingTicketCookieGenerator.addCookie(request, response, tgt.getId());
        request.setCookies(response.getCookies());

        RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request, new MockHttpServletResponse()));
        
        val samlResponse = samlProfileSamlResponseBuilder.newSamlObject(Response.class);
        val issuer = samlProfileSamlResponseBuilder.newSamlObject(Issuer.class);
        issuer.setValue("cas");
        samlResponse.setIssuer(issuer);
        assertNotNull(encoder.encode(authnRequest, samlResponse, "relay-state", new MessageContext()));
    }
This is {@link SamlResponseArtifactEncoderTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-saml-idp/src/test/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/encoder/sso/SamlResponseArtifactEncoderTests.java