GcsFileSystemRegistrar implements FileSystemRegistrar { @Override public Iterable<FileSystem<?>> fromOptions(@Nonnull PipelineOptions options) { checkNotNull(options, "Expect the runner have called FileSystems.setDefaultPipelineOptions()."); return ImmutableList.of(new GcsFileSystem(options.as(GcsOptions.class))); }  @Override Iterable<FileSystem<?>> fromOptions(@Nonnull PipelineOptions options);  }
@Test public void testServiceLoader() { for (FileSystemRegistrar registrar : Lists.newArrayList(ServiceLoader.load(FileSystemRegistrar.class).iterator())) { if (registrar instanceof GcsFileSystemRegistrar) { Iterable<FileSystem<?>> fileSystems = registrar.fromOptions(PipelineOptionsFactory.create()); assertThat(fileSystems, contains(instanceOf(GcsFileSystem.class))); return; } } fail("Expected to find " + GcsFileSystemRegistrar.class); }