1 4 package org.junit.internal.requests; 5 6 import org.junit.runner.Request; 7 import org.junit.runner.Runner; 8 import org.junit.runner.manipulation.Filter; 9 import org.junit.runner.manipulation.NoTestsRemainException; 10 11 14 public final class FilterRequest extends Request { 15 private final Request fRequest; 16 private final Filter fFilter; 17 18 24 public FilterRequest(Request classRequest, Filter filter) { 25 fRequest= classRequest; 26 fFilter= filter; 27 } 28 29 30 @Override 31 public Runner getRunner() { 32 try { 33 Runner runner= fRequest.getRunner(); 34 fFilter.apply(runner); 35 return runner; 36 } catch (NoTestsRemainException e) { 37 return Request.errorReport(Filter.class, new Exception (String 38 .format("No tests found matching %s from %s", fFilter 39 .describe(), fRequest.toString()))).getRunner(); 40 } 41 } 42 } | Popular Tags |