@Test
    void verifyOperation() throws Throwable {
        val request = new MockHttpServletRequest();
        request.setRemoteAddr("185.86.151.11");
        request.setLocalAddr("185.88.151.11");
        request.setContextPath("/tenants/shire/login");
        ClientInfoHolder.setClientInfo(ClientInfo.from(request));

        val credential = CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("casuser", "Mellon");
        
        val transaction = CoreAuthenticationTestUtils.getAuthenticationTransactionFactory()
            .newTransaction(RegisteredServiceTestUtils.getService(), credential);

        try (val webServer = new MockWebServer(19999)) {
            webServer.start();
            webServer.responseBodyJson(PrincipalFactoryUtils.newPrincipalFactory().createPrincipal("casuser"));
            webServer.responseStatus(HttpStatus.OK);

            val result = authenticationManager.authenticate(transaction);
            assertNotNull(result);
            assertEquals("casuser", result.getPrincipal().getId());
        }

    }
This is {@link TenantRestAuthenticationHandlerBuilderTests}.

@author Misagh Moayyed
@since 7.3.0
support/cas-server-support-rest-authentication/src/test/java/org/apereo/cas/adaptors/rest/TenantRestAuthenticationHandlerBuilderTests.java