### Question:
UpdateFileTypeAPIController { @RequestMapping(value = "/file/bulk/type/{fileType}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public List<EcmFile> bulkUpdateFileType(@RequestBody List<Long> fileIds, @PathVariable("fileType") String fileType, Authentication authentication, HttpSession session) { log.debug("Updating file type to '{}' for multiple files.", fileType); List<EcmFile> files = new ArrayList<>(); if (fileIds != null) { files = fileIds.stream().map(fileId -> updateFileType(fileId, fileType)).filter(file -> file != null) .collect(Collectors.toList()); } return files; }  @PreAuthorize("hasPermission(#fileId, 'FILE', 'write|group-write')") @RequestMapping(value = "/file/{fileId}/type/{fileType}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody EcmFile updateFileType(@PathVariable("fileId") Long fileId, @PathVariable("fileType") String fileType,
            Authentication authentication, HttpSession session); @RequestMapping(value = "/file/bulk/type/{fileType}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List<EcmFile> bulkUpdateFileType(@RequestBody List<Long> fileIds, @PathVariable("fileType") String fileType,
            Authentication authentication, HttpSession session); EcmFileService getEcmFileService(); void setEcmFileService(EcmFileService ecmFileService);  }### Answer:
@Test public void bulkUpdateFileType() throws Exception { EcmFile file1 = new EcmFile(); file1.setFileId(100L); file1.setFileType("file_type"); EcmFile file2 = new EcmFile(); file2.setFileId(101L); file2.setFileType("file_type"); ObjectMapper objectMapper = new ObjectMapper(); String content = objectMapper.writeValueAsString(Arrays.asList(100, 101)); String newFileType = "new_file_type"; Capture<EcmFile> saved1 = EasyMock.newCapture(); Capture<EcmFile> saved2 = EasyMock.newCapture(); expect(mockAuthentication.getName()).andReturn("user"); expect(mockEcmFileDao.find(file1.getId())).andReturn(file1); expect(mockEcmFileDao.find(file2.getId())).andReturn(file2); expect(mockEcmFileDao.save(capture(saved1))).andReturn(file1); expect(mockEcmFileDao.save(capture(saved2))).andReturn(file2); replayAll(); MvcResult result = mockMvc.perform( post("/api/latest/service/ecm/file/bulk/type/{fileType}", newFileType) .principal(mockAuthentication) .contentType(MediaType.APPLICATION_JSON) .content(content)) .andReturn(); verifyAll(); LOG.info("Results: {}", result.getResponse().getContentAsString()); List<EcmFile> resultList = objectMapper.readValue(result.getResponse().getContentAsString(), new TypeReference<ArrayList<EcmFile>>() { }); assertEquals(HttpStatus.OK.value(), result.getResponse().getStatus()); assertNotNull(resultList); assertTrue(resultList.size() == 2); assertEquals(newFileType, saved1.getValue().getFileType()); assertEquals(newFileType, saved2.getValue().getFileType()); assertEquals(newFileType, resultList.get(0).getFileType()); assertEquals(newFileType, resultList.get(1).getFileType()); }