Examples of FrameworkMethod


Examples of org.junit.runners.model.FrameworkMethod

  }

  public Parameterized(final Class<?> clazz) throws Exception {
    super(clazz, new ArrayList<Runner>());

    final FrameworkMethod method = findMethod(getTestClass());
    List<Object[]> parametersList = null;
    try {
      parametersList = (List<Object[]>) method.invokeExplosively(null);
    } catch (final Throwable throwable) {
      throw new Exception(throwable);
    }
    for (final Object[] aParametersList : parametersList) {
      getChildren().add(new ClassRunnerForParameters(getTestClass().getJavaClass(), aParametersList));
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

   * Class for alphabetical ordering of a list                                  
   */
  public class AlphabeticalOrder implements Comparator {

    public int compare(Object o1, Object o2) {
      FrameworkMethod f1 = (FrameworkMethod) o1;
      FrameworkMethod f2 = (FrameworkMethod) o2;

      return f1.getName().compareTo(f2.getName());
    }
View Full Code Here

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

  /**
   * 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

    notifier.fireTestStarted(d);

    Statement statement;
    if (this.testScript == null) {
      try {
        statement = new InvokeMethod(new FrameworkMethod(this.instance.getClass().getMethod(child)), this.instance);
      } catch (NoSuchMethodException e) {
        notifier.fireTestFailure(new Failure(d, e));
        statement = null;
      }
    } else {
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

  }

  @Test
  public void getSpringTimeoutViaMetaAnnotation() throws Exception {
    SpringJUnit4ClassRunner runner = new SpringJUnit4ClassRunner(getClass());
    long timeout = runner.getSpringTimeout(new FrameworkMethod(getClass().getDeclaredMethod(
      "springTimeoutWithMetaAnnotation")));
    assertEquals(10, timeout);
  }
View Full Code Here

Examples of org.junit.runners.model.FrameworkMethod

  }

  @Test
  public void getSpringTimeoutViaMetaAnnotationWithOverride() throws Exception {
    SpringJUnit4ClassRunner runner = new SpringJUnit4ClassRunner(getClass());
    long timeout = runner.getSpringTimeout(new FrameworkMethod(getClass().getDeclaredMethod(
      "springTimeoutWithMetaAnnotationAndOverride")));
    assertEquals(42, timeout);
  }
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.