use of org.dataloader.stats.NoOpStatisticsCollector in project spring-graphql by spring-projects.
the class DefaultBatchLoaderRegistryTests method batchLoaderWithCustomNameAndOptions.
@Test
void batchLoaderWithCustomNameAndOptions() {
String name = "myLoader";
StatisticsCollector collector = new NoOpStatisticsCollector();
this.batchLoaderRegistry.forName(name).withOptions(options -> options.setStatisticsCollector(() -> collector)).registerBatchLoader((keys, environment) -> Flux.empty());
this.batchLoaderRegistry.registerDataLoaders(this.dataLoaderRegistry, GraphQLContext.newContext().build());
Map<String, DataLoader<?, ?>> map = dataLoaderRegistry.getDataLoadersMap();
assertThat(map).hasSize(1).containsKey(name);
assertThat(map.get(name).getStatistics()).isSameAs(collector.getStatistics());
}
Aggregations