Skip to content

Commit

Permalink
Update BlockJUnit4ClassRunner to no longer use the deprecated FailOnT…
Browse files Browse the repository at this point in the history
…imeout ctor
  • Loading branch information
kcooney committed Sep 4, 2014
1 parent d96a05f commit 1e55e32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -310,7 +311,12 @@ protected Statement possiblyExpectingExceptions(FrameworkMethod method,
protected Statement withPotentialTimeout(FrameworkMethod method,
Object test, Statement next) {
long timeout = getTimeout(method.getAnnotation(Test.class));
return timeout > 0 ? new FailOnTimeout(next, timeout) : next;
if (timeout <= 0) {
return next;
}
return FailOnTimeout.builder()
.withTimeout(timeout, TimeUnit.MILLISECONDS)
.build(next);
}

/**
Expand Down

0 comments on commit 1e55e32

Please sign in to comment.