### Question:
TppUriHeaderValidator implements BusinessValidator<TppRedirectUri>, PaymentHeaderValidator, ConsentHeaderValidator { @Override public @NotNull ValidationResult validate(@NotNull TppRedirectUri tppRedirectUri) { return ValidationResult.valid(); }  @Override @NotNull ValidationResult validate(@NotNull TppRedirectUri tppRedirectUri); @Override @NotNull Set<TppMessageInformation> buildWarningMessages(@NotNull TppRedirectUri tppRedirectUri); @Override MessageError validate(Map<String, String> headers, MessageError messageError);  }### Answer:
@Test void validate() { ValidationResult actual = validator.validate(TPP_REDIRECT_URIs); assertTrue(actual.isValid()); }
@Test void validate_valid() { Map<String, String> headers = new HashMap<>(); headers.put(Xs2aHeaderConstant.TPP_REDIRECT_URI, TPP_REDIRECT_URI); headers.put(Xs2aHeaderConstant.TPP_NOK_REDIRECT_URI, TPP_NOK_REDIRECT_URI); MessageError messageError = new MessageError(); when(tppDomainValidator.validate(TPP_REDIRECT_URI)).thenReturn(ValidationResult.valid()); when(tppDomainValidator.validate(TPP_NOK_REDIRECT_URI)).thenReturn(ValidationResult.valid()); MessageError actual = validator.validate(headers, messageError); assertEquals(messageError, actual); }
@Test void validate_invalidRedirectUri() { Map<String, String> headers = new HashMap<>(); headers.put(Xs2aHeaderConstant.TPP_REDIRECT_URI, TPP_REDIRECT_URI); headers.put(Xs2aHeaderConstant.TPP_NOK_REDIRECT_URI, TPP_NOK_REDIRECT_URI); MessageError messageError = new MessageError(); ValidationResult validationResult = buildInvalidResult(); when(tppDomainValidator.validate(TPP_REDIRECT_URI)).thenReturn(ValidationResult.valid()); when(tppDomainValidator.validate(TPP_NOK_REDIRECT_URI)).thenReturn(validationResult); MessageError actual = validator.validate(headers, messageError); assertEquals(validationResult.getMessageError(), actual); }
@Test void validate_invalidNokRedirectUri() { Map<String, String> headers = new HashMap<>(); headers.put(Xs2aHeaderConstant.TPP_REDIRECT_URI, TPP_REDIRECT_URI); headers.put(Xs2aHeaderConstant.TPP_NOK_REDIRECT_URI, TPP_NOK_REDIRECT_URI); MessageError messageError = new MessageError(); ValidationResult validationResult = buildInvalidResult(); when(tppDomainValidator.validate(TPP_REDIRECT_URI)).thenReturn(validationResult); MessageError actual = validator.validate(headers, messageError); assertEquals(validationResult.getMessageError(), actual); }