### Question:
PisCommonPaymentController implements PisCommonPaymentApi { @Override public ResponseEntity<CreatePisCommonPaymentResponse> createCommonPayment(PisPaymentInfo request) { CmsResponse<CreatePisCommonPaymentResponse> response = pisCommonPaymentServiceEncrypted.createCommonPayment(request); if (response.hasError()) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(response.getPayload(), HttpStatus.CREATED); }  @Override ResponseEntity<CreatePisCommonPaymentResponse> createCommonPayment(PisPaymentInfo request); @Override ResponseEntity<PisCommonPaymentDataStatusResponse> getPisCommonPaymentStatusById(String paymentId); @Override ResponseEntity<PisCommonPaymentResponse> getCommonPaymentById(String paymentId); @Override ResponseEntity<Void> updateCommonPaymentStatus(String paymentId, String status); @Override ResponseEntity<CreateAuthorisationResponse> createAuthorisation(String paymentId, CreateAuthorisationRequest request); @Override ResponseEntity<CreateAuthorisationResponse> createAuthorisationCancellation(String paymentId, CreateAuthorisationRequest request); @Override ResponseEntity<Authorisation> updateAuthorisation(String authorisationId, UpdateAuthorisationRequest request); @Override ResponseEntity<Void> updateAuthorisationStatus(String authorisationId, String authorisationStatus); @Override ResponseEntity<Authorisation> getAuthorisation(String authorisationId); @Override ResponseEntity<ScaStatus> getAuthorisationScaStatus(String paymentId, String authorisationId); @Override ResponseEntity<Authorisation> updateCancellationAuthorisation(String authorisationId, UpdateAuthorisationRequest request); @Override ResponseEntity<List<String>> getAuthorisationCancellation(String authorisationId); @Override ResponseEntity<List<String>> getAuthorisationsCancellation(String paymentId); @Override ResponseEntity<ScaStatus> getCancellationAuthorisationScaStatus(String paymentId, String authorisationId); @Override ResponseEntity<List<String>> getAuthorisations(String paymentId); @Override ResponseEntity<Boolean> isAuthenticationMethodDecoupled(String authorisationId, String authenticationMethodId); @Override ResponseEntity<Void> saveAuthenticationMethods(String authorisationId, List<CmsScaMethod> methods); @Override ResponseEntity<Boolean> updateScaApproach(String authorisationId, ScaApproach scaApproach); @Override ResponseEntity<AuthorisationScaApproachResponse> getAuthorisationScaApproach(String authorisationId); @Override ResponseEntity<AuthorisationScaApproachResponse> getCancellationAuthorisationScaApproach(String authorisationId); @Override ResponseEntity<Boolean> updateMultilevelScaRequired(String paymentId, boolean multilevelSca);  }### Answer:
@Test void createCommonPayment_Success() { ResponseEntity<CreatePisCommonPaymentResponse> expected = new ResponseEntity<>(new CreatePisCommonPaymentResponse(PAYMENT_ID, null), HttpStatus.CREATED); when(pisCommonPaymentService.createCommonPayment(getPisPaymentInfo())) .thenReturn(CmsResponse.<CreatePisCommonPaymentResponse>builder().payload(getCreatePisCommonPaymentResponse()).build()); ResponseEntity<CreatePisCommonPaymentResponse> actual = pisCommonPaymentController.createCommonPayment(getPisPaymentInfo()); assertEquals(expected, actual); }
@Test void createCommonPayment_Failure() { when(pisCommonPaymentService.createCommonPayment(getPisPaymentInfo())) .thenReturn(CmsResponse.<CreatePisCommonPaymentResponse>builder().error(CmsError.TECHNICAL_ERROR).build()); ResponseEntity<CreatePisCommonPaymentResponse> expected = new ResponseEntity<>(HttpStatus.BAD_REQUEST); ResponseEntity<CreatePisCommonPaymentResponse> actual = pisCommonPaymentController.createCommonPayment(getPisPaymentInfo()); assertEquals(expected, actual); }