Package org.junit.runners.model

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


            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

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

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

   * Wrap the given statement in any declared MethodRules.
   */
  @SuppressWarnings("deprecation")
  private Statement wrapMethodRules(Statement s, TestCandidate c, Object instance) {
    TestClass info = new TestClass(suiteClass);
    FrameworkMethod fm = new FrameworkMethod(c.method);
    for (org.junit.rules.MethodRule each :
        info.getAnnotatedFieldValues(suiteClass, Rule.class, org.junit.rules.MethodRule.class))
      s = each.apply(s, fm, instance);
    return s;
  }
View Full Code Here

         */
        @Override
        protected Statement withAfterClasses(Statement statement) {
            List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
            // THere would always be atleast on method associated with the Runner, else validation would fail.
            FrameworkMethod method = frameworkMethods.get(0);
            // Only if the return type of the Method is not VOID, we try to determine the right loader and data files.
            if (method.getMethod().getReturnType() != Void.TYPE) {
                DataLoader loaderAnnotation = method.getAnnotation(DataLoader.class);
                if (loaderAnnotation != null) {
                    determineLoader(loaderAnnotation);

                } else {
                    loaderAnnotation = getTestClass().getJavaClass().getAnnotation(DataLoader.class);
View Full Code Here

         */
        @Override
        protected Statement withAfterClasses(Statement statement) {
            List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
            // THere would always be atleast on method associated with the Runner, else validation would fail.
            FrameworkMethod method = frameworkMethods.get(0);
            // Only if the return type of the Method is not VOID, we try to determine the right loader and data files.
            if (method.getMethod().getReturnType() != Void.TYPE) {
                DataLoader loaderAnnotation = method.getAnnotation(DataLoader.class);
                if (loaderAnnotation != null) {
                    determineLoader(loaderAnnotation);

                } else {
                    loaderAnnotation = getTestClass().getJavaClass().getAnnotation(DataLoader.class);
View Full Code Here

    public void expectedExceptionFailsInMainTestThreadWithoutJUnitFrameworkIntervention() throws Throwable {
        Mockery context = new JUnit4Mockery() {{
            setImposteriser(ClassImposteriser.INSTANCE);
            setThreadingPolicy(new Synchroniser());
        }};
        FrameworkMethod method = createMethodWithExpectations(context);
        Statement statement = createStatementWithExpectations(context);
        new RunConcurrently(method, statement).evaluate();
        context.assertIsSatisfied();
    }
View Full Code Here

        new RunConcurrently(method, statement).evaluate();
        context.assertIsSatisfied();
    }

    private FrameworkMethod createMethodWithExpectations(Mockery context) {
        final FrameworkMethod method = context.mock(FrameworkMethod.class);
        context.checking(new Expectations() {{
            allowing(method).getAnnotation(Concurrent.class); will(returnValue(new ConcurrentAnnotation()));
            allowing(method).getName();
        }});
        return method;
View Full Code Here

   * Wrap the given statement in any declared MethodRules.
   */
  @SuppressWarnings("deprecation")
  private Statement wrapMethodRules(Statement s, TestCandidate c, Object instance) {
    TestClass info = new TestClass(suiteClass);
    FrameworkMethod fm = new FrameworkMethod(c.method);
    for (org.junit.rules.MethodRule each :
        info.getAnnotatedFieldValues(suiteClass, Rule.class, org.junit.rules.MethodRule.class))
      s = each.apply(s, fm, instance);
    return s;
  }
View Full Code Here

TOP

Related Classes of org.junit.runners.model.FrameworkMethod

Copyright © 2018 www.massapicom. 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.