コード例 #1
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);
   }
 }
コード例 #2
0
ファイル: CategoriesMark2Test.java プロジェクト: stan6/junit
    // 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;
    }
コード例 #3
0
 @Override
 public Description getDescription() {
   return cargoRunner.getDescription();
 }
コード例 #4
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);
 }
コード例 #5
0
ファイル: Suite.java プロジェクト: JANCARLO123/junit
 @Override
 protected Description describeChild(Runner child) {
   return child.getDescription();
 }
コード例 #6
0
 @Test
 public void plansNamedCorrectly() throws Exception {
   Runner runner = Request.aClass(FibonacciTest.class).getRunner();
   Description description = runner.getDescription();
   assertEquals("[0]", description.getChildren().get(0).getDisplayName());
 }