@Test
    void verifyRemoteUserExists() throws Throwable {
        val context = MockRequestContext.create(applicationContext);

        val principal = mock(Principal.class);
        when(principal.getName()).thenReturn("casuser");
        context.getHttpServletRequest().setUserPrincipal(principal);
        assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, this.action.execute(context).getId());

        context.getHttpServletRequest().setRemoteUser("test");
        assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, this.action.execute(context).getId());

        context.addHeader("principal", "casuser");
        assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, this.action.execute(context).getId());
    }
This is {@link PrincipalFromRequestHeaderNonInteractiveCredentialsActionTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-trusted/src/test/java/org/apereo/cas/adaptors/trusted/web/flow/PrincipalFromRequestHeaderNonInteractiveCredentialsActionTests.java