### Question:
Xs2aPisCommonPaymentService { public Optional<PisCommonPaymentResponse> getPisCommonPaymentById(String paymentId) { CmsResponse<PisCommonPaymentResponse> response = pisCommonPaymentServiceEncrypted.getCommonPaymentById(paymentId); if (response.hasError()) { return Optional.empty(); } return Optional.ofNullable(response.getPayload()); }  CreatePisCommonPaymentResponse createCommonPayment(PisPaymentInfo request); Optional<PisCommonPaymentResponse> getPisCommonPaymentById(String paymentId); boolean updateMultilevelSca(String paymentId, boolean multilevelScaRequired);  }### Answer:
@Test void getPisCommonPaymentById_success() { when(pisCommonPaymentServiceEncrypted.getCommonPaymentById(PAYMENT_ID)) .thenReturn(CmsResponse.<PisCommonPaymentResponse>builder().payload(PIS_COMMON_PAYMENT_RESPONSE).build()); Optional<PisCommonPaymentResponse> actualResponse = xs2aPisCommonPaymentService.getPisCommonPaymentById(PAYMENT_ID); assertThat(actualResponse.isPresent()).isTrue(); assertThat(actualResponse.get()).isEqualTo(PIS_COMMON_PAYMENT_RESPONSE); }
@Test void getPisCommonPaymentById_failed() { when(pisCommonPaymentServiceEncrypted.getCommonPaymentById(PAYMENT_ID)) .thenReturn(CmsResponse.<PisCommonPaymentResponse>builder().error(CmsError.TECHNICAL_ERROR).build()); Optional<PisCommonPaymentResponse> actualResponse = xs2aPisCommonPaymentService.getPisCommonPaymentById(PAYMENT_ID); assertThat(actualResponse.isPresent()).isFalse(); }