Ejemplo n.º 1
0
 public void filter(Filter filter) throws NoTestsRemainException {
   synchronized (fChildrenLock) {
     List<T> filteredChildren = new ArrayList<T>(getFilteredChildren());
     for (Iterator<T> iter = filteredChildren.iterator(); iter.hasNext(); ) {
       T each = iter.next();
       if (shouldRun(filter, each)) {
         try {
           filter.apply(each);
         } catch (NoTestsRemainException e) {
           iter.remove();
         }
       } else {
         iter.remove();
       }
     }
     fFilteredChildren = Collections.unmodifiableCollection(filteredChildren);
     if (fFilteredChildren.isEmpty()) {
       throw new NoTestsRemainException();
     }
   }
 }
Ejemplo n.º 2
0
 private void filterChild(T child) throws NoTestsRemainException {
   if (fFilter != null) fFilter.apply(child);
 }