@Test @SuppressWarnings("unchecked") public void filter() { Item item = new Item(2); List<Item> items = new ArrayList<Item>(); items.add(item); CollectionItem<Item> collectionItem = new CollectionItem<Item>(items); doReturn(items).when(filter).filter(anyList()); Collection<Item> filteredItems = collectionItem.filter(filter); assertTrue(filteredItems.contains(item)); }
@SuppressWarnings("unchecked") public Collection<V> filter(Filter filter) { List<Object> filteredObjects = filter.filter((List<Object>) objects); return (Collection<V>) filteredObjects; }
CollectionItem implements CacheItem<Collection<V>> { @SuppressWarnings("unchecked") public Collection<V> filter(Filter filter) { List<Object> filteredObjects = filter.filter((List<Object>) objects); return (Collection<V>) filteredObjects; } }
CollectionItem implements CacheItem<Collection<V>> { @SuppressWarnings("unchecked") public Collection<V> filter(Filter filter) { List<Object> filteredObjects = filter.filter((List<Object>) objects); return (Collection<V>) filteredObjects; } CollectionItem(Collection<? extends V> objects); }
CollectionItem implements CacheItem<Collection<V>> { @SuppressWarnings("unchecked") public Collection<V> filter(Filter filter) { List<Object> filteredObjects = filter.filter((List<Object>) objects); return (Collection<V>) filteredObjects; } CollectionItem(Collection<? extends V> objects); @SuppressWarnings("unchecked") Collection<V> getValue(); @SuppressWarnings("unchecked") Collection<V> filter(Filter filter); }
CollectionItem implements CacheItem<Collection<V>> { @SuppressWarnings("unchecked") public Collection<V> filter(Filter filter) { List<Object> filteredObjects = filter.filter((List<Object>) objects); return (Collection<V>) filteredObjects; } CollectionItem(Collection<? extends V> objects); @SuppressWarnings("unchecked") Collection<V> getValue(); @SuppressWarnings("unchecked") Collection<V> filter(Filter filter);  }