/** * Gets an existing file type by file type code. * * @param fileTypeCode the file type code * * @return the retrieved file type */ @RequestMapping(value = "/fileTypes/{fileTypeCode}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_FILE_TYPES_GET) public FileType getFileType(@PathVariable("fileTypeCode") String fileTypeCode) { return fileTypeService.getFileType(new FileTypeKey(fileTypeCode)); }
/** * Gets an existing file type by file type code. * * @param fileTypeCode the file type code * * @return the retrieved file type */ @RequestMapping(value = "/fileTypes/{fileTypeCode}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_FILE_TYPES_GET) public FileType getFileType(@PathVariable("fileTypeCode") String fileTypeCode) { return fileTypeService.getFileType(new FileTypeKey(fileTypeCode)); }
@Test public void testGetFileType() throws Exception { FileType fileType = new FileType(FORMAT_FILE_TYPE_CODE); when(fileTypeService.getFileType(new FileTypeKey(FORMAT_FILE_TYPE_CODE))).thenReturn(fileType); // Retrieve the file type. FileType resultFileType = fileTypeRestController.getFileType(FORMAT_FILE_TYPE_CODE); // Verify the external calls. verify(fileTypeService).getFileType(new FileTypeKey(FORMAT_FILE_TYPE_CODE)); verifyNoMoreInteractions(fileTypeService); // Validate the returned object. assertEquals(fileType, resultFileType); }