### Question:
AisConsentServiceInternalEncrypted implements AisConsentServiceEncrypted { @Override @Transactional(rollbackFor = WrongChecksumException.class) public CmsResponse<CmsResponse.VoidResponse> checkConsentAndSaveActionLog(AisConsentActionRequest encryptedRequest) throws WrongChecksumException { String consentId = encryptedRequest.getConsentId(); Optional<String> decryptedConsentId = securityDataService.decryptId(consentId); if (decryptedConsentId.isEmpty()) { log.info("Encrypted Consent ID: [{}]. Check consent and save action log failed, couldn't decrypt consent id", consentId); return CmsResponse.<CmsResponse.VoidResponse>builder() .error(TECHNICAL_ERROR) .build(); } AisConsentActionRequest decryptedRequest = new AisConsentActionRequest(encryptedRequest.getTppId(), decryptedConsentId.get(), encryptedRequest.getActionStatus(), encryptedRequest.getRequestUri(), encryptedRequest.isUpdateUsage(), encryptedRequest.getResourceId(), encryptedRequest.getTransactionId()); return aisConsentService.checkConsentAndSaveActionLog(decryptedRequest); }  @Override @Transactional(rollbackFor = WrongChecksumException.class) CmsResponse<CmsResponse.VoidResponse> checkConsentAndSaveActionLog(AisConsentActionRequest encryptedRequest); @Override @Transactional(rollbackFor = WrongChecksumException.class) CmsResponse<CmsConsent> updateAspspAccountAccess(String encryptedConsentId, AccountAccess request);  }### Answer:
@Test void checkConsentAndSaveActionLog_success() throws WrongChecksumException { AisConsentActionRequest request = buildAisActionRequest(ENCRYPTED_CONSENT_ID); when(securityDataService.decryptId(ENCRYPTED_CONSENT_ID)).thenReturn(Optional.of(DECRYPTED_CONSENT_ID)); aisConsentServiceInternalEncrypted.checkConsentAndSaveActionLog(request); AisConsentActionRequest decryptedRequest = buildAisActionRequest(DECRYPTED_CONSENT_ID); verify(aisConsentService, times(1)).checkConsentAndSaveActionLog(decryptedRequest); }
@Test void checkConsentAndSaveActionLog_decryptionFailed() throws WrongChecksumException { AisConsentActionRequest request = buildAisActionRequest(UNDECRYPTABLE_CONSENT_ID); aisConsentServiceInternalEncrypted.checkConsentAndSaveActionLog(request); verify(aisConsentService, never()).checkConsentAndSaveActionLog(any()); }