diff --git a/akka-actor-tests/src/test/java/akka/actor/ActorCreationTest.java b/akka-actor-tests/src/test/java/akka/actor/ActorCreationTest.java index 0f2b4ed585..35e835aa90 100644 --- a/akka-actor-tests/src/test/java/akka/actor/ActorCreationTest.java +++ b/akka-actor-tests/src/test/java/akka/actor/ActorCreationTest.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.stream.IntStream; import akka.testkit.TestActors; +import org.junit.Assert; import org.junit.Test; import akka.japi.Creator; @@ -209,7 +210,7 @@ public class ActorCreationTest extends JUnitSuite { public void testWrongAnonymousClassStaticCreator() { try { Props.create(new C() {}); // has implicit reference to outer class - fail("Should have detected this is not a real static class, and thrown"); + org.junit.Assert.fail("Should have detected this is not a real static class, and thrown"); } catch (IllegalArgumentException e) { assertEquals("cannot use non-static local Creator to create actors; make it static (e.g. local to a static method) or top-level", e.getMessage()); } @@ -278,7 +279,7 @@ public class ActorCreationTest extends JUnitSuite { // captures enclosing class }; Props.create(anonymousCreatorFromStaticMethod); - fail("Should have detected this is not a real static class, and thrown"); + org.junit.Assert.fail("Should have detected this is not a real static class, and thrown"); } catch (IllegalArgumentException e) { assertEquals("cannot use non-static local Creator to create actors; make it static (e.g. local to a static method) or top-level", e.getMessage()); } @@ -296,7 +297,7 @@ public class ActorCreationTest extends JUnitSuite { assertEquals(TestActor.class, p.actorClass()); try { TestActor.propsUsingLamdaWithoutClass(17); - fail("Should have detected lambda erasure, and thrown"); + org.junit.Assert.fail("Should have detected lambda erasure, and thrown"); } catch (IllegalArgumentException e) { assertEquals("erased Creator types are unsupported, use Props.create(actorClass, creator) instead", e.getMessage()); diff --git a/akka-actor-tests/src/test/java/akka/japi/JavaAPITestBase.java b/akka-actor-tests/src/test/java/akka/japi/JavaAPITestBase.java index 10c40159f8..d97f4302e5 100644 --- a/akka-actor-tests/src/test/java/akka/japi/JavaAPITestBase.java +++ b/akka-actor-tests/src/test/java/akka/japi/JavaAPITestBase.java @@ -41,14 +41,14 @@ public class JavaAPITestBase extends JUnitSuite { String s : Option.some("abc")) { return; } - fail("for-loop not entered"); + org.junit.Assert.fail("for-loop not entered"); } @Test public void shouldNotEnterForLoop() { for (@SuppressWarnings("unused") Object o : Option.none()) { - fail("for-loop entered"); + org.junit.Assert.fail("for-loop entered"); } } diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala index 2a4ae83b05..fd520eee22 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala @@ -719,7 +719,14 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa Await.result(p.future, timeout.duration) should ===(message) } } - "always cast successfully using mapTo" in { f((future, message) ⇒ (evaluating { Await.result(future.mapTo[java.lang.Thread], timeout.duration) } should produce[java.lang.Exception]).getMessage should ===(message)) } + "always cast successfully using mapTo" in { + f((future, message) ⇒ { + val exception = the[java.lang.Exception] thrownBy { + Await.result(future.mapTo[java.lang.Thread], timeout.duration) + } + exception.getMessage should ===(message) + }) + } } implicit def arbFuture: Arbitrary[Future[Int]] = Arbitrary(for (n ← arbitrary[Int]) yield Future(n)) diff --git a/akka-actor-tests/src/test/scala/akka/io/SimpleDnsCacheSpec.scala b/akka-actor-tests/src/test/scala/akka/io/SimpleDnsCacheSpec.scala index af796c6e0b..b45f547fe0 100644 --- a/akka-actor-tests/src/test/scala/akka/io/SimpleDnsCacheSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/SimpleDnsCacheSpec.scala @@ -3,9 +3,9 @@ package akka.io import java.net.InetAddress import java.util.concurrent.atomic.AtomicLong -import org.scalatest.{ ShouldMatchers, WordSpec } +import org.scalatest.{ Matchers, WordSpec } -class SimpleDnsCacheSpec extends WordSpec with ShouldMatchers { +class SimpleDnsCacheSpec extends WordSpec with Matchers { "Cache" should { "not reply with expired but not yet swept out entries" in { val localClock = new AtomicLong(0) @@ -15,11 +15,11 @@ class SimpleDnsCacheSpec extends WordSpec with ShouldMatchers { val cacheEntry = Dns.Resolved("test.local", Seq(InetAddress.getByName("127.0.0.1"))) cache.put(cacheEntry, 5000) - cache.cached("test.local") should equal(Some(cacheEntry)) + cache.cached("test.local") should ===(Some(cacheEntry)) localClock.set(4999) - cache.cached("test.local") should equal(Some(cacheEntry)) + cache.cached("test.local") should ===(Some(cacheEntry)) localClock.set(5000) - cache.cached("test.local") should equal(None) + cache.cached("test.local") should ===(None) } "sweep out expired entries on cleanup()" in { @@ -30,16 +30,16 @@ class SimpleDnsCacheSpec extends WordSpec with ShouldMatchers { val cacheEntry = Dns.Resolved("test.local", Seq(InetAddress.getByName("127.0.0.1"))) cache.put(cacheEntry, 5000) - cache.cached("test.local") should equal(Some(cacheEntry)) + cache.cached("test.local") should ===(Some(cacheEntry)) localClock.set(5000) - cache.cached("test.local") should equal(None) + cache.cached("test.local") should ===(None) localClock.set(0) - cache.cached("test.local") should equal(Some(cacheEntry)) + cache.cached("test.local") should ===(Some(cacheEntry)) localClock.set(5000) cache.cleanup() - cache.cached("test.local") should equal(None) + cache.cached("test.local") should ===(None) localClock.set(0) - cache.cached("test.local") should equal(None) + cache.cached("test.local") should ===(None) } } } diff --git a/akka-actor-tests/src/test/scala/akka/io/TcpConnectionSpec.scala b/akka-actor-tests/src/test/scala/akka/io/TcpConnectionSpec.scala index 1dcacf1b0d..5272f0b471 100644 --- a/akka-actor-tests/src/test/scala/akka/io/TcpConnectionSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/TcpConnectionSpec.scala @@ -449,10 +449,10 @@ class TcpConnectionSpec extends AkkaSpec(""" assertThisConnectionActorTerminated() val buffer = ByteBuffer.allocate(1) - val thrown = evaluating { + val thrown = the[IOException] thrownBy { windowsWorkaroundToDetectAbort() serverSideChannel.read(buffer) - } should produce[IOException] + } thrown.getMessage should ===(ConnectionResetByPeerMessage) } } diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala index af69ad1262..a65ca8cb24 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterDaemon.scala @@ -1312,10 +1312,10 @@ private[cluster] class OnMemberStatusChangedListener(callback: Runnable, status: @SerialVersionUID(1L) private[cluster] final case class GossipStats( receivedGossipCount: Long = 0L, - mergeCount: Long = 0L, - sameCount: Long = 0L, - newerCount: Long = 0L, - olderCount: Long = 0L) { + mergeCount: Long = 0L, + sameCount: Long = 0L, + newerCount: Long = 0L, + olderCount: Long = 0L) { def incrementMergeCount(): GossipStats = copy(mergeCount = mergeCount + 1, receivedGossipCount = receivedGossipCount + 1) @@ -1355,5 +1355,5 @@ private[cluster] final case class GossipStats( @SerialVersionUID(1L) private[cluster] final case class VectorClockStats( versionSize: Int = 0, - seenLatest: Int = 0) + seenLatest: Int = 0) diff --git a/akka-contrib/src/test/scala/akka/contrib/pattern/ReceivePipelineSpec.scala b/akka-contrib/src/test/scala/akka/contrib/pattern/ReceivePipelineSpec.scala index 77b2a2ff4c..5a80ee6cb5 100644 --- a/akka-contrib/src/test/scala/akka/contrib/pattern/ReceivePipelineSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/pattern/ReceivePipelineSpec.scala @@ -326,7 +326,7 @@ class PersistentReceivePipelineSpec(config: Config) extends AkkaSpec(config) wit totaller ! 6 totaller ! "get" expectMsg(6) - probe.expectMsg(99) + probe.expectMsg(99L) } } } diff --git a/akka-docs/rst/java/code/docs/http/javadsl/server/directives/CustomHttpMethodExamplesTest.java b/akka-docs/rst/java/code/docs/http/javadsl/server/directives/CustomHttpMethodExamplesTest.java index 8631efbac0..c98e4ef675 100644 --- a/akka-docs/rst/java/code/docs/http/javadsl/server/directives/CustomHttpMethodExamplesTest.java +++ b/akka-docs/rst/java/code/docs/http/javadsl/server/directives/CustomHttpMethodExamplesTest.java @@ -18,6 +18,7 @@ import akka.http.javadsl.testkit.JUnitRouteTest; import akka.stream.Materializer; import akka.stream.javadsl.Flow; import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; @@ -67,8 +68,8 @@ public class CustomHttpMethodExamplesTest extends JUnitRouteTest { CompletionStage response = http.singleRequest(request, materializer); //#customHttpMethod - assertResult(StatusCodes.OK, response.toCompletableFuture().get().status()); - assertResult( + assertEquals(StatusCodes.OK, response.toCompletableFuture().get().status()); + assertEquals( "This is a BOLT request.", response.toCompletableFuture().get().entity().toStrict(3000, materializer).toCompletableFuture().get().getData().utf8String() ); diff --git a/akka-docs/rst/java/code/docs/http/javadsl/server/directives/RangeDirectivesExamplesTest.java b/akka-docs/rst/java/code/docs/http/javadsl/server/directives/RangeDirectivesExamplesTest.java index 14d3bbf146..5dfe1ed0cb 100644 --- a/akka-docs/rst/java/code/docs/http/javadsl/server/directives/RangeDirectivesExamplesTest.java +++ b/akka-docs/rst/java/code/docs/http/javadsl/server/directives/RangeDirectivesExamplesTest.java @@ -19,6 +19,7 @@ import akka.util.ByteString; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; @@ -68,16 +69,16 @@ public class RangeDirectivesExamplesTest extends JUnitRouteTest { try { final List bodyParts = completionStage.toCompletableFuture().get(3, TimeUnit.SECONDS); - assertResult(2, bodyParts.toArray().length); + assertEquals(2, bodyParts.toArray().length); final Multipart.ByteRanges.BodyPart part1 = bodyParts.get(0); - assertResult(bytes028Range, part1.getContentRange()); - assertResult(ByteString.fromString("ABC"), + assertEquals(bytes028Range, part1.getContentRange()); + assertEquals(ByteString.fromString("ABC"), part1.toStrict(1000, materializer).toCompletableFuture().get().getEntity().getData()); final Multipart.ByteRanges.BodyPart part2 = bodyParts.get(1); - assertResult(bytes678Range, part2.getContentRange()); - assertResult(ByteString.fromString("GH"), + assertEquals(bytes678Range, part2.getContentRange()); + assertEquals(ByteString.fromString("GH"), part2.toStrict(1000, materializer).toCompletableFuture().get().getEntity().getData()); } catch (Exception e) { diff --git a/akka-docs/rst/java/code/docs/stream/GraphDSLDocTest.java b/akka-docs/rst/java/code/docs/stream/GraphDSLDocTest.java index 51fe15ef40..58e3fa4a22 100644 --- a/akka-docs/rst/java/code/docs/stream/GraphDSLDocTest.java +++ b/akka-docs/rst/java/code/docs/stream/GraphDSLDocTest.java @@ -98,7 +98,7 @@ public class GraphDSLDocTest extends AbstractJavaTest { ); // unconnected zip.out (!) => "The inlets [] and outlets [] must correspond to the inlets [] and outlets [ZipWith2.out]" //#simple-graph - fail("expected IllegalArgumentException"); + org.junit.Assert.fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { assertTrue(e != null && e.getMessage() != null && e.getMessage().contains("must correspond to")); } diff --git a/akka-http-core/src/test/scala/akka/http/impl/engine/client/HighLevelOutgoingConnectionSpec.scala b/akka-http-core/src/test/scala/akka/http/impl/engine/client/HighLevelOutgoingConnectionSpec.scala index 4e37f69027..da2ad966f9 100644 --- a/akka-http-core/src/test/scala/akka/http/impl/engine/client/HighLevelOutgoingConnectionSpec.scala +++ b/akka-http-core/src/test/scala/akka/http/impl/engine/client/HighLevelOutgoingConnectionSpec.scala @@ -16,7 +16,7 @@ import akka.testkit.AkkaSpec import akka.http.scaladsl.{ Http, TestUtils } import akka.http.scaladsl.model._ import akka.stream.testkit.Utils -import org.scalatest.concurrent.ScalaFutures +import org.scalatest.concurrent.PatienceConfiguration.Timeout class HighLevelOutgoingConnectionSpec extends AkkaSpec { implicit val materializer = ActorMaterializer(ActorMaterializerSettings(system).withFuzzing(true)) @@ -38,8 +38,7 @@ class HighLevelOutgoingConnectionSpec extends AkkaSpec { .mapAsync(4)(_.entity.toStrict(1.second)) .map { r ⇒ val s = r.data.utf8String; log.debug(s); s.toInt } .runFold(0)(_ + _) - - result.futureValue(PatienceConfig(10.seconds)) shouldEqual N * (N + 1) / 2 + result.futureValue(Timeout(10.seconds)) should ===(N * (N + 1) / 2) binding.futureValue.unbind() } @@ -73,7 +72,7 @@ class HighLevelOutgoingConnectionSpec extends AkkaSpec { .map { r ⇒ val s = r.data.utf8String; log.debug(s); s.toInt } .runFold(0)(_ + _) - result.futureValue(PatienceConfig(10.seconds)) shouldEqual C * N * (N + 1) / 2 + result.futureValue(Timeout(10.seconds)) should ===(C * N * (N + 1) / 2) binding.futureValue.unbind() } diff --git a/akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/PathDirectivesSpec.scala b/akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/PathDirectivesSpec.scala index 608f8bf37a..4f173e18e7 100644 --- a/akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/PathDirectivesSpec.scala +++ b/akka-http-tests/src/test/scala/akka/http/scaladsl/server/directives/PathDirectivesSpec.scala @@ -6,6 +6,7 @@ package akka.http.scaladsl.server.directives import akka.http.scaladsl.model.StatusCodes import akka.http.scaladsl.server._ +import org.scalactic.source.Position import org.scalatest.Inside class PathDirectivesSpec extends RoutingSpec with Inside { @@ -15,83 +16,83 @@ class PathDirectivesSpec extends RoutingSpec with Inside { """path("foo")""" should { val test = testFor(path("foo") { echoUnmatchedPath }) - "reject [/bar]" in test() - "reject [/foobar]" in test() - "reject [/foo/bar]" in test() - "accept [/foo] and clear the unmatchedPath" in test("") - "reject [/foo/]" in test() + "reject [/bar]" inThe test() + "reject [/foobar]" inThe test() + "reject [/foo/bar]" inThe test() + "accept [/foo] and clear the unmatchedPath" inThe test("") + "reject [/foo/]" inThe test() } """pathPrefix("")""" should { val test = testFor(pathPrefix("") { echoUnmatchedPath }) // Should match everything because pathPrefix is used and "" is a neutral element. - "accept [/] and clear the unmatchedPath=" in test("") - "accept [/foo] and clear the unmatchedPath" in test("foo") - "accept [/foo/] and clear the unmatchedPath" in test("foo/") - "accept [/bar/] and clear the unmatchedPath" in test("bar/") + "accept [/] and clear the unmatchedPath=" inThe test("") + "accept [/foo] and clear the unmatchedPath" inThe test("foo") + "accept [/foo/] and clear the unmatchedPath" inThe test("foo/") + "accept [/bar/] and clear the unmatchedPath" inThe test("bar/") } """path("" | "foo")""" should { val test = testFor(path("" | "foo") { echoUnmatchedPath }) // Should not match anything apart of "/", because path requires whole path being matched. - "accept [/] and clear the unmatchedPath=" in test("") - "reject [/foo]" in test() - "reject [/foo/]" in test() - "reject [/bar/]" in test() + "accept [/] and clear the unmatchedPath=" inThe test("") + "reject [/foo]" inThe test() + "reject [/foo/]" inThe test() + "reject [/bar/]" inThe test() } """path("") ~ path("foo")""" should { val test = testFor(path("")(echoUnmatchedPath) ~ path("foo")(echoUnmatchedPath)) // Should match both because ~ operator is used for two exclusive routes. - "accept [/] and clear the unmatchedPath=" in test("") - "accept [/foo] and clear the unmatchedPath=" in test("") + "accept [/] and clear the unmatchedPath=" inThe test("") + "accept [/foo] and clear the unmatchedPath=" inThe test("") } """path("foo" /)""" should { val test = testFor(path("foo" /) { echoUnmatchedPath }) - "reject [/foo]" in test() - "accept [/foo/] and clear the unmatchedPath" in test("") + "reject [/foo]" inThe test() + "accept [/foo/] and clear the unmatchedPath" inThe test("") } """path("")""" should { val test = testFor(path("") { echoUnmatchedPath }) - "reject [/foo]" in test() + "reject [/foo]" inThe test() "accept [/] and clear the unmatchedPath" in test("") } """pathPrefix("foo")""" should { val test = testFor(pathPrefix("foo") { echoUnmatchedPath }) - "reject [/bar]" in test() - "accept [/foobar]" in test("bar") - "accept [/foo/bar]" in test("/bar") - "accept [/foo] and clear the unmatchedPath" in test("") - "accept [/foo/] and clear the unmatchedPath" in test("/") + "reject [/bar]" inThe test() + "accept [/foobar]" inThe test("bar") + "accept [/foo/bar]" inThe test("/bar") + "accept [/foo] and clear the unmatchedPath" inThe test("") + "accept [/foo/] and clear the unmatchedPath" inThe test("/") } """pathPrefix("foo" / "bar")""" should { val test = testFor(pathPrefix("foo" / "bar") { echoUnmatchedPath }) - "reject [/bar]" in test() - "accept [/foo/bar]" in test("") - "accept [/foo/bar/baz]" in test("/baz") + "reject [/bar]" inThe test() + "accept [/foo/bar]" inThe test("") + "accept [/foo/bar/baz]" inThe test("/baz") } """pathPrefix("ab[cd]+".r)""" should { val test = testFor(pathPrefix("ab[cd]+".r) { echoCaptureAndUnmatchedPath }) - "reject [/bar]" in test() - "reject [/ab/cd]" in test() - "accept [/abcdef]" in test("abcd:ef") - "accept [/abcdd/ef]" in test("abcdd:/ef") + "reject [/bar]" inThe test() + "reject [/ab/cd]" inThe test() + "accept [/abcdef]" inThe test("abcd:ef") + "accept [/abcdd/ef]" inThe test("abcdd:/ef") } """pathPrefix("ab(cd)".r)""" should { val test = testFor(pathPrefix("ab(cd)+".r) { echoCaptureAndUnmatchedPath }) - "reject [/bar]" in test() - "reject [/ab/cd]" in test() - "accept [/abcdef]" in test("cd:ef") - "accept [/abcde/fg]" in test("cd:e/fg") + "reject [/bar]" inThe test() + "reject [/ab/cd]" inThe test() + "accept [/abcdef]" inThe test("cd:ef") + "accept [/abcde/fg]" inThe test("cd:e/fg") } "pathPrefix(regex)" should { @@ -102,11 +103,11 @@ class PathDirectivesSpec extends RoutingSpec with Inside { "pathPrefix(IntNumber)" should { val test = testFor(pathPrefix(IntNumber) { echoCaptureAndUnmatchedPath }) - "accept [/23]" in test("23:") - "accept [/12345yes]" in test("12345:yes") - "reject [/]" in test() - "reject [/abc]" in test() - "reject [/2147483648]" in test() // > Int.MaxValue + "accept [/23]" inThe test("23:") + "accept [/12345yes]" inThe test("12345:yes") + "reject [/]" inThe test() + "reject [/abc]" inThe test() + "reject [/2147483648]" inThe test() // > Int.MaxValue } "pathPrefix(CustomShortNumber)" should { @@ -115,200 +116,200 @@ class PathDirectivesSpec extends RoutingSpec with Inside { } val test = testFor(pathPrefix(CustomShortNumber) { echoCaptureAndUnmatchedPath }) - "accept [/23]" in test("23:") - "accept [/12345yes]" in test("12345:yes") - "reject [/]" in test() - "reject [/abc]" in test() - "reject [/33000]" in test() // > Short.MaxValue + "accept [/23]" inThe test("23:") + "accept [/12345yes]" inThe test("12345:yes") + "reject [/]" inThe test() + "reject [/abc]" inThe test() + "reject [/33000]" inThe test() // > Short.MaxValue } "pathPrefix(JavaUUID)" should { val test = testFor(pathPrefix(JavaUUID) { echoCaptureAndUnmatchedPath }) - "accept [/bdea8652-f26c-40ca-8157-0b96a2a8389d]" in test("bdea8652-f26c-40ca-8157-0b96a2a8389d:") - "accept [/bdea8652-f26c-40ca-8157-0b96a2a8389dyes]" in test("bdea8652-f26c-40ca-8157-0b96a2a8389d:yes") - "reject [/]" in test() - "reject [/abc]" in test() + "accept [/bdea8652-f26c-40ca-8157-0b96a2a8389d]" inThe test("bdea8652-f26c-40ca-8157-0b96a2a8389d:") + "accept [/bdea8652-f26c-40ca-8157-0b96a2a8389dyes]" inThe test("bdea8652-f26c-40ca-8157-0b96a2a8389d:yes") + "reject [/]" inThe test() + "reject [/abc]" inThe test() } "pathPrefix(Map(\"red\" -> 1, \"green\" -> 2, \"blue\" -> 3))" should { val test = testFor(pathPrefix(Map("red" → 1, "green" → 2, "blue" → 3)) { echoCaptureAndUnmatchedPath }) - "accept [/green]" in test("2:") - "accept [/redsea]" in test("1:sea") - "reject [/black]" in test() + "accept [/green]" inThe test("2:") + "accept [/redsea]" inThe test("1:sea") + "reject [/black]" inThe test() } "pathPrefix(Map.empty)" should { val test = testFor(pathPrefix(Map[String, Int]()) { echoCaptureAndUnmatchedPath }) - "reject [/black]" in test() + "reject [/black]" inThe test() } "pathPrefix(Segment)" should { val test = testFor(pathPrefix(Segment) { echoCaptureAndUnmatchedPath }) - "accept [/abc]" in test("abc:") - "accept [/abc/]" in test("abc:/") - "accept [/abc/def]" in test("abc:/def") - "reject [/]" in test() + "accept [/abc]" inThe test("abc:") + "accept [/abc/]" inThe test("abc:/") + "accept [/abc/def]" inThe test("abc:/def") + "reject [/]" inThe test() } "pathPrefix(Segments)" should { val test = testFor(pathPrefix(Segments) { echoCaptureAndUnmatchedPath }) - "accept [/]" in test("List():") - "accept [/a/b/c]" in test("List(a, b, c):") - "accept [/a/b/c/]" in test("List(a, b, c):/") + "accept [/]" inThe test("List():") + "accept [/a/b/c]" inThe test("List(a, b, c):") + "accept [/a/b/c/]" inThe test("List(a, b, c):/") } """pathPrefix(separateOnSlashes("a/b"))""" should { val test = testFor(pathPrefix(separateOnSlashes("a/b")) { echoUnmatchedPath }) - "accept [/a/b]" in test("") - "accept [/a/b/]" in test("/") - "reject [/a/c]" in test() + "accept [/a/b]" inThe test("") + "accept [/a/b/]" inThe test("/") + "reject [/a/c]" inThe test() } """pathPrefix(separateOnSlashes("abc"))""" should { val test = testFor(pathPrefix(separateOnSlashes("abc")) { echoUnmatchedPath }) - "accept [/abc]" in test("") - "accept [/abcdef]" in test("def") - "reject [/ab]" in test() + "accept [/abc]" inThe test("") + "accept [/abcdef]" inThe test("def") + "reject [/ab]" inThe test() } """pathPrefixTest("a" / Segment ~ Slash)""" should { val test = testFor(pathPrefixTest("a" / Segment ~ Slash) { echoCaptureAndUnmatchedPath }) - "accept [/a/bc/]" in test("bc:/a/bc/") - "reject [/a/bc]" in test() - "reject [/a/]" in test() + "accept [/a/bc/]" inThe test("bc:/a/bc/") + "reject [/a/bc]" inThe test() + "reject [/a/]" inThe test() } """pathSuffix("edit" / Segment)""" should { val test = testFor(pathSuffix("edit" / Segment) { echoCaptureAndUnmatchedPath }) - "accept [/orders/123/edit]" in test("123:/orders/") - "reject [/orders/123/ed]" in test() - "reject [/edit]" in test() + "accept [/orders/123/edit]" inThe test("123:/orders/") + "reject [/orders/123/ed]" inThe test() + "reject [/edit]" inThe test() } """pathSuffix("foo" / "bar" ~ "baz")""" should { val test = testFor(pathSuffix("foo" / "bar" ~ "baz") { echoUnmatchedPath }) - "accept [/orders/barbaz/foo]" in test("/orders/") - "reject [/orders/bazbar/foo]" in test() + "accept [/orders/barbaz/foo]" inThe test("/orders/") + "reject [/orders/bazbar/foo]" inThe test() } "pathSuffixTest(Slash)" should { val test = testFor(pathSuffixTest(Slash) { echoUnmatchedPath }) - "accept [/]" in test("/") - "accept [/foo/]" in test("/foo/") - "reject [/foo]" in test() + "accept [/]" inThe test("/") + "accept [/foo/]" inThe test("/foo/") + "reject [/foo]" inThe test() } """pathPrefix("foo" | "bar")""" should { val test = testFor(pathPrefix("foo" | "bar") { echoUnmatchedPath }) - "accept [/foo]" in test("") - "accept [/foops]" in test("ps") - "accept [/bar]" in test("") - "reject [/baz]" in test() + "accept [/foo]" inThe test("") + "accept [/foops]" inThe test("ps") + "accept [/bar]" inThe test("") + "reject [/baz]" inThe test() } """pathSuffix(!"foo")""" should { val test = testFor(pathSuffix(!"foo") { echoUnmatchedPath }) - "accept [/bar]" in test("/bar") - "reject [/foo]" in test() + "accept [/bar]" inThe test("/bar") + "reject [/foo]" inThe test() } "pathPrefix(IntNumber?)" should { val test = testFor(pathPrefix(IntNumber?) { echoCaptureAndUnmatchedPath }) - "accept [/12]" in test("Some(12):") - "accept [/12a]" in test("Some(12):a") - "accept [/foo]" in test("None:foo") + "accept [/12]" inThe test("Some(12):") + "accept [/12a]" inThe test("Some(12):a") + "accept [/foo]" inThe test("None:foo") } """pathPrefix("foo"?)""" should { val test = testFor(pathPrefix("foo"?) { echoUnmatchedPath }) - "accept [/foo]" in test("") - "accept [/fool]" in test("l") - "accept [/bar]" in test("bar") + "accept [/foo]" inThe test("") + "accept [/fool]" inThe test("l") + "accept [/bar]" inThe test("bar") } """pathPrefix("foo") & pathEnd""" should { val test = testFor((pathPrefix("foo") & pathEnd) { echoUnmatchedPath }) - "reject [/foobar]" in test() - "reject [/foo/bar]" in test() - "accept [/foo] and clear the unmatchedPath" in test("") - "reject [/foo/]" in test() + "reject [/foobar]" inThe test() + "reject [/foo/bar]" inThe test() + "accept [/foo] and clear the unmatchedPath" inThe test("") + "reject [/foo/]" inThe test() } """pathPrefix("foo") & pathEndOrSingleSlash""" should { val test = testFor((pathPrefix("foo") & pathEndOrSingleSlash) { echoUnmatchedPath }) - "reject [/foobar]" in test() - "reject [/foo/bar]" in test() - "accept [/foo] and clear the unmatchedPath" in test("") - "accept [/foo/] and clear the unmatchedPath" in test("") + "reject [/foobar]" inThe test() + "reject [/foo/bar]" inThe test() + "accept [/foo] and clear the unmatchedPath" inThe test("") + "accept [/foo/] and clear the unmatchedPath" inThe test("") } """pathPrefix(IntNumber.repeat(separator = "."))""" should { { val test = testFor(pathPrefix(IntNumber.repeat(min = 2, max = 5, separator = ".")) { echoCaptureAndUnmatchedPath }) - "reject [/foo]" in test() - "reject [/1foo]" in test() - "reject [/1.foo]" in test() - "accept [/1.2foo]" in test("List(1, 2):foo") - "accept [/1.2.foo]" in test("List(1, 2):.foo") - "accept [/1.2.3foo]" in test("List(1, 2, 3):foo") - "accept [/1.2.3.foo]" in test("List(1, 2, 3):.foo") - "accept [/1.2.3.4foo]" in test("List(1, 2, 3, 4):foo") - "accept [/1.2.3.4.foo]" in test("List(1, 2, 3, 4):.foo") - "accept [/1.2.3.4.5foo]" in test("List(1, 2, 3, 4, 5):foo") - "accept [/1.2.3.4.5.foo]" in test("List(1, 2, 3, 4, 5):.foo") - "accept [/1.2.3.4.5.6foo]" in test("List(1, 2, 3, 4, 5):.6foo") - "accept [/1.2.3.]" in test("List(1, 2, 3):.") - "accept [/1.2.3/]" in test("List(1, 2, 3):/") - "accept [/1.2.3./]" in test("List(1, 2, 3):./") + "reject [/foo]" inThe test() + "reject [/1foo]" inThe test() + "reject [/1.foo]" inThe test() + "accept [/1.2foo]" inThe test("List(1, 2):foo") + "accept [/1.2.foo]" inThe test("List(1, 2):.foo") + "accept [/1.2.3foo]" inThe test("List(1, 2, 3):foo") + "accept [/1.2.3.foo]" inThe test("List(1, 2, 3):.foo") + "accept [/1.2.3.4foo]" inThe test("List(1, 2, 3, 4):foo") + "accept [/1.2.3.4.foo]" inThe test("List(1, 2, 3, 4):.foo") + "accept [/1.2.3.4.5foo]" inThe test("List(1, 2, 3, 4, 5):foo") + "accept [/1.2.3.4.5.foo]" inThe test("List(1, 2, 3, 4, 5):.foo") + "accept [/1.2.3.4.5.6foo]" inThe test("List(1, 2, 3, 4, 5):.6foo") + "accept [/1.2.3.]" inThe test("List(1, 2, 3):.") + "accept [/1.2.3/]" inThe test("List(1, 2, 3):/") + "accept [/1.2.3./]" inThe test("List(1, 2, 3):./") } { val test = testFor(pathPrefix(IntNumber.repeat(2, ".")) { echoCaptureAndUnmatchedPath }) - "reject [/bar]" in test() - "reject [/1bar]" in test() - "reject [/1.bar]" in test() - "accept [/1.2bar]" in test("List(1, 2):bar") - "accept [/1.2.bar]" in test("List(1, 2):.bar") - "accept [/1.2.3bar]" in test("List(1, 2):.3bar") + "reject [/bar]" inThe test() + "reject [/1bar]" inThe test() + "reject [/1.bar]" inThe test() + "accept [/1.2bar]" inThe test("List(1, 2):bar") + "accept [/1.2.bar]" inThe test("List(1, 2):.bar") + "accept [/1.2.3bar]" inThe test("List(1, 2):.3bar") } } """rawPathPrefix(Slash ~ "a" / Segment ~ Slash)""" should { val test = testFor(rawPathPrefix(Slash ~ "a" / Segment ~ Slash) { echoCaptureAndUnmatchedPath }) - "accept [/a/bc/]" in test("bc:") - "reject [/a/bc]" in test() - "reject [/ab/]" in test() + "accept [/a/bc/]" inThe test("bc:") + "reject [/a/bc]" inThe test() + "reject [/ab/]" inThe test() } """rawPathPrefixTest(Slash ~ "a" / Segment ~ Slash)""" should { val test = testFor(rawPathPrefixTest(Slash ~ "a" / Segment ~ Slash) { echoCaptureAndUnmatchedPath }) - "accept [/a/bc/]" in test("bc:/a/bc/") - "reject [/a/bc]" in test() - "reject [/ab/]" in test() + "accept [/a/bc/]" inThe test("bc:/a/bc/") + "reject [/a/bc]" inThe test() + "reject [/ab/]" inThe test() } "PathMatchers" should { { val test = testFor(path(Remaining.tmap { case Tuple1(s) ⇒ Tuple1(s.split('-').toList) }) { echoComplete }) - "support the hmap modifier in accept [/yes-no]" in test("List(yes, no)") + "support the hmap modifier in accept [/yes-no]" inThe test("List(yes, no)") } { val test = testFor(path(Remaining.map(_.split('-').toList)) { echoComplete }) - "support the map modifier in accept [/yes-no]" in test("List(yes, no)") + "support the map modifier in accept [/yes-no]" inThe test("List(yes, no)") } { val test = testFor(path(Remaining.tflatMap { case Tuple1(s) ⇒ Some(s).filter("yes" ==).map(x ⇒ Tuple1(x)) }) { echoComplete }) - "support the hflatMap modifier in accept [/yes]" in test("yes") - "support the hflatMap modifier in reject [/blub]" in test() + "support the hflatMap modifier in accept [/yes]" inThe test("yes") + "support the hflatMap modifier in reject [/blub]" inThe test() } { val test = testFor(path(Remaining.flatMap(s ⇒ Some(s).filter("yes" ==))) { echoComplete }) - "support the flatMap modifier in accept [/yes]" in test("yes") - "support the flatMap modifier reject [/blub]" in test() + "support the flatMap modifier in accept [/yes]" inThe test("yes") + "support the flatMap modifier reject [/blub]" inThe test() } } implicit class WithIn(str: String) { - def in(f: String ⇒ Unit) = convertToWordSpecStringWrapper(str) in f(str) - def in(body: ⇒ Unit) = convertToWordSpecStringWrapper(str) in body + def inThe(f: String ⇒ Unit) = convertToWordSpecStringWrapper(str) in f(str) + def inThe(body: ⇒ Unit) = convertToWordSpecStringWrapper(str) in body } case class testFor(route: Route) { diff --git a/akka-persistence-tck/src/main/scala/akka/persistence/japi/journal/JavaJournalPerfSpec.scala b/akka-persistence-tck/src/main/scala/akka/persistence/japi/journal/JavaJournalPerfSpec.scala index fb0d63d59f..b5ef3b2dbe 100644 --- a/akka-persistence-tck/src/main/scala/akka/persistence/japi/journal/JavaJournalPerfSpec.scala +++ b/akka-persistence-tck/src/main/scala/akka/persistence/japi/journal/JavaJournalPerfSpec.scala @@ -6,6 +6,7 @@ package akka.persistence.japi.journal import akka.persistence.CapabilityFlag import akka.persistence.journal.JournalPerfSpec import com.typesafe.config.Config +import org.scalactic.source.Position import org.scalatest.Informer /** @@ -43,7 +44,8 @@ import org.scalatest.Informer */ class JavaJournalPerfSpec(config: Config) extends JournalPerfSpec(config) { override protected def info: Informer = new Informer { - override def apply(message: String, payload: Option[Any]): Unit = System.out.println(message) + override def apply(message: String, payload: Option[Any])(implicit pos: Position): Unit = + System.out.println(message) } override protected def supportsRejectingNonSerializableObjects: CapabilityFlag = CapabilityFlag.on diff --git a/akka-persistence-tck/src/main/scala/akka/persistence/scalatest/MayVerb.scala b/akka-persistence-tck/src/main/scala/akka/persistence/scalatest/MayVerb.scala index 66e2282833..7102f8bccd 100644 --- a/akka-persistence-tck/src/main/scala/akka/persistence/scalatest/MayVerb.scala +++ b/akka-persistence-tck/src/main/scala/akka/persistence/scalatest/MayVerb.scala @@ -3,6 +3,7 @@ */ package akka.persistence.scalatest +import org.scalactic.source.Position import org.scalatest.exceptions.TestCanceledException import org.scalatest.words.StringVerbBlockRegistration @@ -37,8 +38,8 @@ trait MayVerb { * * @see RFC 2119 */ - def may(right: ⇒ Unit)(implicit fun: StringVerbBlockRegistration) { - fun(leftSideString, "may", right _) + def may(right: ⇒ Unit)(implicit fun: StringVerbBlockRegistration, pos: Position) { + fun(leftSideString, "may", pos, right _) } } diff --git a/akka-persistence/src/test/scala/akka/persistence/PersistentActorStashingSpec.scala b/akka-persistence/src/test/scala/akka/persistence/PersistentActorStashingSpec.scala index d99191744b..e08fe61250 100644 --- a/akka-persistence/src/test/scala/akka/persistence/PersistentActorStashingSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/PersistentActorStashingSpec.scala @@ -166,7 +166,7 @@ abstract class PersistentActorStashingSpec(config: Config) extends PersistenceSp cmds foreach (persistentActor ! _) persistentActor ! GetState - expectMsg(evts) + expectMsg(evts.toList) } } diff --git a/akka-remote-tests/src/test/scala/org/scalatest/extra/QuietReporter.scala b/akka-remote-tests/src/test/scala/org/scalatest/extra/QuietReporter.scala index bc21e5edf8..ef9978d8dd 100644 --- a/akka-remote-tests/src/test/scala/org/scalatest/extra/QuietReporter.scala +++ b/akka-remote-tests/src/test/scala/org/scalatest/extra/QuietReporter.scala @@ -8,7 +8,8 @@ import org.scalatest.tools.StandardOutReporter import org.scalatest.events._ import java.lang.Boolean.getBoolean -class QuietReporter(inColor: Boolean, withDurations: Boolean = false) extends StandardOutReporter(withDurations, inColor, false, true, false, false, false, false, false) { +class QuietReporter(inColor: Boolean, withDurations: Boolean = false) + extends StandardOutReporter(withDurations, inColor, false, true, false, false, false, false, false, false) { def this() = this(!getBoolean("akka.test.nocolor"), !getBoolean("akka.test.nodurations")) diff --git a/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala b/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala index 2da9207c72..b5b0a7a480 100644 --- a/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala @@ -188,7 +188,7 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat() //2000 fd.heartbeat() //2500 val phi2 = fd.phi //3000 - phi2 should ===(phi1.plusOrMinus(0.001)) + phi2 should ===(phi1 +- (0.001)) } } diff --git a/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala b/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala index 4999a00548..23feeac38c 100644 --- a/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala @@ -458,8 +458,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D "be able to use multiple transports and use the appropriate one (TCP)" in { val r = system.actorOf(Props[Echo1], "gonk") - r.path.toString should be === - s"akka.tcp://remote-sys@localhost:${port(remoteSystem, "tcp")}/remote/akka.tcp/RemotingSpec@localhost:${port(system, "tcp")}/user/gonk" + r.path.toString should ===(s"akka.tcp://remote-sys@localhost:${port(remoteSystem, "tcp")}/remote/akka.tcp/RemotingSpec@localhost:${port(system, "tcp")}/user/gonk") r ! 42 expectMsg(42) EventFilter[Exception]("crash", occurrences = 1).intercept { @@ -474,8 +473,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D "be able to use multiple transports and use the appropriate one (UDP)" in { val r = system.actorOf(Props[Echo1], "zagzag") - r.path.toString should be === - s"akka.udp://remote-sys@localhost:${port(remoteSystem, "udp")}/remote/akka.udp/RemotingSpec@localhost:${port(system, "udp")}/user/zagzag" + r.path.toString should ===(s"akka.udp://remote-sys@localhost:${port(remoteSystem, "udp")}/remote/akka.udp/RemotingSpec@localhost:${port(system, "udp")}/user/zagzag") r ! 42 expectMsg(10.seconds, 42) EventFilter[Exception]("crash", occurrences = 1).intercept { @@ -490,8 +488,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D "be able to use multiple transports and use the appropriate one (SSL)" in { val r = system.actorOf(Props[Echo1], "roghtaar") - r.path.toString should be === - s"akka.ssl.tcp://remote-sys@localhost:${port(remoteSystem, "ssl.tcp")}/remote/akka.ssl.tcp/RemotingSpec@localhost:${port(system, "ssl.tcp")}/user/roghtaar" + r.path.toString should ===(s"akka.ssl.tcp://remote-sys@localhost:${port(remoteSystem, "ssl.tcp")}/remote/akka.ssl.tcp/RemotingSpec@localhost:${port(system, "ssl.tcp")}/user/roghtaar") r ! 42 expectMsg(10.seconds, 42) EventFilter[Exception]("crash", occurrences = 1).intercept { diff --git a/akka-stream-tests/src/test/java/akka/stream/javadsl/FlowTest.java b/akka-stream-tests/src/test/java/akka/stream/javadsl/FlowTest.java index 55589e9b1d..e8c8f54641 100644 --- a/akka-stream-tests/src/test/java/akka/stream/javadsl/FlowTest.java +++ b/akka-stream-tests/src/test/java/akka/stream/javadsl/FlowTest.java @@ -804,7 +804,7 @@ public class FlowTest extends StreamTest { try { Source. maybe().via(Flow.of(Integer.class).initialTimeout(Duration.create(1, "second"))) .runWith(Sink. head(), materializer).toCompletableFuture().get(3, TimeUnit.SECONDS); - fail("A TimeoutException was expected"); + org.junit.Assert.fail("A TimeoutException was expected"); } catch (ExecutionException e) { throw e.getCause(); } @@ -820,7 +820,7 @@ public class FlowTest extends StreamTest { try { Source. maybe().via(Flow.of(Integer.class).completionTimeout(Duration.create(1, "second"))) .runWith(Sink. head(), materializer).toCompletableFuture().get(3, TimeUnit.SECONDS); - fail("A TimeoutException was expected"); + org.junit.Assert.fail("A TimeoutException was expected"); } catch (ExecutionException e) { throw e.getCause(); } @@ -835,7 +835,7 @@ public class FlowTest extends StreamTest { try { Source. maybe().via(Flow.of(Integer.class).idleTimeout(Duration.create(1, "second"))) .runWith(Sink. head(), materializer).toCompletableFuture().get(3, TimeUnit.SECONDS); - fail("A TimeoutException was expected"); + org.junit.Assert.fail("A TimeoutException was expected"); } catch (ExecutionException e) { throw e.getCause(); } diff --git a/akka-stream-tests/src/test/java/akka/stream/javadsl/SourceTest.java b/akka-stream-tests/src/test/java/akka/stream/javadsl/SourceTest.java index 390344b512..b3fd3bc457 100644 --- a/akka-stream-tests/src/test/java/akka/stream/javadsl/SourceTest.java +++ b/akka-stream-tests/src/test/java/akka/stream/javadsl/SourceTest.java @@ -767,7 +767,7 @@ public class SourceTest extends StreamTest { try { Source.maybe().initialTimeout(Duration.create(1, "second")).runWith(Sink.head(), materializer) .toCompletableFuture().get(3, TimeUnit.SECONDS); - fail("A TimeoutException was expected"); + org.junit.Assert.fail("A TimeoutException was expected"); } catch (ExecutionException e) { throw e.getCause(); } @@ -782,7 +782,7 @@ public class SourceTest extends StreamTest { try { Source.maybe().completionTimeout(Duration.create(1, "second")).runWith(Sink.head(), materializer) .toCompletableFuture().get(3, TimeUnit.SECONDS); - fail("A TimeoutException was expected"); + org.junit.Assert.fail("A TimeoutException was expected"); } catch (ExecutionException e) { throw e.getCause(); } @@ -797,7 +797,7 @@ public class SourceTest extends StreamTest { try { Source.maybe().idleTimeout(Duration.create(1, "second")).runWith(Sink.head(), materializer) .toCompletableFuture().get(3, TimeUnit.SECONDS); - fail("A TimeoutException was expected"); + org.junit.Assert.fail("A TimeoutException was expected"); } catch (ExecutionException e) { throw e.getCause(); } diff --git a/akka-stream-tests/src/test/scala/akka/stream/impl/ResizableMultiReaderRingBufferSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/impl/ResizableMultiReaderRingBufferSpec.scala index a52845fdbb..abb0ec52fe 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/impl/ResizableMultiReaderRingBufferSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/impl/ResizableMultiReaderRingBufferSpec.scala @@ -4,10 +4,10 @@ package akka.stream.impl import scala.util.Random -import org.scalatest.{ ShouldMatchers, WordSpec } +import org.scalatest.{ Matchers, WordSpec } import akka.stream.impl.ResizableMultiReaderRingBuffer._ -class ResizableMultiReaderRingBufferSpec extends WordSpec with ShouldMatchers { +class ResizableMultiReaderRingBufferSpec extends WordSpec with Matchers { "A ResizableMultiReaderRingBuffer" should { diff --git a/akka-stream-tests/src/test/scala/akka/stream/impl/StreamLayoutSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/impl/StreamLayoutSpec.scala index d0cc8e71eb..bf76240782 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/impl/StreamLayoutSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/impl/StreamLayoutSpec.scala @@ -7,6 +7,7 @@ import akka.stream._ import akka.stream.scaladsl._ import akka.stream.testkit.StreamSpec import org.reactivestreams.{ Publisher, Subscriber, Subscription } +import org.scalatest.concurrent.PatienceConfiguration.Timeout import scala.concurrent.duration._ @@ -126,7 +127,7 @@ class StreamLayoutSpec extends StreamSpec { } // Seen tests run in 9-10 seconds, these test cases are heavy on the GC - val veryPatient = PatienceConfig(20.seconds) + val veryPatient = Timeout(20.seconds) "not fail materialization when building a large graph with simple computation" when { diff --git a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncSpec.scala index 1e5dc84e76..ac16f2d693 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncSpec.scala @@ -7,6 +7,7 @@ import scala.concurrent.Await import scala.concurrent.Future import scala.concurrent.duration._ import java.util.concurrent.ThreadLocalRandom + import scala.util.control.NoStackTrace import akka.stream.ActorMaterializer import akka.stream.testkit._ @@ -16,11 +17,14 @@ import akka.testkit.TestProbe import akka.stream.ActorAttributes.supervisionStrategy import akka.stream.Supervision.resumingDecider import akka.stream.impl.ReactiveStreamsCompliance + import scala.annotation.tailrec import scala.concurrent.Promise import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.LinkedBlockingQueue +import org.scalatest.concurrent.PatienceConfiguration.Timeout + class FlowMapAsyncSpec extends StreamSpec { implicit val materializer = ActorMaterializer() @@ -245,7 +249,7 @@ class FlowMapAsyncSpec extends StreamSpec { Source(1 to N) .mapAsync(parallelism)(i ⇒ deferred()) .runFold(0)((c, _) ⇒ c + 1) - .futureValue(PatienceConfig(3.seconds)) should ===(N) + .futureValue(Timeout(3.seconds)) should ===(N) } finally { timer.interrupt() } diff --git a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncUnorderedSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncUnorderedSpec.scala index 3d1d8955c5..558ec85495 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncUnorderedSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/FlowMapAsyncUnorderedSpec.scala @@ -7,7 +7,7 @@ import scala.concurrent.Await import scala.concurrent.Future import scala.concurrent.duration._ import scala.util.control.NoStackTrace -import akka.stream.{ ActorMaterializer } +import akka.stream.ActorMaterializer import akka.stream.testkit._ import akka.stream.testkit.scaladsl._ import akka.stream.testkit.Utils._ @@ -17,8 +17,11 @@ import akka.stream.ActorAttributes.supervisionStrategy import akka.stream.Supervision.resumingDecider import akka.stream.impl.ReactiveStreamsCompliance import java.util.concurrent.atomic.AtomicInteger + import scala.concurrent.Promise import java.util.concurrent.LinkedBlockingQueue +import org.scalatest.concurrent.PatienceConfiguration.Timeout + import scala.annotation.tailrec class FlowMapAsyncUnorderedSpec extends StreamSpec { @@ -236,7 +239,7 @@ class FlowMapAsyncUnorderedSpec extends StreamSpec { Source(1 to N) .mapAsyncUnordered(parallelism)(i ⇒ deferred()) .runFold(0)((c, _) ⇒ c + 1) - .futureValue(PatienceConfig(3.seconds)) should ===(N) + .futureValue(Timeout(3.seconds)) should ===(N) } finally { timer.interrupt() } diff --git a/akka-typed/src/test/scala/akka/typed/ActorContextSpec.scala b/akka-typed/src/test/scala/akka/typed/ActorContextSpec.scala index 0fad48a56a..7fce39a353 100644 --- a/akka-typed/src/test/scala/akka/typed/ActorContextSpec.scala +++ b/akka-typed/src/test/scala/akka/typed/ActorContextSpec.scala @@ -2,7 +2,6 @@ package akka.typed import scala.concurrent.duration._ import scala.concurrent.Future -import org.scalautils.ConversionCheckedTripleEquals import com.typesafe.config.ConfigFactory import akka.actor.DeadLetterSuppression diff --git a/akka-typed/src/test/scala/akka/typed/BehaviorSpec.scala b/akka-typed/src/test/scala/akka/typed/BehaviorSpec.scala index 9ce6bd9dac..241b3dc794 100644 --- a/akka-typed/src/test/scala/akka/typed/BehaviorSpec.scala +++ b/akka-typed/src/test/scala/akka/typed/BehaviorSpec.scala @@ -3,8 +3,6 @@ */ package akka.typed -import org.scalautils.ConversionCheckedTripleEquals - class BehaviorSpec extends TypedSpec { sealed trait Command { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c880fef8f5..0e6f0fcbb7 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -19,15 +19,11 @@ object Dependencies { crossScalaVersions := Seq("2.11.8"), // "2.12.0-M4" scalaVersion := crossScalaVersions.value.head, scalaStmVersion := sys.props.get("akka.build.scalaStmVersion").getOrElse("0.7"), - scalaCheckVersion := sys.props.get("akka.build.scalaCheckVersion").getOrElse("1.11.6"), + scalaCheckVersion := sys.props.get("akka.build.scalaCheckVersion").getOrElse("1.13.2"), scalaTestVersion := { scalaVersion.value match { - case "2.12.0-M1" => "2.2.5-M1" - case "2.12.0-M2" => "2.2.5-M2" - case "2.12.0-M3" => "2.2.5-M3" - case "2.12.0-M4" => "2.2.6" - case "2.12.0-M5" => "3.0.0-RC4" - case _ => "2.2.4" + case "2.12.0-M5" => "3.0.0" + case _ => "3.0.0" } }, java8CompatVersion := {