### Question:
CmsPsuPisController implements CmsPsuPisApi { @Override public ResponseEntity<Void> updatePaymentStatus(String paymentId, String status, String instanceId) { return cmsPsuPisService.updatePaymentStatus(paymentId, TransactionStatus.valueOf(status), instanceId) ? ResponseEntity.ok().build() : ResponseEntity.badRequest().build(); }  @Override ResponseEntity<Object> updatePsuInPayment(String authorisationId, String instanceId, PsuIdData psuIdData); @Override ResponseEntity<Object> getPaymentIdByRedirectId(String redirectId, String instanceId); @Override ResponseEntity<CmsPayment> getPaymentByPaymentId(String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String paymentId, String instanceId); @Override ResponseEntity<Object> getPaymentIdByRedirectIdForCancellation(String redirectId, String instanceId); @Override ResponseEntity<CmsPayment> getPaymentByPaymentIdForCancellation(String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String paymentId, String instanceId); @Override ResponseEntity<CmsPsuAuthorisation> getAuthorisationByAuthorisationId(String authorisationId, String instanceId); @Override ResponseEntity<Object> updateAuthorisationStatus(String psuId, String psuIdType, String psuCorporateId, String psuCorporateIdType, String paymentId, String authorisationId, String status, String instanceId, AuthenticationDataHolder authenticationDataHolder); @Override ResponseEntity<Void> updatePaymentStatus(String paymentId, String status, String instanceId); @Override ResponseEntity<List<CmsPisPsuDataAuthorisation>> psuAuthorisationStatuses(String paymentId, String instanceId);  }### Answer:
@Test void updatePaymentStatus_withValidRequest_shouldReturnOk() throws Exception { TransactionStatus transactionStatus = TransactionStatus.ACCP; when(cmsPsuPisService.updatePaymentStatus(PAYMENT_ID, transactionStatus, INSTANCE_ID)) .thenReturn(true); String transactionStatusString = transactionStatus.name(); mockMvc.perform(put("/psu-api/v1/payment/{payment-id}/status/{status}", PAYMENT_ID, transactionStatusString) .headers(INSTANCE_ID_HEADERS)) .andExpect(status().isOk()) .andExpect(content().bytes(EMPTY_BODY)); verify(cmsPsuPisService).updatePaymentStatus(PAYMENT_ID, transactionStatus, INSTANCE_ID); }
@Test void updatePaymentStatus_withFalseServiceResponse_shouldReturnBadRequest() throws Exception { TransactionStatus transactionStatus = TransactionStatus.ACCP; when(cmsPsuPisService.updatePaymentStatus(PAYMENT_ID, transactionStatus, INSTANCE_ID)) .thenReturn(false); String transactionStatusString = transactionStatus.name(); mockMvc.perform(put("/psu-api/v1/payment/{payment-id}/status/{status}", PAYMENT_ID, transactionStatusString) .headers(INSTANCE_ID_HEADERS)) .andExpect(status().isBadRequest()) .andExpect(content().bytes(EMPTY_BODY)); verify(cmsPsuPisService).updatePaymentStatus(PAYMENT_ID, transactionStatus, INSTANCE_ID); }