Package org.junit.internal.runners.statements

Examples of org.junit.internal.runners.statements.FailOnTimeout


    }

    @Test
    public void stopEndlessStatement() throws Throwable {
        InfiniteLoopStatement infiniteLoop = new InfiniteLoopStatement();
        FailOnTimeout infiniteLoopTimeout = new FailOnTimeout(infiniteLoop,
                TIMEOUT);
        try {
            infiniteLoopTimeout.evaluate();
        } catch (Exception timeoutException) {
            sleep(20); // time to interrupt the thread
            int firstCount = InfiniteLoopStatement.COUNT;
            sleep(20); // time to increment the count
            assertTrue("Thread has not been stopped.",
View Full Code Here


    }

    @Test
    public void stackTraceContainsRealCauseOfTimeout() throws Throwable {
        StuckStatement stuck = new StuckStatement();
        FailOnTimeout stuckTimeout = new FailOnTimeout(stuck, TIMEOUT);
        try {
            stuckTimeout.evaluate();
            // We must not get here, we expect a timeout exception
            fail("Expected timeout exception");
        } catch (Exception timeoutException) {
            StackTraceElement[] stackTrace = timeoutException.getStackTrace();
            boolean stackTraceContainsTheRealCauseOfTheTimeout = false;
View Full Code Here

    public Timeout lookingForStuckThread(boolean enable) {
        return new Timeout(this, enable);
    }

    public Statement apply(Statement base, Description description) {
        return new FailOnTimeout(base, timeout, timeUnit, lookForStuckThread);
    }
View Full Code Here

     */
    @Deprecated
    protected Statement withPotentialTimeout(FrameworkMethod method,
            Object test, Statement next) {
        long timeout = getTimeout(method.getAnnotation(Test.class));
        return timeout > 0 ? new FailOnTimeout(next, timeout) : next;
    }
View Full Code Here

   */
  @Deprecated
  protected Statement withPotentialTimeout(FrameworkMethod method,
      Object test, Statement next) {
    long timeout= getTimeout(method.getAnnotation(Test.class));
    return timeout > 0 ? new FailOnTimeout(next, timeout) : next;
  }
View Full Code Here

  public Timeout(int millis) {
    fMillis= millis;
  }

  public Statement apply(Statement base, Description description) {
    return new FailOnTimeout(base, fMillis);
  }
View Full Code Here

    }
    else if (springTimeout > 0) {
      statement = new SpringFailOnTimeout(next, springTimeout);
    }
    else if (junitTimeout > 0) {
      statement = new FailOnTimeout(next, junitTimeout);
    }
    else {
      statement = next;
    }
View Full Code Here

    }
    else if (springTimeout > 0) {
      statement = new SpringFailOnTimeout(next, springTimeout);
    }
    else if (junitTimeout > 0) {
      statement = new FailOnTimeout(next, junitTimeout);
    }
    else {
      statement = next;
    }
View Full Code Here

  }

  @Test
  public void stopEndlessStatement() throws Throwable {
    InfiniteLoopStatement infiniteLoop= new InfiniteLoopStatement();
    FailOnTimeout infiniteLoopTimeout= new FailOnTimeout(infiniteLoop,
        TIMEOUT);
    try {
      infiniteLoopTimeout.evaluate();
    } catch (Exception timeoutException) {
      sleep(20); // time to interrupt the thread
      int firstCount= InfiniteLoopStatement.COUNT;
      sleep(20); // time to increment the count
      assertTrue("Thread has not been stopped.",
View Full Code Here

   */
  @Deprecated
  protected Statement withPotentialTimeout(FrameworkMethod method,
      Object test, Statement next) {
    long timeout= getTimeout(method.getAnnotation(Test.class));
    return timeout > 0 ? new FailOnTimeout(next, timeout) : next;
  }
View Full Code Here

TOP

Related Classes of org.junit.internal.runners.statements.FailOnTimeout

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.