Package org.junit

Examples of org.junit.Test


            initMethodObjects(this.testObject);
            final Method m = getMethod(this.testObject,methodName);
            if (getJunit4()){
                Class<? extends Throwable> expectedException = None.class;
                long timeout = 0;
                Test annotation = m.getAnnotation(Test.class);
                if(null != annotation) {
                    expectedException = annotation.expected();
                    timeout = annotation.timeout();
                }
                final AnnotatedTestCase at = new AnnotatedTestCase(m, expectedException, timeout);
                testCase = at;
                protectable = new Protectable() {
                    public void protect() throws Throwable {
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

      }

      @Override
      public void testFinished(Description description) throws Exception
      {
         Test test = description.getAnnotation(Test.class);
         if (test != null && test.expected() != Test.None.class)
         {
            exception = State.getTestException();
            State.caughtTestException(null);
         }
      }
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 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

    protected void errorPartOfCycle(Stack<Example> cycle) {
        errors.add(Kind.RECURSIVE_DEPENDENCIES, "Part of a cycle!");
    }

    private Class<? extends Throwable> initExpectedException() {
        Test a = this.method.getAnnotation(Test.class);
        if (a == null) return null;
        if (a.expected() == org.junit.Test.None.class) return null;
        return a.expected();
    }
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

  public boolean isIgnored() {
    return fMethod.getAnnotation(Ignore.class) != null;
  }

  public long getTimeout() {
    Test annotation= fMethod.getAnnotation(Test.class);
    if (annotation == null)
      return 0;
    long timeout= annotation.timeout();
    return timeout;
  }
View Full Code Here

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

  protected Class<? extends Throwable> getExpectedException() {
    Test annotation= fMethod.getAnnotation(Test.class);
    if (annotation == null || annotation.expected() == None.class)
      return null;
    else
      return annotation.expected();
  }
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.