FileSystemStorageService implements StorageService { @Override public boolean objectExists(AbsoluteLocation location) { boolean exists = Files.exists(resolve(location.location().getRawPath(), false)); log.debug("Exists {}: {}", location.location(), exists); return exists; } FileSystemStorageService(Path dir); @SneakyThrows @Override Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation path); @SneakyThrows @Override InputStream read(AbsoluteLocation path); @SneakyThrows @Override OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback); @SneakyThrows @Override void remove(AbsoluteLocation location); @Override boolean objectExists(AbsoluteLocation location);  }
@Test void objectExists() { createFileWithMessage(); try (Stream<AbsoluteLocation<ResolvedResource>> ls = storageService.list(root)) { assertThat(storageService.objectExists(ls.findFirst().get())).isTrue(); } }