FileServer { boolean hasFile(String fileReference) { return hasFile(new FileReference(fileReference)); } @SuppressWarnings("WeakerAccess") // Created by dependency injection @Inject  FileServer(ConfigserverConfig configserverConfig);  FileServer(File rootDir); private  FileServer(ConnectionPool connectionPool, File rootDir); void serveFile(String fileReference, boolean downloadFromOtherSourceIfNotFound, Request request, Receiver receiver); FileDownloader downloader(); void close();  }
@Test public void requireThatExistingFileCanBeFound() throws IOException { File dir = getFileServerRootDir(); IOUtils.createDirectory(dir + "/123"); IOUtils.writeFile(dir + "/123/f1", "test", false); assertTrue(fileServer.hasFile("123")); }
@Test public void requireThatNonExistingFileCanNotBeFound() { assertFalse(fileServer.hasFile("12x")); }
@Test public void requireThatFileReferenceWithDirectoryCanBeFound() throws IOException { File dir = getFileServerRootDir(); IOUtils.writeFile(dir + "/124/subdir/f1", "test", false); IOUtils.writeFile(dir + "/124/subdir/f2", "test", false); assertTrue(fileServer.hasFile("124/subdir")); }