test_class.declarator: criteria
test_class.modifier: @Mock
test_class.original_string: @Mock
    Criteria criteria;
test_class.type: Criteria
test_class.var_name: criteria
test_class.declarator: filter
test_class.modifier: @Mock
test_class.original_string: @Mock
    Filter filter;
test_class.type: Filter
test_class.var_name: filter
test_class.declarator: indexHandler
test_class.modifier: @Mock
test_class.original_string: @Mock
    IndexHandler<Integer, Item> indexHandler;
test_class.type: IndexHandler<Integer, Item>
test_class.var_name: indexHandler
test_class.file: imcache-core/src/test/java/com/cetsoft/imcache/cache/AbstractSearchableCacheTest.java
test_class.identifier: AbstractSearchableCacheTest
test_case.body: @Test
    @SuppressWarnings("unchecked")
    public void execute() {
      AbstractSearchableCache<Integer, Item> abstractCache = new AbstractSearchableCache<Integer, Item>(
          "searchable-cache",
          key -> null, (key, value) -> {
      }, indexHandler) {
        final Map<Integer, Item> items = new HashMap<>();
  
        @Override
        public void put(Integer key, Item value) {
          items.put(key, value);
          indexHandler.add(key, value);
        }
  
        @Override
        public void put(Integer key, Item value, TimeUnit timeUnit, long duration) {
          items.put(key, value);
          indexHandler.add(key, value);
        }
  
        @Override
        public Item get(Integer key) {
          return null;
        }
  
        @Override
        public Item invalidate(Integer key) {
          final Item value = items.remove(key);
          indexHandler.remove(key, value);
          return null;
        }
  
        @Override
        public boolean contains(Integer key) {
          return false;
        }
  
        @Override
        public void clear() {
  
        }
  
        @Override
        public long size() {
          return 0;
        }
  
        @Override
        public CacheStats stats() {
          return null;
        }
      };
      Item item1 = new Item(1);
      Item item2 = new Item(2);
      abstractCache.put(1, item1);
      abstractCache.put(2, item1);
      List<Integer> keys = new ArrayList<Integer>();
      keys.add(1);
      keys.add(2);
      List<Item> values = new ArrayList<Item>();
      values.add(item1);
      values.add(item2);
      doReturn(keys).when(indexHandler).execute(any(Query.class));
      doReturn(values).when(filter).filter(anyList());
      List<Item> items = abstractCache
          .execute(CacheQuery.newQuery().setCriteria(criteria).setFilter(filter));
      assertTrue(items.contains(item1));
      assertTrue(items.contains(item2));
      abstractCache.setCacheLoader(key -> null);
      assertNull(abstractCache.getCacheLoader().load(1));
      assertEquals("searchable-cache", abstractCache.getName());
      abstractCache.setEvictionListener((key, value) -> {
      });
    }
test_case.class_method_signature: AbstractSearchableCacheTest.execute()
test_case.full_signature: @Test @SuppressWarnings("unchecked") public void execute()
test_case.identifier: execute
test_case.invocations: put add put add remove remove put put add add add add execute when doReturn any filter when doReturn anyList execute setFilter setCriteria newQuery assertTrue contains assertTrue contains setCacheLoader assertNull load getCacheLoader assertEquals getName setEvictionListener
test_case.modifiers: @Test @SuppressWarnings("unchecked") public
test_case.parameters: ()
test_case.return: void
test_case.signature: void execute()
focal_class.declarator: indexHandler
focal_class.modifier: protected
focal_class.original_string: protected IndexHandler<K, V> indexHandler;
focal_class.type: IndexHandler<K, V>
focal_class.var_name: indexHandler
focal_class.file: imcache-core/src/main/java/com/cetsoft/imcache/cache/AbstractSearchableCache.java
focal_class.identifier: AbstractSearchableCache
focal_class.interfaces: implements
      SearchableCache<K, V>
focal_class.class_method_signature: AbstractSearchableCache.AbstractSearchableCache(final String name, final CacheLoader<K, V> cacheLoader,
        final EvictionListener<K, V> evictionListener,
        IndexHandler<K, V> indexHandler)
focal_class.full_signature: public  AbstractSearchableCache(final String name, final CacheLoader<K, V> cacheLoader,
        final EvictionListener<K, V> evictionListener,
        IndexHandler<K, V> indexHandler)
focal_class.identifier: AbstractSearchableCache
focal_class.modifiers: public
focal_class.parameters: (final String name, final CacheLoader<K, V> cacheLoader,
        final EvictionListener<K, V> evictionListener,
        IndexHandler<K, V> indexHandler)
focal_class.signature:  AbstractSearchableCache(final String name, final CacheLoader<K, V> cacheLoader,
        final EvictionListener<K, V> evictionListener,
        IndexHandler<K, V> indexHandler)
focal_class.class_method_signature: AbstractSearchableCache.execute(Query query)
focal_class.full_signature: @SuppressWarnings("unchecked") public List<V> execute(Query query)
focal_class.identifier: execute
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (Query query)
focal_class.return: List<V>
focal_class.signature: List<V> execute(Query query)
focal_class.superclass: extends AbstractCache<K, V>
focal_method.body: @SuppressWarnings("unchecked")
    public List<V> execute(Query query) {
      List<K> keys = indexHandler.execute(query);
      List<V> values = new ArrayList<V>(keys.size());
      for (K key : keys) {
        V value = get(key);
        if (value != null) {
          values.add(value);
        }
      }
      if (query.getFilter() != null) {
        values = (List<V>) query.getFilter().filter((List<Object>) values);
      }
      return values;
    }
focal_method.class_method_signature: AbstractSearchableCache.execute(Query query)
focal_method.full_signature: @SuppressWarnings("unchecked") public List<V> execute(Query query)
focal_method.identifier: execute
focal_method.invocations: execute size get add getFilter filter getFilter
focal_method.modifiers: @SuppressWarnings("unchecked") public
focal_method.parameters: (Query query)
focal_method.return: List<V>
focal_method.signature: List<V> execute(Query query)