diff --git a/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala index 64d9086633..1ad631c449 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala @@ -13,11 +13,11 @@ class TestTimeSpec extends AkkaSpec(Map("akka.test.timefactor" -> 2.0)) { val probe = TestProbe() val now = System.nanoTime - intercept[AssertionError] { probe.awaitCond(false, Duration("1 second")) } + intercept[AssertionError] { probe.awaitCond(false, 1.second) } val diff = System.nanoTime - now - val target = (1000000000l * testKitSettings.TestTimeFactor).toLong - diff should be > (target - 500000000l) - diff should be < (target + 500000000l) + val target = (1000000000L * testKitSettings.TestTimeFactor).toLong + diff should be >= target + diff should be < (target + 1000000000L) // 1 s margin for GC } "awaitAssert must throw correctly" in {