### Question:
Xs2aAisConsentService { public void updateConsentStatus(String consentId, ConsentStatus consentStatus) { CmsResponse<Boolean> statusUpdated; try { statusUpdated = consentService.updateConsentStatusById(consentId, consentStatus); } catch (WrongChecksumException e) { log.info("updateConsentStatus cannot be executed, checksum verification failed"); return; } if (statusUpdated.isSuccessful() && BooleanUtils.isTrue(statusUpdated.getPayload())) { loggingContextService.storeConsentStatus(consentStatus); } }  Optional<Xs2aCreateAisConsentResponse> createConsent(CreateConsentReq request, PsuIdData psuData, TppInfo tppInfo); Optional<AisConsent> getAccountConsentById(String consentId); boolean findAndTerminateOldConsentsByNewConsentId(String newConsentId); void updateConsentStatus(String consentId, ConsentStatus consentStatus); void consentActionLog(String tppId, String consentId, ActionStatus actionStatus, String requestUri, boolean updateUsage,
                                 String resourceId, String transactionId); void updateConsentAuthorisation(UpdateConsentPsuDataReq updatePsuData); CmsResponse<AisConsent> updateAspspAccountAccess(String consentId, AccountAccess accountAccess); Optional<List<String>> getAuthorisationSubResources(String consentId); void updateMultilevelScaRequired(String consentId, boolean multilevelScaRequired);  }### Answer:
@Test void updateConsentStatus_shouldStoreConsentStatusInLoggingContext() throws WrongChecksumException { when(consentServiceEncrypted.updateConsentStatusById(CONSENT_ID, CONSENT_STATUS)) .thenReturn(CmsResponse.<Boolean>builder().payload(true).build()); xs2aAisConsentService.updateConsentStatus(CONSENT_ID, CONSENT_STATUS); verify(consentServiceEncrypted).updateConsentStatusById(CONSENT_ID, CONSENT_STATUS); verify(loggingContextService).storeConsentStatus(CONSENT_STATUS); }
@Test void updateConsentStatus_WrongChecksumException() throws WrongChecksumException { when(consentServiceEncrypted.updateConsentStatusById(CONSENT_ID, CONSENT_STATUS)) .thenThrow(new WrongChecksumException()); xs2aAisConsentService.updateConsentStatus(CONSENT_ID, CONSENT_STATUS); verify(consentServiceEncrypted, times(1)).updateConsentStatusById(CONSENT_ID, CONSENT_STATUS); verify(loggingContextService, never()).storeConsentStatus(any(ConsentStatus.class)); }
@Test void updateConsentStatus_failure_shouldNotStoreConsentStatusInLoggingContext() throws WrongChecksumException { when(consentServiceEncrypted.updateConsentStatusById(CONSENT_ID, CONSENT_STATUS)) .thenReturn(CmsResponse.<Boolean>builder().payload(false).build()); xs2aAisConsentService.updateConsentStatus(CONSENT_ID, CONSENT_STATUS); verify(consentServiceEncrypted).updateConsentStatusById(CONSENT_ID, CONSENT_STATUS); verify(loggingContextService, never()).storeConsentStatus(any()); }