### Question:
CmsAspspPisTransactionController implements CmsAspspPisTransactionApi { @Override public ResponseEntity<Void> updatePaymentStatus(String paymentId, String status, String instanceId) { TransactionStatus transactionStatus; try { transactionStatus = TransactionStatus.valueOf(status); } catch (IllegalArgumentException illegalArgumentException) { return ResponseEntity.badRequest().build(); } return aspspPaymentService.updatePaymentStatus(paymentId, transactionStatus, instanceId) ? ResponseEntity.ok().build() : ResponseEntity.badRequest().build(); }  @Override ResponseEntity<Void> updatePaymentStatus(String paymentId, String status, String instanceId);  }### Answer:
@Test void updatePaymentStatus() throws Exception { when(aspspPaymentService.updatePaymentStatus(PAYMENT_ID, TRANSACTION_STATUS, INSTANCE_ID)).thenReturn(true); mockMvc.perform(put(UPDATE_PAYMENT_STATUS_URL, TRANSACTION_STATUS_NAME) .contentType(MediaType.APPLICATION_JSON_VALUE) .headers(httpHeaders)) .andExpect(status().is(HttpStatus.OK.value())); verify(aspspPaymentService).updatePaymentStatus(PAYMENT_ID, TRANSACTION_STATUS, INSTANCE_ID); }
@Test void updatePaymentStatus_serviceError() throws Exception { when(aspspPaymentService.updatePaymentStatus(PAYMENT_ID, TRANSACTION_STATUS, INSTANCE_ID)).thenReturn(false); mockMvc.perform(put(UPDATE_PAYMENT_STATUS_URL, TRANSACTION_STATUS_NAME) .contentType(MediaType.APPLICATION_JSON_VALUE) .headers(httpHeaders)) .andExpect(status().is(HttpStatus.BAD_REQUEST.value())); verify(aspspPaymentService).updatePaymentStatus(PAYMENT_ID, TRANSACTION_STATUS, INSTANCE_ID); }
@Test void updatePaymentStatus_wrongStatus() throws Exception { String invalidStatusName = "invalidStatus"; mockMvc.perform(put(UPDATE_PAYMENT_STATUS_URL, invalidStatusName) .contentType(MediaType.APPLICATION_JSON_VALUE) .headers(httpHeaders)) .andExpect(status().is(HttpStatus.BAD_REQUEST.value())); verify(aspspPaymentService, never()).updatePaymentStatus(any(), any(), any()); }