### Question:
CreatePaymentValidator implements BusinessValidator<CreatePaymentRequestObject> { @Override public @NotNull Set<TppMessageInformation> buildWarningMessages(@NotNull CreatePaymentRequestObject createPaymentRequestObject) { Set<TppMessageInformation> warnings = new HashSet<>(); warnings.addAll(tppUriHeaderValidator.buildWarningMessages(createPaymentRequestObject.getPaymentInitiationParameters().getTppRedirectUri())); warnings.addAll(tppNotificationDataValidator.buildWarningMessages(createPaymentRequestObject.getPaymentInitiationParameters().getTppNotificationData())); return warnings; }  @NotNull @Override ValidationResult validate(@NotNull CreatePaymentRequestObject createPaymentRequestObject); @Override @NotNull Set<TppMessageInformation> buildWarningMessages(@NotNull CreatePaymentRequestObject createPaymentRequestObject);  }### Answer:
@Test void buildWarningMessages_emptySet() { Set<TppMessageInformation> emptySet = new HashSet<>(); PaymentInitiationParameters paymentInitiationParameters = buildPaymentInitiationParameters(EMPTY_PSU_DATA, PaymentType.SINGLE); CreatePaymentRequestObject createPaymentRequestObject = new CreatePaymentRequestObject(buildPayment(), paymentInitiationParameters); when(tppUriHeaderValidator.buildWarningMessages(any())) .thenReturn(emptySet); when(tppNotificationDataValidator.buildWarningMessages(any())) .thenReturn(emptySet); Set<TppMessageInformation> actual = createPaymentValidator.buildWarningMessages(createPaymentRequestObject); assertEquals(actual, emptySet); verify(tppUriHeaderValidator, times(1)).buildWarningMessages(any()); verify(tppNotificationDataValidator, times(1)).buildWarningMessages(any()); }
@Test void buildWarningMessages_warningsFromUriHeaderValidator() { Set<TppMessageInformation> emptySet = new HashSet<>(); Set<TppMessageInformation> uriHeaderValidatorSet = new HashSet<>(); uriHeaderValidatorSet.add(TppMessageInformation.buildWarning(INVALID_DOMAIN_MESSAGE)); PaymentInitiationParameters paymentInitiationParameters = buildPaymentInitiationParameters(EMPTY_PSU_DATA, PaymentType.SINGLE); CreatePaymentRequestObject createPaymentRequestObject = new CreatePaymentRequestObject(buildPayment(), paymentInitiationParameters); when(tppUriHeaderValidator.buildWarningMessages(any())) .thenReturn(uriHeaderValidatorSet); when(tppNotificationDataValidator.buildWarningMessages(any())) .thenReturn(emptySet); Set<TppMessageInformation> actual = createPaymentValidator.buildWarningMessages(createPaymentRequestObject); assertEquals(actual, uriHeaderValidatorSet); verify(tppUriHeaderValidator, times(1)).buildWarningMessages(any()); verify(tppNotificationDataValidator, times(1)).buildWarningMessages(any()); }