@Test
        public void verifyPass() throws Throwable {
            val context = MockRequestContext.create(applicationContext);
            val credential = RegisteredServiceTestUtils.getCredentialsWithSameUsernameAndPassword("casuser");
            MultifactorAuthenticationWebflowUtils.putMultifactorAuthenticationParentCredential(context, credential);
            
            val authentication = RegisteredServiceTestUtils.getAuthentication();
            WebUtils.putAuthentication(authentication, context);
            WebUtils.putRegisteredService(context, RegisteredServiceTestUtils.getRegisteredService());

            val provider = MultifactorAuthenticationUtils.getMultifactorAuthenticationProviderById(
                DuoSecurityMultifactorAuthenticationProperties.DEFAULT_IDENTIFIER, applicationContext).orElseThrow();
            MultifactorAuthenticationWebflowUtils.putMultifactorAuthenticationProvider(context, provider);

            val authnResult = new DefaultAuthenticationResultBuilder(principalElectionStrategy)
                .collect(RegisteredServiceTestUtils.getAuthentication());

            WebUtils.putAuthenticationResultBuilder(authnResult, context);

            val prepResult = duoUniversalPromptPrepareLoginAction.execute(context);

            val ticket = ticketRegistry.getTicket(prepResult.getAttributes().get("result").toString(),
                TransientSessionTicket.class);
            val code = UUID.randomUUID().toString();

            context.setParameter(DuoSecurityUniversalPromptValidateLoginAction.REQUEST_PARAMETER_CODE, code);
            context.setParameter(DuoSecurityUniversalPromptValidateLoginAction.REQUEST_PARAMETER_STATE,
                TransientSessionTicket.PREFIX + "-1234567");
            var result = duoUniversalPromptValidateLoginAction.execute(context);
            assertEquals(CasWebflowConstants.TRANSITION_ID_ERROR, result.getId());

            context.setParameter(DuoSecurityUniversalPromptValidateLoginAction.REQUEST_PARAMETER_STATE, ticket.getId());
            result = duoUniversalPromptValidateLoginAction.execute(context);
            assertNotNull(result);
            assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, result.getId());
            assertNotNull(WebUtils.getAuthentication(context));
            assertNotNull(WebUtils.getRegisteredService(context));
            assertNotNull(WebUtils.getAuthenticationResult(context));
            assertInstanceOf(UsernamePasswordCredential.class, WebUtils.getCredential(context));

            val builder = WebUtils.getAuthenticationResultBuilder(context);
            val finalAuth = builder.build();
            val principal = finalAuth.getAuthentication().getPrincipal();
            assertEquals("casuser", principal.getId());
            assertTrue(principal.getAttributes().containsKey("duoAuthResult"));
        }
This is {@link DuoSecurityUniversalPromptValidateLoginActionTests}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-duo/src/test/java/org/apereo/cas/adaptors/duo/web/flow/action/DuoSecurityUniversalPromptValidateLoginActionTests.java