### Question:
VocabularyNeo4jImpl implements Vocabulary { @Override public Set<String> getAllCategories() { return Suppliers.memoize(new Supplier<Set<String>>() { @Override public Set<String> get() { Result result = graph.execute("START n = node(*) WHERE exists(n.category) RETURN distinct(n.category)"); Set<String> categories = new HashSet<>(); while (result.hasNext()) { Map<String, Object> col = result.next(); Object category = col.get("(n.category)"); if (category.getClass().isArray()) { for (String cat : (String[]) category) { categories.add(cat); } } else { categories.add((String) col.get("(n.category)")); } } return categories; } }).get(); } @Inject  VocabularyNeo4jImpl(GraphDatabaseService graph,
      @Nullable @IndicatesNeo4jGraphLocation String neo4jLocation, CurieUtil curieUtil,
      NodeTransformer transformer); @Override Optional<Concept> getConceptFromId(Query query); @Override List<Concept> getConceptsFromPrefix(Query query); @Override List<Concept> searchConcepts(Query query); @Override List<Concept> getConceptsFromTerm(Query query); @Override Set<String> getAllCategories(); @Override Set<String> getAllCuriePrefixes(); @Override List<String> getSuggestions(String query);  }### Answer:
@Test public void testGetAllCategories() { Set<String> categories = vocabulary.getAllCategories(); assertThat(categories, hasItems("foo", "fizz", "baz")); }