### Question:
PisCommonPaymentServiceInternalEncrypted implements PisCommonPaymentServiceEncrypted { @Override public CmsResponse<List<PsuIdData>> getPsuDataListByPaymentId(String encryptedPaymentId) { Optional<String> decryptIdOptional = securityDataService.decryptId(encryptedPaymentId); if (decryptIdOptional.isEmpty()) { log.info("Encrypted Payment ID: [{}]. Get PSU data list by payment ID failed, couldn't decrypt consent id", encryptedPaymentId); return CmsResponse.<List<PsuIdData>>builder() .error(TECHNICAL_ERROR) .build(); } return pisCommonPaymentService.getPsuDataListByPaymentId(decryptIdOptional.get()); }  @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 getPsuDataListByPaymentId_success() { List<PsuIdData> expected = buildPsuIdDataList(); when(securityDataService.decryptId(ENCRYPTED_PAYMENT_ID)).thenReturn(Optional.of(DECRYPTED_PAYMENT_ID)); when(pisCommonPaymentService.getPsuDataListByPaymentId(DECRYPTED_PAYMENT_ID)) .thenReturn(CmsResponse.<List<PsuIdData>>builder() .payload(buildPsuIdDataList()) .build()); CmsResponse<List<PsuIdData>> actual = pisCommonPaymentServiceInternalEncrypted.getPsuDataListByPaymentId(ENCRYPTED_PAYMENT_ID); assertTrue(actual.isSuccessful()); assertEquals(expected, actual.getPayload()); verify(pisCommonPaymentService, times(1)).getPsuDataListByPaymentId(DECRYPTED_PAYMENT_ID); }
@Test void getPsuDataListByPaymentId_technicalError() { when(securityDataService.decryptId(ENCRYPTED_PAYMENT_ID)).thenReturn(Optional.empty()); CmsResponse<List<PsuIdData>> actual = pisCommonPaymentServiceInternalEncrypted.getPsuDataListByPaymentId(ENCRYPTED_PAYMENT_ID); assertTrue(actual.hasError()); assertEquals(CmsError.TECHNICAL_ERROR, actual.getError()); }