### Question:
ConsentServiceInternalEncrypted implements ConsentServiceEncrypted { @Override @Transactional public CmsResponse<ConsentStatus> getConsentStatusById(String encryptedConsentId) { Optional<String> decryptIdOptional = securityDataService.decryptId(encryptedConsentId); if (decryptIdOptional.isEmpty()) { log.info("Encrypted Consent ID: [{}]. Get consent status by id failed, couldn't decrypt consent id", encryptedConsentId); return CmsResponse.<ConsentStatus>builder() .error(TECHNICAL_ERROR) .build(); } return consentService.getConsentStatusById(decryptIdOptional.get()); }  @Override @Transactional(rollbackFor = WrongChecksumException.class) CmsResponse<CmsCreateConsentResponse> createConsent(CmsConsent request); @Override @Transactional CmsResponse<ConsentStatus> getConsentStatusById(String encryptedConsentId); @Override @Transactional(rollbackFor = WrongChecksumException.class) CmsResponse<Boolean> updateConsentStatusById(String encryptedConsentId, ConsentStatus status); @Override @Transactional CmsResponse<CmsConsent> getConsentById(String encryptedConsentId); @Override @Transactional CmsResponse<Boolean> findAndTerminateOldConsentsByNewConsentId(String encryptedNewConsentId); @Override CmsResponse<List<PsuIdData>> getPsuDataByConsentId(String encryptedConsentId); @Override @Transactional(rollbackFor = WrongChecksumException.class) CmsResponse<Boolean> updateMultilevelScaRequired(String encryptedConsentId, boolean multilevelScaRequired);  }### Answer:
@Test void getConsentStatusById() { ConsentStatus consentStatus = ConsentStatus.VALID; when(securityDataService.decryptId(ENCRYPTED_CONSENT_ID)).thenReturn(Optional.of(CONSENT_ID)); when(consentService.getConsentStatusById(CONSENT_ID)) .thenReturn(CmsResponse.<ConsentStatus>builder() .payload(consentStatus) .build()); CmsResponse<ConsentStatus> response = consentServiceInternalEncrypted.getConsentStatusById(ENCRYPTED_CONSENT_ID); assertTrue(response.isSuccessful()); assertEquals(consentStatus, response.getPayload()); verify(consentService).getConsentStatusById(CONSENT_ID); }
@Test void getConsentStatusById_malformedEncryptedId() { when(securityDataService.decryptId(MALFORMED_ENCRYPTED_CONSENT_ID)).thenReturn(Optional.empty()); CmsResponse<ConsentStatus> response = consentServiceInternalEncrypted.getConsentStatusById(MALFORMED_ENCRYPTED_CONSENT_ID); assertTrue(response.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, response.getError()); verify(consentService, never()).getConsentStatusById(any()); }