FileTypeRestController { @RequestMapping(value = "/fileTypes", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_FILE_TYPES_POST) public FileType createFileType(@RequestBody FileTypeCreateRequest request) { return fileTypeService.createFileType(request); }  @RequestMapping(value = "/fileTypes", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_FILE_TYPES_POST) FileType createFileType(@RequestBody FileTypeCreateRequest request); @RequestMapping(value = "/fileTypes/{fileTypeCode}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_FILE_TYPES_GET) FileType getFileType(@PathVariable("fileTypeCode") String fileTypeCode); @RequestMapping(value = "/fileTypes/{fileTypeCode}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_FILE_TYPES_DELETE) FileType deleteFileType(@PathVariable("fileTypeCode") String fileTypeCode); @RequestMapping(value = "/fileTypes", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_FILE_TYPES_ALL_GET) FileTypeKeys getFileTypes();  }
@Test public void testCreateFileType() throws Exception { FileTypeCreateRequest fileTypeCreateRequest = new FileTypeCreateRequest(FORMAT_FILE_TYPE_CODE); FileType fileType = new FileType(FORMAT_FILE_TYPE_CODE); when(fileTypeService.createFileType(fileTypeCreateRequest)).thenReturn(fileType); FileType resultFileType = fileTypeRestController.createFileType(new FileTypeCreateRequest(FORMAT_FILE_TYPE_CODE)); assertEquals(new FileType(FORMAT_FILE_TYPE_CODE), resultFileType); verify(fileTypeService).createFileType(fileTypeCreateRequest); verifyNoMoreInteractions(fileTypeService); assertEquals(fileType, resultFileType); }