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);
   }
 }
Example #2
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;
    }
Example #3
0
 @Override
 public Description getDescription() {
   return cargoRunner.getDescription();
 }
 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);
 }
Example #5
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());
 }