### Question:
QueryRegistrationCache { public void add(QueryDefinition queryDefinition, String resultName, QueryHandler queryHandler) { registrationsPerQuery.computeIfAbsent(queryDefinition, k -> new QueryInformation()) .addResultName(resultName) .addHandler(queryHandler); } @Autowired  QueryRegistrationCache(QueryHandlerSelector queryHandlerSelector,
                                  BiFunction<Map<String, MetaDataValue>, Set<ClientStreamIdentification>, Set<ClientStreamIdentification>> metaDataBasedNodeSelector);  QueryRegistrationCache(QueryHandlerSelector queryHandlerSelector); @EventListener void on(SubscriptionEvents.UnsubscribeQuery event); @EventListener void on(SubscriptionEvents.SubscribeQuery event); void remove(ClientStreamIdentification clientStreamIdentification); void remove(QueryDefinition queryDefinition, ClientStreamIdentification clientId); void add(QueryDefinition queryDefinition, String resultName,
                    QueryHandler queryHandler); Set<QueryHandler> find(String context, QueryRequest request); Collection<QueryHandler> findAll(String context, QueryRequest request); Map<QueryDefinition, Map<String, Set<QueryHandler<?>>>> getAll(); List<QueryRegistration> getForClient(ClientStreamIdentification client); QueryHandler find(String context, QueryRequest request, String clientStreamId); Set<ClientStreamIdentification> getClients(); Set<String> getResponseTypes(QueryDefinition key);  }### Answer:
@Test public void add() { queryRegistrationCache.add(new QueryDefinition(Topology.DEFAULT_CONTEXT, "test"), "test", new DirectQueryHandler(dummyStreamObserver, new ClientStreamIdentification(Topology.DEFAULT_CONTEXT, "client"), "component", "client")); Map<QueryDefinition, Map<String, Set<QueryHandler<?>>>> all = queryRegistrationCache.getAll(); assertEquals(1, all.size()); assertEquals(1, all.get(new QueryDefinition(Topology.DEFAULT_CONTEXT, "test")).size()); assertEquals(1, all.get(new QueryDefinition(Topology.DEFAULT_CONTEXT, "test")).get("component").size()); queryRegistrationCache.add(new QueryDefinition(Topology.DEFAULT_CONTEXT, "test"), "test", new DirectQueryHandler(dummyStreamObserver, new ClientStreamIdentification(Topology.DEFAULT_CONTEXT, "client3"), "component", "client3")); all = queryRegistrationCache.getAll(); assertEquals(2, all.get(new QueryDefinition(Topology.DEFAULT_CONTEXT, "test")).get("component").size()); }