### Question:
AcmMailTemplateConfigurationServiceAPIController { @RequestMapping(method = RequestMethod.PUT, consumes = { "multipart/mixed", MediaType.MULTIPART_FORM_DATA_VALUE }) public ResponseEntity<?> updateEmailTemplate(@RequestPart("data") EmailTemplateConfiguration templateConfiguration, @RequestPart(value = "file", required = false) MultipartFile template) throws AcmEmailConfigurationException { mailService.updateEmailTemplate(templateConfiguration, template); return new ResponseEntity<>(HttpStatus.OK); }  @RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE }) @ResponseBody List<EmailTemplateConfiguration> getTemplateConfigurations(); @RequestMapping(method = RequestMethod.PUT, consumes = { "multipart/mixed", MediaType.MULTIPART_FORM_DATA_VALUE }) ResponseEntity<?> updateEmailTemplate(@RequestPart("data") EmailTemplateConfiguration templateConfiguration,
            @RequestPart(value = "file", required = false) MultipartFile template); @RequestMapping(path = "/validate", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody EmailTemplateValidationResponse validateEmailTemplate(@RequestBody EmailTemplateConfiguration templateConfiguration); @RequestMapping(path = "/{templateName:.+}", method = RequestMethod.DELETE) ResponseEntity<?> deleteEmailTemplate(@PathVariable(value = "templateName") String templateName); @RequestMapping(path = "/{templateName:.+}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody Map<String, String> getEmailTemplate(@PathVariable(value = "templateName") String templateName); @ExceptionHandler(AcmEmailConfigurationException.class) @ResponseBody ResponseEntity<?> handleConfigurationException(AcmEmailServiceException ce); void setMailService(AcmMailTemplateConfigurationService mailService);  }### Answer:
@Test public void testUpdateEmailTemplate() throws Exception { EmailTemplateConfiguration configuration = setupConfiguration(EMAIL_PATTERN, Arrays.asList(CASE_FILE, COMPLAINT), EmailSource.MANUAL, TEMPLATE_NAME, Arrays.asList(SEND_AS_ATTACHMENTS, SEND_AS_LINKS)); ObjectMapper objectMapper = new ObjectMapper(); String content = objectMapper.writeValueAsString(configuration); MockMultipartFile templateConfiguration = new MockMultipartFile("data", "", MediaType.APPLICATION_JSON_VALUE, content.getBytes("UTF-8")); MockMultipartFile template = new MockMultipartFile("file", "", MediaType.TEXT_PLAIN_VALUE, "template".getBytes("UTF-8")); MockMultipartHttpServletRequestBuilder builder = MockMvcRequestBuilders.fileUpload(CONTROLLER_PATH); builder.with(new RequestPostProcessor() { @Override public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) { request.setMethod("PUT"); return request; } }); MvcResult result = mockMvc.perform(builder.file(templateConfiguration).file(template)).andReturn(); assertEquals(HttpStatus.OK.value(), result.getResponse().getStatus()); ArgumentCaptor<EmailTemplateConfiguration> configurationCaptor = ArgumentCaptor.forClass(EmailTemplateConfiguration.class); ArgumentCaptor<MultipartFile> templateCaptor = ArgumentCaptor.forClass(MultipartFile.class); verify(mailService).updateEmailTemplate(configurationCaptor.capture(), templateCaptor.capture()); EmailTemplateConfiguration configurationCaptured = configurationCaptor.getValue(); assertEquals(configuration.getEmailPattern(), configurationCaptured.getEmailPattern()); assertThat(configurationCaptured.getSource(), is(EmailSource.MANUAL)); assertThat(configurationCaptured.getTemplateName(), is(TEMPLATE_NAME)); assertThat(configurationCaptured.getObjectTypes().size(), is(2)); assertThat(configurationCaptured.getObjectTypes().contains(CASE_FILE), is(true)); assertThat(configurationCaptured.getObjectTypes().contains(COMPLAINT), is(true)); assertThat(configurationCaptured.getActions().size(), is(2)); assertThat(configurationCaptured.getActions().contains(SEND_AS_ATTACHMENTS), is(true)); assertThat(configurationCaptured.getActions().contains(SEND_AS_LINKS), is(true)); MultipartFile templateCaptured = templateCaptor.getValue(); assertThat(templateCaptured.getContentType(), is(MediaType.TEXT_PLAIN_VALUE)); assertEquals("template", new String(templateCaptured.getBytes())); }