@Test public void testLoadFileWhichDoesNotExist(TestContext context) { Async async = context.async(); UUID id = UUID.randomUUID(); fileSystem.load(id).subscribe(onNext -> { context.fail(); }, error -> { context.assertTrue(error instanceof IllegalArgumentException); async.complete(); }); }
@Override public Single<File> load(UUID id) { String path = baseDir + "/" + Objects.requireNonNull(id); File file = new File(path); if (!file.exists()) { return Single.error(new IllegalArgumentException("File not found with fileId " + id)); } return Single.just(file); }
MountedFileSystem implements SharedFileSystem { @Override public Single<File> load(UUID id) { String path = baseDir + "/" + Objects.requireNonNull(id); File file = new File(path); if (!file.exists()) { return Single.error(new IllegalArgumentException("File not found with fileId " + id)); } return Single.just(file); } }
MountedFileSystem implements SharedFileSystem { @Override public Single<File> load(UUID id) { String path = baseDir + "/" + Objects.requireNonNull(id); File file = new File(path); if (!file.exists()) { return Single.error(new IllegalArgumentException("File not found with fileId " + id)); } return Single.just(file); } @Inject  MountedFileSystem(@Named("mountedDir") String baseDir, Vertx vertx); }
MountedFileSystem implements SharedFileSystem { @Override public Single<File> load(UUID id) { String path = baseDir + "/" + Objects.requireNonNull(id); File file = new File(path); if (!file.exists()) { return Single.error(new IllegalArgumentException("File not found with fileId " + id)); } return Single.just(file); } @Inject  MountedFileSystem(@Named("mountedDir") String baseDir, Vertx vertx); @Override Single<File> load(UUID id); @Override Single<UUID> store(UUID id, Buffer buffer); @Override Single<UUID> delete(UUID id); }
MountedFileSystem implements SharedFileSystem { @Override public Single<File> load(UUID id) { String path = baseDir + "/" + Objects.requireNonNull(id); File file = new File(path); if (!file.exists()) { return Single.error(new IllegalArgumentException("File not found with fileId " + id)); } return Single.just(file); } @Inject  MountedFileSystem(@Named("mountedDir") String baseDir, Vertx vertx); @Override Single<File> load(UUID id); @Override Single<UUID> store(UUID id, Buffer buffer); @Override Single<UUID> delete(UUID id);  }