Package org.junit

Examples of org.junit.Test.expected()


            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() {
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

    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

  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

    }

    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();
    }

    private JExampleOptions initJExampleOptions(Class<?> jclass) {
        final JExampleOptions options = (JExampleOptions) jclass.getAnnotation(JExampleOptions.class);
View Full Code Here

    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();
    }

    private JExampleOptions initJExampleOptions(Class<?> jclass) {
        final JExampleOptions options = (JExampleOptions) jclass.getAnnotation(JExampleOptions.class);
        if (options == null) return JExampleOptions.class.getAnnotation(JExampleOptions.class);
View Full Code Here

    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

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

  boolean isUnexpected(Throwable exception) {
    return ! getExpectedException().isAssignableFrom(exception.getClass());
  }
View Full Code Here

   * specified
   */
  protected Class<? extends Throwable> getExpectedException(FrameworkMethod frameworkMethod) {
    Test testAnnotation = frameworkMethod.getAnnotation(Test.class);
    Class<? extends Throwable> junitExpectedException = testAnnotation != null
        && testAnnotation.expected() != Test.None.class ? testAnnotation.expected() : null;

    ExpectedException expectedExAnn = frameworkMethod.getAnnotation(ExpectedException.class);
    Class<? extends Throwable> springExpectedException = (expectedExAnn != null ? expectedExAnn.value() : null);

    if (springExpectedException != null && junitExpectedException != null) {
View Full Code Here

   * specified
   */
  protected Class<? extends Throwable> getExpectedException(FrameworkMethod frameworkMethod) {
    Test testAnnotation = frameworkMethod.getAnnotation(Test.class);
    Class<? extends Throwable> junitExpectedException = testAnnotation != null
        && testAnnotation.expected() != Test.None.class ? testAnnotation.expected() : null;

    ExpectedException expectedExAnn = frameworkMethod.getAnnotation(ExpectedException.class);
    Class<? extends Throwable> springExpectedException = (expectedExAnn != null ? expectedExAnn.value() : null);

    if (springExpectedException != null && junitExpectedException != null) {
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.