@Test public void testEmptyRules() throws Exception { when(store.fetchCached()).thenReturn(Collections.emptyMap()); final List<Map<String, Object>> actual = fetcher.get(environment); verify(store).fetchCached(); assertThat(actual).isNotNull(); assertThat(actual).isEmpty(); }
@Override public List<Map<String, Object>> get(DataFetchingEnvironment environment) { final Map<String, Rule> data = store.fetchCached(); return data.entrySet().stream() .map(e -> ImmutableMap.of("category", e.getKey(), "rule", e.getValue())) .collect(Collectors.toList()); }
RuleDataFetcher implements DataFetcher<List<Map<String, Object>>> { @Override public List<Map<String, Object>> get(DataFetchingEnvironment environment) { final Map<String, Rule> data = store.fetchCached(); return data.entrySet().stream() .map(e -> ImmutableMap.of("category", e.getKey(), "rule", e.getValue())) .collect(Collectors.toList()); } }
RuleDataFetcher implements DataFetcher<List<Map<String, Object>>> { @Override public List<Map<String, Object>> get(DataFetchingEnvironment environment) { final Map<String, Rule> data = store.fetchCached(); return data.entrySet().stream() .map(e -> ImmutableMap.of("category", e.getKey(), "rule", e.getValue())) .collect(Collectors.toList()); } RuleDataFetcher(final RuleStore store); }
RuleDataFetcher implements DataFetcher<List<Map<String, Object>>> { @Override public List<Map<String, Object>> get(DataFetchingEnvironment environment) { final Map<String, Rule> data = store.fetchCached(); return data.entrySet().stream() .map(e -> ImmutableMap.of("category", e.getKey(), "rule", e.getValue())) .collect(Collectors.toList()); } RuleDataFetcher(final RuleStore store); @Override List<Map<String, Object>> get(DataFetchingEnvironment environment); }
RuleDataFetcher implements DataFetcher<List<Map<String, Object>>> { @Override public List<Map<String, Object>> get(DataFetchingEnvironment environment) { final Map<String, Rule> data = store.fetchCached(); return data.entrySet().stream() .map(e -> ImmutableMap.of("category", e.getKey(), "rule", e.getValue())) .collect(Collectors.toList()); } RuleDataFetcher(final RuleStore store); @Override List<Map<String, Object>> get(DataFetchingEnvironment environment);  }