/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. If the class has a suite() method, it will be ignored. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request classWithoutSuiteMethod(Class<?> clazz) { return new ClassRequest(clazz, false); }
@Override protected RunnerBuilder suiteMethodBuilder() { return new CustomSuiteMethodBuilder(); } }
/** * Returns a Request that only contains those tests that should run when * <code>filter</code> is applied * * @param filter The {@link Filter} to apply to this Request * @return the filtered Request */ public Request filterWith(Filter filter) { return new FilterRequest(this, filter); }
/** * Returns a Request whose Tests can be run in a certain order, defined by * <code>comparator</code> * <p> * For example, here is code to run a test suite in alphabetical order: * <pre> * private static Comparator<Description> forward() { * return new Comparator<Description>() { * public int compare(Description o1, Description o2) { * return o1.getDisplayName().compareTo(o2.getDisplayName()); * } * }; * } * * public static main() { * new JUnitCore().run(Request.aClass(AllTests.class).sortWith(forward())); * } * </pre> * * @param comparator definition of the order of the tests in this Request * @return a Request with ordered Tests */ public Request sortWith(Comparator<Description> comparator) { return new SortingRequest(this, comparator); }
@Override protected Runner createRunner() { return new CustomAllDefaultPossibilitiesBuilder().safeRunnerForClass(fTestClass); }
/** * Returns a Request whose Tests can be run in a certain order, defined by * <code>ordering</code> * <p> * For example, here is code to run a test suite in reverse order: * <pre> * private static Ordering reverse() { * return new Ordering() { * public List<Description> orderItems(Collection<Description> descriptions) { * List<Description> ordered = new ArrayList<>(descriptions); * Collections.reverse(ordered); * return ordered; * } * } * } * * public static main() { * new JUnitCore().run(Request.aClass(AllTests.class).orderWith(reverse())); * } * </pre> * * @return a Request with ordered Tests * @since 4.13 */ public Request orderWith(Ordering ordering) { return new OrderingRequest(this, ordering); } }
@Override public final Runner getRunner() { if (runner == null) { runnerLock.lock(); try { if (runner == null) { runner = createRunner(); } } finally { runnerLock.unlock(); } } return runner; }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. The odd name is necessary because <code>class</code> is a reserved word. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request aClass(Class<?> clazz) { return new ClassRequest(clazz); }
/** * Returns a Request that only contains those tests that should run when * <code>filter</code> is applied * * @param filter The {@link Filter} to apply to this Request * @return the filtered Request */ public Request filterWith(Filter filter) { return new FilterRequest(this, filter); }
/** * Returns a Request whose Tests can be run in a certain order, defined by * <code>comparator</code> * * For example, here is code to run a test suite in alphabetical order: * * <pre> * private static Comparator<Description> forward() { * return new Comparator<Description>() { * public int compare(Description o1, Description o2) { * return o1.getDisplayName().compareTo(o2.getDisplayName()); * } * }; * } * * public static main() { * new JUnitCore().run(Request.aClass(AllTests.class).sortWith(forward())); * } * </pre> * * @param comparator definition of the order of the tests in this Request * @return a Request with ordered Tests */ public Request sortWith(Comparator<Description> comparator) { return new SortingRequest(this, comparator); } }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. The odd name is necessary because <code>class</code> is a reserved word. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request aClass(Class<?> clazz) { return new ClassRequest(clazz); }
/** * Returns a Request that only contains those tests that should run when * <code>filter</code> is applied * * @param filter The {@link Filter} to apply to this Request * @return the filtered Request */ public Request filterWith(Filter filter) { return new FilterRequest(this, filter); }
/** * Returns a Request whose Tests can be run in a certain order, defined by * <code>comparator</code> * * For example, here is code to run a test suite in alphabetical order: * * <pre> * private static Comparator<Description> forward() { * return new Comparator<Description>() { * public int compare(Description o1, Description o2) { * return o1.getDisplayName().compareTo(o2.getDisplayName()); * } * }; * } * * public static main() { * new JUnitCore().run(Request.aClass(AllTests.class).sortWith(forward())); * } * </pre> * * @param comparator definition of the order of the tests in this Request * @return a Request with ordered Tests */ public Request sortWith(Comparator<Description> comparator) { return new SortingRequest(this, comparator); } }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. If the class has a suite() method, it will be ignored. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request classWithoutSuiteMethod(Class<?> clazz) { return new ClassRequest(clazz, false); }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. The odd name is necessary because <code>class</code> is a reserved word. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request aClass(Class<?> clazz) { return new ClassRequest(clazz); }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. If the class has a suite() method, it will be ignored. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request classWithoutSuiteMethod(Class<?> clazz) { return new ClassRequest(clazz, false); }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. The odd name is necessary because <code>class</code> is a reserved word. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request aClass(Class<?> clazz) { return new ClassRequest(clazz); }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. The odd name is necessary because <code>class</code> is a reserved word. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request aClass(Class<?> clazz) { return new ClassRequest(clazz); }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. If the class has a suite() method, it will be ignored. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request classWithoutSuiteMethod(Class<?> clazz) { return new ClassRequest(clazz, false); }
/** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. If the class has a suite() method, it will be ignored. * * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request classWithoutSuiteMethod(Class<?> clazz) { return new ClassRequest(clazz, false); }