### Question:
OauthConsentValidator extends OauthValidator<AisConsent> { @Override protected MessageError getMessageError() { return MESSAGE_ERROR; } OauthConsentValidator(RequestProviderService requestProviderService,
                                 AspspProfileServiceWrapper aspspProfileServiceWrapper,
                                 ScaApproachResolver scaApproachResolver);   }### Answer:
@Test void validate_invalid_tokenEmpty_approachRedirect_flowOauth_statusValid() { when(scaApproachResolver.resolveScaApproach()).thenReturn(ScaApproach.REDIRECT); when(aspspProfileServiceWrapper.getScaRedirectFlow()).thenReturn(ScaRedirectFlow.OAUTH); AisConsent aisConsent = buildAccountConsent(ConsentStatus.VALID); when(requestProviderService.getOAuth2Token()).thenReturn(""); ValidationResult validationResult = oauthConsentValidator.validate(aisConsent); assertNotNull(validationResult); assertTrue(validationResult.isNotValid()); assertEquals(MESSAGE_ERROR, validationResult.getMessageError()); }
@Test void validate_invalid_tokenNull_approachRedirect_flowOauth_statusValid() { when(scaApproachResolver.resolveScaApproach()).thenReturn(ScaApproach.REDIRECT); when(aspspProfileServiceWrapper.getScaRedirectFlow()).thenReturn(ScaRedirectFlow.OAUTH); AisConsent aisConsent = buildAccountConsent(ConsentStatus.VALID); when(requestProviderService.getOAuth2Token()).thenReturn(null); ValidationResult validationResult = oauthConsentValidator.validate(aisConsent); assertNotNull(validationResult); assertTrue(validationResult.isNotValid()); assertEquals(MESSAGE_ERROR, validationResult.getMessageError()); }