### Question:
PisAuthorisationValidator { @NotNull public ValidationResult validate(@NotNull String authorisationId, @NotNull PisCommonPaymentResponse commonPaymentResponse) { Optional<Authorisation> authorisationOptional = commonPaymentResponse.findAuthorisationInPayment(authorisationId); if (authorisationOptional.isEmpty()) { log.info("Payment ID: [{}], Authorisation ID: [{}]. Updating PIS initiation authorisation PSU Data has failed: couldn't find authorisation with given authorisationId for payment", commonPaymentResponse.getExternalId(), authorisationId); return ValidationResult.invalid(ErrorType.PIS_403, RESOURCE_UNKNOWN_403); } return ValidationResult.valid(); }  @NotNull ValidationResult validate(@NotNull String authorisationId, @NotNull PisCommonPaymentResponse commonPaymentResponse);  }### Answer:
@Test void validate_withValidAuthorisation_shouldReturnValid() { PisCommonPaymentResponse paymentResponse = buildPisCommonPaymentResponse(new Authorisation(AUTHORISATION_ID, PSU_ID_DATA, "paymentId", AuthorisationType.PIS_CREATION, SCA_STATUS)); ValidationResult validationResult = pisAuthorisationValidator.validate(AUTHORISATION_ID, paymentResponse); assertNotNull(validationResult); assertTrue(validationResult.isValid()); assertNull(validationResult.getMessageError()); }
@Test void validate_withUnknownAuthorisationId_shouldReturnUnknownError() { PisCommonPaymentResponse paymentResponse = buildPisCommonPaymentResponse(new Authorisation(AUTHORISATION_ID, PSU_ID_DATA, "paymentId", AuthorisationType.PIS_CREATION, SCA_STATUS)); ValidationResult validationResult = pisAuthorisationValidator.validate(UNKNOWN_AUTHORISATION_ID, paymentResponse); assertNotNull(validationResult); assertTrue(validationResult.isNotValid()); assertEquals(UNKNOWN_AUTHORISATION_ERROR, validationResult.getMessageError()); }