### Question:
CmsPsuConfirmationOfFundsServiceInternal implements CmsPsuConfirmationOfFundsService { @Override public @NotNull Optional<CmsPsuConfirmationOfFundsAuthorisation> getAuthorisationByAuthorisationId(@NotNull String authorisationId, @NotNull String instanceId) throws AuthorisationIsExpiredException { Optional<CmsPsuConfirmationOfFundsAuthorisation> cmsPsuConfirmationOfFundsAuthorisation = consentAuthorisationService.getAuthorisationByAuthorisationId(authorisationId, instanceId) .map(cmsPsuAuthorisationMapper::mapToCmsPsuConfirmationOfFundsAuthorisation); if (cmsPsuConfirmationOfFundsAuthorisation.isEmpty()) { log.info("Authorisation ID [{}], Instance ID: [{}]. Get authorisation failed, because authorisation not found", authorisationId, instanceId); } return cmsPsuConfirmationOfFundsAuthorisation; }  @Override @Transactional boolean updateAuthorisationStatus(@NotNull PsuIdData psuIdData, @NotNull String consentId,
                                             @NotNull String authorisationId, @NotNull ScaStatus status,
                                             @NotNull String instanceId, AuthenticationDataHolder authenticationDataHolder); @Override @Transactional boolean updatePsuDataInConsent(@NotNull PsuIdData psuIdData, @NotNull String authorisationId, @NotNull String instanceId); @Override @Transactional @NotNull Optional<CmsConfirmationOfFundsConsent> getConsent(@NotNull PsuIdData psuIdData,
                                                                       @NotNull String consentId,
                                                                       @NotNull String instanceId); @Override @Transactional Optional<CmsConfirmationOfFundsResponse> checkRedirectAndGetConsent(String redirectId, String instanceId); @Override @NotNull Optional<CmsPsuConfirmationOfFundsAuthorisation> getAuthorisationByAuthorisationId(@NotNull String authorisationId, @NotNull String instanceId); @Override @Transactional boolean updateConsentStatus(@NotNull String consentId, @NotNull ConsentStatus status, @NotNull String instanceId);  }### Answer:
@Test void getAuthorisationByAuthorisationId() throws AuthorisationIsExpiredException { when(consentAuthorisationService.getAuthorisationByAuthorisationId(AUTHORISATION_ID, INSTANCE_ID)) .thenReturn(Optional.of(authorisationEntity)); when(cmsPsuAuthorisationMapper.mapToCmsPsuConfirmationOfFundsAuthorisation(authorisationEntity)) .thenReturn(cmsPsuConfirmationOfFundsAuthorisation); Optional<CmsPsuConfirmationOfFundsAuthorisation> authorisationByAuthorisationId = cmsPsuConfirmationOfFundsServiceInternal.getAuthorisationByAuthorisationId(AUTHORISATION_ID, INSTANCE_ID); assertTrue(authorisationByAuthorisationId.isPresent()); assertEquals(cmsPsuConfirmationOfFundsAuthorisation, authorisationByAuthorisationId.get()); }
@Test void getAuthorisationByAuthorisationId_authorisationNotFound() throws AuthorisationIsExpiredException { when(consentAuthorisationService.getAuthorisationByAuthorisationId(AUTHORISATION_ID, INSTANCE_ID)) .thenReturn(Optional.empty()); Optional<CmsPsuConfirmationOfFundsAuthorisation> authorisationByAuthorisationId = cmsPsuConfirmationOfFundsServiceInternal.getAuthorisationByAuthorisationId(AUTHORISATION_ID, INSTANCE_ID); assertTrue(authorisationByAuthorisationId.isEmpty()); }