Examples of FrameworkMethod


Examples of org.junit.runners.model.FrameworkMethod

     * @param methods The methods to sort.
     */
    private static void sortDependantTestsLast(final FrameworkMethod[] methods) {
        Set<String> dependencies = null;
        for (int i=methods.length-1; --i>=0;) {
            final FrameworkMethod method = methods[i];
            final DependsOnMethod depend = method.getAnnotation(DependsOnMethod.class);
            if (depend != null) {
                if (dependencies == null) {
                    dependencies = new HashSet<String>();
                }
                dependencies.addAll(Arrays.asList(depend.value()));
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

    @Override
    public void filter(final Filter filter) throws NoTestsRemainException {
        int count = 0;
        FrameworkMethod[] children = getFilteredChildren();
        for (int i=0; i<children.length; i++) {
            final FrameworkMethod method = children[i];
            if (filter.shouldRun(describeChild(method))) {
                try {
                    filter.apply(method);
                } catch (NoTestsRemainException e) {
                    continue;
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

    for (Method javaMethod : getTestClass().getJavaClass().getMethods())
    {
      if (isJUnitMethod(javaMethod))
      {
        FrameworkMethod junitMethod = new FrameworkMethod(javaMethod);
        methods.add(junitMethod);
      }
    }

    return methods;
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

            Modifier.isProtected(javaMethod.getModifiers()) &&
            (javaMethod.getReturnType().equals(Void.TYPE) || javaMethod.getReturnType()
              .equals(Void.class)))
          {
            javaMethod.setAccessible(true);
            junitMethods.add(new FrameworkMethod(javaMethod));
            break;
          }
        }
        catch (NoSuchMethodException nsmx)
        {
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

              m.getParameterTypes().length == 0 &&
              m.getReturnType() == Void.TYPE))
      {
        if (Modifier.isStatic(mod))
          throw new RuntimeException("Test methods must not be static.");
        testMethods.add(new FrameworkMethod(m));
      }
    }
   
    if (testMethods.isEmpty()) {
      throw new RuntimeException("No runnable methods!");
    }
   
    if (TEST_NIGHTLY == false) {
      if (getTestClass().getJavaClass().isAnnotationPresent(Nightly.class)) {
        /* the test class is annotated with nightly, remove all methods */
        String className = getTestClass().getJavaClass().getSimpleName();
        System.err.println("NOTE: Ignoring nightly-only test class '" + className + "'");
        testMethods.clear();
      } else {
        /* remove all nightly-only methods */
        for (int i = 0; i < testMethods.size(); i++) {
          final FrameworkMethod m = testMethods.get(i);
          if (m.getAnnotation(Nightly.class) != null) {
            System.err.println("NOTE: Ignoring nightly-only test method '" + m.getName() + "'");
            testMethods.remove(i--);
          }
        }
      }
      /* dodge a possible "no-runnable methods" exception by adding a fake ignored test */
      if (testMethods.isEmpty()) {
        try {
          testMethods.add(new FrameworkMethod(LuceneTestCase.class.getMethod("alwaysIgnoredTestMethod")));
        } catch (Exception e) { throw new RuntimeException(e); }
      }
    }
    // sort the test methods first before shuffling them, so that the shuffle is consistent
    // across different implementations that might order the methods different originally.
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

  /**
   * Wrap the given statement in any declared MethodRules (old style rules).
   */
  @SuppressWarnings("deprecation")
  private Statement wrapMethodRules(Statement s, TestCandidate c, Object instance) {
    FrameworkMethod fm = new FrameworkMethod(c.method);

    // Old-style MethodRules first.
    List<org.junit.rules.MethodRule> methodRules =
        getAnnotatedFieldValues(instance, Rule.class, org.junit.rules.MethodRule.class);
    for (org.junit.rules.MethodRule rule : methodRules) {
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

            DataSetObject dataSetObject = new DataSetObject(actualChild, null);
            dataSetObject.gatherDataSetInfos(actualChild.reorderedChildren);
            this.reorderedChildren.add(dataSetObject);
          } else if (originalChild instanceof FrameworkMethod) {
            // Framework Method
            FrameworkMethod frameworkMethod = (FrameworkMethod) originalChild;
            Method testMethod = frameworkMethod.getMethod();
            System.err.println(testMethod);

            DataSetObject dataSetObject = new DataSetObject(null, frameworkMethod);
            dataSetObject.gatherDataSetInfos(testMethod, this.describeChild(originalChild));
            this.reorderedChildren.add(dataSetObject);
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

    }

    @Override
    protected Statement methodBlock(FrameworkMethod method)
    {
        FrameworkMethod newMethod = null;
        try
        {
            // Need the class frmo the custom loader now, so lets load the class.
            loadClassesWithCustomClassLoader();
            // The method as parameter is frmo the original class and thus not found in our
            // class loaded by the custom name (reflection is class loader sensitive)
            // So find the same method but now in the class frmo the class Loader.
            Method methodFromNewlyLoadedClass = testClassFromClassLoader
                    .getJavaClass().getMethod(method.getName());
            newMethod = new FrameworkMethod(methodFromNewlyLoadedClass);
        }
        catch (ClassNotFoundException e)
        {
            // Show any problem nicely as a JUnit Test failure.
            return new Fail(e);
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

        final BlockJUnit4ClassRunner filteredRunner = new BlockJUnit4ClassRunner(testClass) {
            @Override
            protected List<FrameworkMethod> getChildren() {
                try {
                    return Arrays.asList(new FrameworkMethod(testClass.getMethod(args[1])));
                } catch (final NoSuchMethodException e) {
                    throw new IllegalArgumentException(e);
                }
            }
        };
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

  /**
   * Wrap the given statement in any declared MethodRules (old style rules).
   */
  @SuppressWarnings("deprecation")
  private Statement wrapMethodRules(Statement s, TestCandidate c, Object instance) {
    FrameworkMethod fm = new FrameworkMethod(c.method);

    // Old-style MethodRules first.
    List<org.junit.rules.MethodRule> methodRules =
        getAnnotatedFieldValues(instance, Rule.class, org.junit.rules.MethodRule.class);
    for (org.junit.rules.MethodRule rule : methodRules) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.