### Question:
ConsentServiceInternalEncrypted implements ConsentServiceEncrypted { @Override @Transactional(rollbackFor = WrongChecksumException.class) public CmsResponse<Boolean> updateConsentStatusById(String encryptedConsentId, ConsentStatus status) throws WrongChecksumException { Optional<String> decryptIdOptional = securityDataService.decryptId(encryptedConsentId); if (decryptIdOptional.isEmpty()) { log.info("Encrypted Consent ID: [{}]. Update consent by id failed, couldn't decrypt consent id", encryptedConsentId); return CmsResponse.<Boolean>builder() .error(TECHNICAL_ERROR) .build(); } return consentService.updateConsentStatusById(decryptIdOptional.get(), status); }  @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 updateConsentStatusById() throws WrongChecksumException { when(securityDataService.decryptId(ENCRYPTED_CONSENT_ID)).thenReturn(Optional.of(CONSENT_ID)); ConsentStatus consentStatus = ConsentStatus.VALID; when(consentService.updateConsentStatusById(CONSENT_ID, consentStatus)) .thenReturn(CmsResponse.<Boolean>builder() .payload(true) .build()); CmsResponse<Boolean> response = consentServiceInternalEncrypted.updateConsentStatusById(ENCRYPTED_CONSENT_ID, consentStatus); assertTrue(response.isSuccessful()); assertTrue(response.getPayload()); verify(consentService).updateConsentStatusById(CONSENT_ID, consentStatus); }
@Test void updateConsentStatusById_malformedEncryptedId() throws WrongChecksumException { when(securityDataService.decryptId(MALFORMED_ENCRYPTED_CONSENT_ID)).thenReturn(Optional.empty()); ConsentStatus consentStatus = ConsentStatus.VALID; CmsResponse<Boolean> response = consentServiceInternalEncrypted.updateConsentStatusById(MALFORMED_ENCRYPTED_CONSENT_ID, consentStatus); assertTrue(response.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, response.getError()); verify(consentService, never()).updateConsentStatusById(any(), any()); }