DiscoveryGenerator { public Result writeDiscovery(Iterable<ApiConfig> configs, DiscoveryContext context) { return writeDiscovery(configs, context, new SchemaRepository(typeLoader)); } DiscoveryGenerator(TypeLoader typeLoader); Result writeDiscovery(Iterable<ApiConfig> configs, DiscoveryContext context); Result writeDiscovery(
      Iterable<ApiConfig> configs, DiscoveryContext context, SchemaRepository schemaRepository);  }
@Test public void testWriteDiscovery_directory() throws Exception { DiscoveryGenerator.Result result = generator.writeDiscovery( ImmutableList.of( configLoader.loadConfiguration(ServiceContext.create(), ArrayEndpoint.class), configLoader.loadConfiguration(ServiceContext.create(), EnumEndpoint.class)), new DiscoveryContext()); assertThat(result.directory()).isEqualTo(readExpectedAsDirectory("directory.json")); }
@Test public void testWriteDiscovery_nonDiscoverableEndpoint() throws Exception { DiscoveryGenerator.Result result = generator.writeDiscovery( ImmutableList.of( configLoader.loadConfiguration(ServiceContext.create(), NonDiscoverableEndpoint.class)), new DiscoveryContext().setGenerateAll(false)); assertThat(result.discoveryDocs()).isEmpty(); assertThat(result.directory().getItems()).isEmpty(); }
@Test public void testDirectoryIsCloneable() throws Exception { ApiConfig config = configLoader.loadConfiguration(ServiceContext.create(), FooEndpoint.class); DiscoveryGenerator.Result result = generator.writeDiscovery(ImmutableList.of(config), context); result.directory().clone(); }