private static void assertDocIdSetCacheable(
     IndexReader reader, Filter filter, boolean shouldCacheable) throws IOException {
   assertTrue(reader.getContext() instanceof AtomicReaderContext);
   AtomicReaderContext context = (AtomicReaderContext) reader.getContext();
   final CachingWrapperFilter cacher = new CachingWrapperFilter(filter);
   final DocIdSet originalSet = filter.getDocIdSet(context, context.reader().getLiveDocs());
   final DocIdSet cachedSet = cacher.getDocIdSet(context, context.reader().getLiveDocs());
   if (originalSet == null) {
     assertNull(cachedSet);
   }
   if (cachedSet == null) {
     assertTrue(originalSet == null || originalSet.iterator() == null);
   } else {
     assertTrue(cachedSet.isCacheable());
     assertEquals(shouldCacheable, originalSet.isCacheable());
     // System.out.println("Original: "+originalSet.getClass().getName()+" -- cached:
     // "+cachedSet.getClass().getName());
     if (originalSet.isCacheable()) {
       assertEquals(
           "Cached DocIdSet must be of same class like uncached, if cacheable",
           originalSet.getClass(),
           cachedSet.getClass());
     } else {
       assertTrue(
           "Cached DocIdSet must be an FixedBitSet if the original one was not cacheable",
           cachedSet instanceof FixedBitSet || cachedSet == null);
     }
   }
 }
 @Override
 public boolean isCacheable() {
   for (DocIdSet set : sets) {
     if (!set.isCacheable()) {
       return false;
     }
   }
   return true;
 }