Package org.junit

Examples of org.junit.Test


          // could be private, i.e. not a test method
          // could have arguments, not handled
          continue;
        }

        Test annotation = method.getAnnotation(Test.class);
        if (annotation != null)
          return methodName;
      }
    } catch (ClassNotFoundException shouldNeverOccur) {
      // Fall through and crash.
View Full Code Here


  /**
   * Wrap the given statement into another catching the expected exception, if declared.
   */
  private Statement wrapExpectedExceptions(final Statement s, TestCandidate c, Object instance) {
    Test ann = c.method.getAnnotation(Test.class);

    // If there's no expected class, don't wrap. Eh, None is package-private...
    final Class<? extends Throwable> expectedClass = ann.expected();
    if (expectedClass.getName().equals("org.junit.Test$None")) {
      return s;
    }

    return new Statement() {
View Full Code Here

   * @deprecated Will be private soon: use Rules instead
   */
  @Deprecated
  protected Statement possiblyExpectingExceptions(FrameworkMethod method,
      Object test, Statement next) {
    Test annotation= method.getAnnotation(Test.class);
    return expectsException(annotation) ? new ExpectException(next,
        getExpectedException(annotation)) : next;
  }
View Full Code Here

   * @deprecated Will be private soon: use Rules instead
   */
  @Deprecated
  protected Statement possiblyExpectingExceptions(FrameworkMethod method,
      Object test, Statement next) {
    Test annotation= method.getAnnotation(Test.class);
    return expectsException(annotation) ? new ExpectException(next,
        getExpectedException(annotation)) : next;
  }
View Full Code Here

   * throws an exception of the correct type, and throw an exception
   * otherwise.
   */
  protected Statement possiblyExpectingExceptions(FrameworkMethod method,
      Object test, Statement next) {
    Test annotation= method.getAnnotation(Test.class);
    return expectsException(annotation) ? new ExpectException(next,
        getExpectedException(annotation)) : next;
  }
View Full Code Here

        return statement;
    }

    public Statement withStartBrowserForMethod(FrameworkMethod method, Statement next) {
        Test testAnnotation = method.getAnnotation(Test.class);
        if (testAnnotation != null) {
            Class<?> testClass = getUnderlyingTestClass();
            BrowserRestartPolicy browserRestartPolicy = testClass.getAnnotation(BrowserRestartPolicy.class);
            if (browserRestartPolicy != null && browserRestartPolicy.runType() == BrowserRestartPolicy.RunType.METHOD) {
                return new StartBrowserRun(next);
View Full Code Here

            return next;
        }
    }

    public Statement withStopBrowserForMethod(FrameworkMethod method, Statement next) {
        Test testAnnotation = method.getAnnotation(Test.class);
        if (testAnnotation != null) {
            Class<?> testClass = getUnderlyingTestClass();
            BrowserRestartPolicy browserRestartPolicy = testClass.getAnnotation(BrowserRestartPolicy.class);
            if (browserRestartPolicy != null && browserRestartPolicy.runType() == BrowserRestartPolicy.RunType.METHOD) {
                return new StopBrowserRun(next);
View Full Code Here

    }
    return results;
  }

  long getTimeout(Method method) {
    Test annotation= method.getAnnotation(Test.class);
    long timeout= annotation.timeout();
    return timeout;
  }
View Full Code Here

    long timeout= annotation.timeout();
    return timeout;
  }

  Class<? extends Throwable> expectedException(Method method) {
    Test annotation= method.getAnnotation(Test.class);
    if (annotation.expected() == None.class)
      return null;
    else
      return annotation.expected();
  }
View Full Code Here

      }

      @Override
      public void testFinished(Description description) throws Exception
      {
         Test test = description.getAnnotation(Test.class);
         if (test != null && test.expected() != Test.None.class)
         {
            exception = Arquillian.caughtTestException.get();
            Arquillian.caughtTestException.set(null);
         }
      }
View Full Code Here

TOP

Related Classes of org.junit.Test

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.