### Question:
PisCommonPaymentServiceInternalEncrypted implements PisCommonPaymentServiceEncrypted { @Override @Transactional public CmsResponse<Boolean> updateCommonPaymentStatusById(String encryptedPaymentId, TransactionStatus status) { Optional<String> decryptIdOptional = securityDataService.decryptId(encryptedPaymentId); if (decryptIdOptional.isEmpty()) { log.info("Encrypted Payment ID: [{}]. Get common payment status by ID failed, couldn't decrypt consent id", encryptedPaymentId); return CmsResponse.<Boolean>builder() .error(TECHNICAL_ERROR) .build(); } return pisCommonPaymentService.updateCommonPaymentStatusById(decryptIdOptional.get(), status); }  @Override @Transactional CmsResponse<CreatePisCommonPaymentResponse> createCommonPayment(PisPaymentInfo request); @Override @Transactional CmsResponse<TransactionStatus> getPisCommonPaymentStatusById(String encryptedPaymentId); @Override @Transactional CmsResponse<PisCommonPaymentResponse> getCommonPaymentById(String encryptedPaymentId); @Override @Transactional CmsResponse<Boolean> updateCommonPaymentStatusById(String encryptedPaymentId, TransactionStatus status); @Override CmsResponse<String> getDecryptedId(String encryptedId); @Override @Transactional CmsResponse<Boolean> updateMultilevelSca(String encryptedPaymentId, boolean multilevelScaRequired); @Override CmsResponse<List<PsuIdData>> getPsuDataListByPaymentId(String encryptedPaymentId);  }### Answer:
@Test void updateCommonPaymentStatusById_success() { when(securityDataService.decryptId(ENCRYPTED_PAYMENT_ID)).thenReturn(Optional.of(DECRYPTED_PAYMENT_ID)); when(pisCommonPaymentService.updateCommonPaymentStatusById(DECRYPTED_PAYMENT_ID, TRANSACTION_STATUS)) .thenReturn(CmsResponse.<Boolean>builder() .payload(true) .build()); CmsResponse<Boolean> actual = pisCommonPaymentServiceInternalEncrypted.updateCommonPaymentStatusById(ENCRYPTED_PAYMENT_ID, TRANSACTION_STATUS); assertTrue(actual.isSuccessful()); assertTrue(actual.getPayload()); verify(pisCommonPaymentService, times(1)).updateCommonPaymentStatusById(DECRYPTED_PAYMENT_ID, TRANSACTION_STATUS); }
@Test void updateCommonPaymentStatusById_technicalError() { when(securityDataService.decryptId(ENCRYPTED_PAYMENT_ID)).thenReturn(Optional.empty()); CmsResponse<Boolean> actual = pisCommonPaymentServiceInternalEncrypted.updateCommonPaymentStatusById(ENCRYPTED_PAYMENT_ID, TRANSACTION_STATUS); assertTrue(actual.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, actual.getError()); verify(pisCommonPaymentService, never()).updateCommonPaymentStatusById(DECRYPTED_PAYMENT_ID, TRANSACTION_STATUS); }