Skip to content

Commit 0ec3649

Browse files
committed
Added a type annotation for clarity in Ultimately and added a tolerance to an UltimatelySpec test to reduce the likelihood of flicker.
1 parent 98193b1 commit 0ec3649

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

scalatest-test/src/test/scala/org/scalatest/concurrent/UltimatelySpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class UltimatelySpec extends AsyncFunSpec with Matchers with OptionValues {
201201
}
202202
}
203203
} map { _ =>
204-
(System.currentTimeMillis - startTime.get).toInt should be >= (1388)
204+
(System.currentTimeMillis - startTime.get).toInt should be >= (1388 - 10) // - 10 to give it a little wiggle room
205205
}
206206
}
207207

scalatest/src/main/scala/org/scalatest/concurrent/Ultimately.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import org.scalatest.exceptions.StackDepthException
2626
import scala.concurrent.{Future, Promise, ExecutionContext}
2727
import scala.util.{Success, Failure}
2828
import java.util.concurrent.{ Executors, TimeUnit, ThreadFactory }
29+
import java.util.concurrent.ScheduledExecutorService
2930

3031
/**
3132
* Trait that provides the <code>ultimately</code> construct, which periodically retries executing
@@ -504,7 +505,7 @@ trait Ultimately extends PatienceConfiguration {
504505
* </pre>
505506
*/
506507
object Ultimately extends Ultimately {
507-
private lazy val scheduler = {
508+
private lazy val scheduler: ScheduledExecutorService = {
508509
val threadFactory = new ThreadFactory {
509510
val inner = Executors.defaultThreadFactory()
510511
def newThread(runnable: Runnable) = {

0 commit comments

Comments
 (0)