@Test
    void verifyCreateResponseEntityForAuthnFailure() {
        val request = new MockHttpServletRequest();
        val map = CollectionUtils.<String, Throwable>wrap(
            UnauthorizedAuthenticationException.class.getSimpleName(),
            new UnauthorizedAuthenticationException("test")
        );
        val applicationContext = new StaticApplicationContext();
        applicationContext.refresh();
        val response = RestResourceUtils.createResponseEntityForAuthnFailure(
            new AuthenticationException("test", map, new HashMap<>()),
            request, applicationContext);

        assertTrue(response.getStatusCode().isError());
        assertNotNull(response.getBody());
        assertFalse(response.getBody().contains(UnauthorizedAuthenticationException.class.getSimpleName()));
    }
This is {@link RestResourceUtilsTests}.

@author john.j.cool
@since 6.1.6
support/cas-server-support-rest/src/test/java/org/apereo/cas/support/rest/RestResourceUtilsTests.java