### Question:
EmailMessageController { @PutMapping() public ResponseEntity<?> updateMessageController(@RequestBody EmailMessageUpdateRequest emailMessageUpdateRequest) { EmailMessageResponse response = emailMessageOperations.updateMessage(emailMessageUpdateRequest); return new ResponseEntity<>(response, response.getHttpStatus()); } EmailMessageController(EmailMessageOperations emailMessageOperations); @GetMapping() ResponseEntity<?> getMessageByStatusController(@RequestParam(required = true) String status); @PutMapping() ResponseEntity<?> updateMessageController(@RequestBody EmailMessageUpdateRequest emailMessageUpdateRequest);  }### Answer:
@Test public void updateMessageController() throws Exception { EmailMessageUpdateRequest request = new EmailMessageUpdateRequest(); request.setStatus("COMPLETED"); request.setEmailMessage("EMAIL MESSAGE RESPONSE"); String inputJson = requestAsJsonString(request); EmailMessage emailMessage = new EmailMessage(Status.fromValue("COMPLETED"), "EMAIL MESSAGE RESPONSE"); EmailMessageResponse expectedResponse = new EmailMessageResponse(emailMessage); Mockito.when(operations.updateMessage(any())).thenReturn(expectedResponse); String jsonString = mockMvc.perform( MockMvcRequestBuilders.put("/api/message") .contentType(MediaType.APPLICATION_JSON) .content(inputJson) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isAccepted()) .andReturn().getResponse().getContentAsString(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); EmailMessageResponse actualResponse = mapper.readValue(jsonString, new TypeReference<EmailMessageResponse>() { }); verify(operations, times(1)).updateMessage(any()); assertEquals(actualResponse, expectedResponse); }