DefaultIndexHandler implements IndexHandler<K, V> { @SuppressWarnings("unchecked") public List<K> execute(final Query query) { List<Object> results = execute(query.getCriteria()); return (List<K>) results; } DefaultIndexHandler(); void addIndex(final String attributeName, final IndexType type); void add(final K key, final V value); void remove(final K key, final V value); void clear(); @SuppressWarnings("unchecked") List<K> execute(final Query query);  }
@Test public void execute() { doReturn(criteria).when(query).getCriteria(); doReturn(new ArrayList<Object>()).when(handler).execute(criteria); handler.execute(query); verify(handler).execute(criteria); }