From 4e54672198e11cfdf8a28e1defb9c5dd53cae536 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 7 Aug 2014 11:58:44 +0200 Subject: [PATCH] =tes #15167 Harden TestTimeSpec --- .../src/test/scala/akka/testkit/TestTimeSpec.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 {