### Question:
CoreTokenAdapter { public Collection<Token> query(final TokenFilter tokenFilter) throws CoreTokenException { debug("Query: queued with Filter: {0}", tokenFilter); ResultHandler<Collection<Token>, CoreTokenException> handler = handlerFactory.getQueryHandler(); dispatcher.query(tokenFilter, handler); try { Collection<Token> tokens = handler.getResults(); for (Token token : tokens) { reverseBlobStrategy(token); } debug("Query: returned {0} Tokens with Filter: {1}", tokens.size(), tokenFilter); return tokens; } catch (CoreTokenException e) { throw new QueryFailedException(tokenFilter, e); } } @Inject  CoreTokenAdapter(TokenBlobStrategy strategy, TaskDispatcher dispatcher, ResultHandlerFactory handlerFactory,
                            CTSReaperInit reaperInit, @Named(CoreTokenConstants.CTS_DEBUG) Debug debug); ResultHandler<Token, CoreTokenException> create(Token token); Token read(String tokenId); ResultHandler<Token, CoreTokenException> updateOrCreate(Token token); ResultHandler<String, CoreTokenException> delete(String tokenId); Collection<Token> query(final TokenFilter tokenFilter); Collection<PartialToken> attributeQuery(final TokenFilter filter); void deleteOnQuery(final TokenFilter filter);  }### Answer:
@Test public void shouldUseTaskQueueForQuery() throws CoreTokenException { Collection<Token> tokens = new ArrayList<Token>(); ResultHandler<Collection<Token>, CoreTokenException> mockResultHandler = mock(ResultHandler.class); given(mockResultHandler.getResults()).willReturn(tokens); given(mockResultHandlerFactory.getQueryHandler()).willReturn(mockResultHandler); TokenFilter filter = new TokenFilterBuilder().and().build(); adapter.query(filter); verify(mockTaskDispatcher).query(eq(filter), eq(mockResultHandler)); }