### Question:
CmsPsuConfirmationOfFundsServiceInternal implements CmsPsuConfirmationOfFundsService { @Override @Transactional public boolean updateAuthorisationStatus(@NotNull PsuIdData psuIdData, @NotNull String consentId, @NotNull String authorisationId, @NotNull ScaStatus status, @NotNull String instanceId, AuthenticationDataHolder authenticationDataHolder) throws AuthorisationIsExpiredException { Optional<ConsentEntity> actualConsent = getActualConsent(consentId, instanceId); if (actualConsent.isEmpty()) { log.info("Consent ID: [{}], Instance ID: [{}]. Update of authorisation status failed, because consent either has finalised status or not found", consentId, instanceId); return false; } return consentAuthorisationService.getAuthorisationByAuthorisationId(authorisationId, instanceId) .map(authorisation -> consentAuthorisationService.updateScaStatusAndAuthenticationData(status, authorisation, authenticationDataHolder)) .orElseGet(() -> { log.info("Authorisation ID [{}], Instance ID: [{}]. Update authorisation status failed, because authorisation not found", authorisationId, instanceId); return false; }); }  @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 updateAuthorisationStatus() throws AuthorisationIsExpiredException { when(confirmationOfFundsConsentSpecification.byConsentIdAndInstanceId(CONSENT_ID, INSTANCE_ID)) .thenReturn((root, criteriaQuery, criteriaBuilder) -> null); when(consentJpaRepository.findOne(any(Specification.class))) .thenReturn(Optional.of(consentEntity)); when(consentAuthorisationService.getAuthorisationByAuthorisationId(AUTHORISATION_ID, INSTANCE_ID)) .thenReturn(Optional.of(authorisationEntity)); when(consentAuthorisationService.updateScaStatusAndAuthenticationData(ScaStatus.RECEIVED, authorisationEntity, authenticationDataHolder)) .thenReturn(true); boolean result = cmsPsuConfirmationOfFundsServiceInternal.updateAuthorisationStatus(psuIdData, CONSENT_ID, AUTHORISATION_ID, ScaStatus.RECEIVED, INSTANCE_ID, authenticationDataHolder); assertTrue(result); }