Exemplo n.º 1
0
 // TODO: require an instance?
 @Override
 public void run(RunNotifier notifier) {
   List<Class<?>> allPossibleClasses = gatherClasses();
   List<Runner> allPossibleRunners = runnersForClasses(allPossibleClasses);
   List<Runner> valid = filterRunners(allPossibleRunners);
   for (Runner each : valid) each.run(notifier);
 }
Exemplo n.º 2
0
 @Override
 protected void runChild(Runner child, RunNotifier notifier) {
   if (!(initialized)) {
     initialize();
   }
   child.run(notifier);
 }
Exemplo n.º 3
0
 private Description getRootDescription(Runner runner, DescriptionMatcher matcher) {
   Description current = runner.getDescription();
   while (true) {
     List<Description> children = current.getChildren();
     if (children.size() != 1 || matcher.matches(current)) return current;
     current = children.get(0);
   }
 }
Exemplo n.º 4
0
    // TODO: this type correct?
    @Override
    public List<Runner> matchingRunners(List<? extends Runner> allPossibleRunners) {
      ArrayList<Runner> result = new ArrayList<Runner>();
      for (Runner eachRunner : allPossibleRunners) {
        Collection<Annotation> annotations = eachRunner.getDescription().getAnnotations();
        // TODO: extract method
        for (Annotation eachAnnotation : annotations) {
          if (eachAnnotation.annotationType().equals(Category.class)) {
            Category category = (Category) eachAnnotation;
            Class<?>[] categories = category.value();
            if (Arrays.asList(categories).contains(fIncluded)) result.add(eachRunner);
          }
        }
      }

      // TODO Auto-generated method stub
      return result;
    }
Exemplo n.º 5
0
 @Override
 public void run(RunNotifier notifier) {
   if (myTests == null) {
     runFailure(
         createTestDescription(ModuleSymbolicSuite.NO_TESTS),
         new IllegalStateException("no tests found in " + myClassName),
         notifier);
   } else if (myDelegate == null) {
     for (String test : myTests) {
       runFailure(
           createTestDescription(test), new ClassNotFoundException(myClassName), notifier);
     }
   } else {
     myDelegate.run(notifier);
   }
 }
Exemplo n.º 6
0
 @Override
 public void run(RunNotifier notifier) {
   cargoRunner.run(notifier);
 }
Exemplo n.º 7
0
 @Override
 public Description getDescription() {
   return cargoRunner.getDescription();
 }
Exemplo n.º 8
0
 private ITestReference createUnfilteredTest(Class<?> clazz, String[] failureNames) {
   Request request = sortByFailures(Request.aClass(clazz), failureNames);
   Runner runner = request.getRunner();
   Description description = runner.getDescription();
   return new JUnit4TestReference(runner, description);
 }
Exemplo n.º 9
0
 @Override
 protected void runChild(Runner runner, final RunNotifier notifier) {
   runner.run(notifier);
 }
Exemplo n.º 10
0
 @Override
 protected Description describeChild(Runner child) {
   return child.getDescription();
 }
 @Test
 public void plansNamedCorrectly() throws Exception {
   Runner runner = Request.aClass(FibonacciTest.class).getRunner();
   Description description = runner.getDescription();
   assertEquals("[0]", description.getChildren().get(0).getDisplayName());
 }
 @Test
 public void countBeforeRun() throws Exception {
   Runner runner = Request.aClass(FibonacciTest.class).getRunner();
   assertEquals(7, runner.testCount());
 }