From 003609c9c5a85ebead3506a99d3f81cc8aa02260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Antonsson?= Date: Tue, 17 Dec 2013 14:25:56 +0100 Subject: [PATCH] =pro #3759 Changed to using non-deprecated ScalaTest Matchers --- .../test/scala/akka/AkkaExceptionSpec.scala | 4 +- .../test/scala/akka/actor/ActorDSLSpec.scala | 18 +- .../ActorFireForgetRequestReplySpec.scala | 8 +- .../scala/akka/actor/ActorLifeCycleSpec.scala | 2 +- .../scala/akka/actor/ActorLookupSpec.scala | 164 ++++++++--------- .../scala/akka/actor/ActorMailboxSpec.scala | 2 +- .../test/scala/akka/actor/ActorPathSpec.scala | 42 ++--- .../test/scala/akka/actor/ActorRefSpec.scala | 38 ++-- .../scala/akka/actor/ActorSelectionSpec.scala | 170 +++++++++--------- .../scala/akka/actor/ActorSystemSpec.scala | 30 ++-- .../scala/akka/actor/ActorWithStashSpec.scala | 2 +- .../scala/akka/actor/DeathWatchSpec.scala | 8 +- .../test/scala/akka/actor/DeployerSpec.scala | 44 ++--- .../test/scala/akka/actor/FSMActorSpec.scala | 4 +- .../test/scala/akka/actor/FSMTimingSpec.scala | 2 +- .../actor/LocalActorRefProviderSpec.scala | 32 ++-- .../scala/akka/actor/ReceiveTimeoutSpec.scala | 2 +- .../akka/actor/RelativeActorPathSpec.scala | 12 +- .../test/scala/akka/actor/SchedulerSpec.scala | 38 ++-- .../akka/actor/SupervisorHierarchySpec.scala | 6 +- .../scala/akka/actor/SupervisorMiscSpec.scala | 8 +- .../scala/akka/actor/SupervisorSpec.scala | 4 +- .../scala/akka/actor/SupervisorTreeSpec.scala | 2 +- .../scala/akka/actor/TypedActorSpec.scala | 116 ++++++------ .../dispatch/BalancingDispatcherSpec.scala | 8 +- .../akka/actor/dispatch/DispatchersSpec.scala | 10 +- .../akka/actor/routing/ListenerSpec.scala | 2 +- .../test/scala/akka/config/ConfigSpec.scala | 116 ++++++------ .../scala/akka/dataflow/Future2Actor.scala | 8 +- .../akka/dispatch/ExecutionContextSpec.scala | 36 ++-- .../test/scala/akka/dispatch/FutureSpec.scala | 160 ++++++++--------- .../akka/dispatch/MailboxConfigSpec.scala | 50 +++--- .../dispatch/PriorityDispatcherSpec.scala | 2 +- .../sysmsg/SystemMessageListSpec.scala | 80 ++++----- .../test/scala/akka/event/EventBusSpec.scala | 26 +-- .../scala/akka/event/EventStreamSpec.scala | 130 +++++++------- .../test/scala/akka/event/LoggerSpec.scala | 10 +- .../test/scala/akka/io/BackpressureSpec.scala | 12 +- .../scala/akka/io/CapacityLimitSpec.scala | 4 +- .../src/test/scala/akka/io/PipelineSpec.scala | 42 ++--- .../scala/akka/io/TcpConnectionSpec.scala | 76 ++++---- .../scala/akka/io/TcpIntegrationSpec.scala | 4 +- .../test/scala/akka/io/TcpListenerSpec.scala | 4 +- .../akka/io/UdpConnectedIntegrationSpec.scala | 10 +- .../scala/akka/io/UdpIntegrationSpec.scala | 10 +- .../ConfiguredLocalRoutingSpec.scala | 20 +-- .../ConsistentHashingRouterSpec.scala | 2 +- .../scala/akka/oldrouting/ResizerSpec.scala | 36 ++-- .../scala/akka/oldrouting/RoutingSpec.scala | 62 +++---- .../src/test/scala/akka/pattern/AskSpec.scala | 16 +- .../akka/pattern/CircuitBreakerMTSpec.scala | 16 +- .../akka/pattern/CircuitBreakerSpec.scala | 22 +-- .../test/scala/akka/pattern/PatternSpec.scala | 6 +- .../test/scala/akka/pattern/PipeToSpec.scala | 12 +- .../TellLatencyPerformanceSpec.scala | 2 +- ...ThroughputComputationPerformanceSpec.scala | 2 +- .../TellThroughputPerformanceSpec.scala | 2 +- .../TradingLatencyPerformanceSpec.scala | 4 +- .../TradingThroughputPerformanceSpec.scala | 4 +- .../scala/akka/routing/BroadcastSpec.scala | 8 +- .../routing/ConfiguredLocalRoutingSpec.scala | 12 +- .../routing/ConsistentHashingRouterSpec.scala | 2 +- .../test/scala/akka/routing/RandomSpec.scala | 6 +- .../test/scala/akka/routing/ResizerSpec.scala | 36 ++-- .../scala/akka/routing/RoundRobinSpec.scala | 18 +- .../test/scala/akka/routing/RoutingSpec.scala | 16 +- .../ScatterGatherFirstCompletedSpec.scala | 6 +- .../akka/routing/SmallestMailboxSpec.scala | 8 +- .../akka/serialization/SerializeSpec.scala | 50 +++--- .../test/scala/akka/util/ByteStringSpec.scala | 4 +- .../test/scala/akka/util/DurationSpec.scala | 50 +++--- .../src/test/scala/akka/util/IndexSpec.scala | 42 ++--- .../src/test/scala/akka/util/SwitchSpec.scala | 74 ++++---- .../src/test/scala/akka/agent/AgentSpec.scala | 38 ++-- .../camel/ActivationIntegrationTest.scala | 12 +- .../scala/akka/camel/CamelConfigSpec.scala | 18 +- .../scala/akka/camel/CamelMessageTest.scala | 4 +- .../akka/camel/ConcurrentActivationTest.scala | 14 +- .../akka/camel/ConsumerIntegrationTest.scala | 32 ++-- .../scala/akka/camel/DefaultCamelTest.scala | 6 +- .../scala/akka/camel/MessageScalaTest.scala | 22 +-- .../akka/camel/ProducerFeatureTest.scala | 24 +-- .../akka/camel/UntypedProducerTest.scala | 8 +- .../internal/ActivationTrackerTest.scala | 4 +- .../ActorComponentConfigurationTest.scala | 8 +- .../component/ActorEndpointPathTest.scala | 8 +- .../component/ActorProducerTest.scala | 24 +-- .../component/DurationConverterTest.scala | 20 +-- .../scala/akka/channels/ChannelSpec.scala | 100 +++++------ ...ientDowningNodeThatIsUnreachableSpec.scala | 2 +- .../ClientDowningNodeThatIsUpSpec.scala | 2 +- .../ClusterAccrualFailureDetectorSpec.scala | 14 +- .../akka/cluster/ClusterDeathWatchSpec.scala | 34 ++-- .../cluster/ClusterMetricsDisabledSpec.scala | 4 +- .../akka/cluster/ClusterMetricsSpec.scala | 8 +- .../scala/akka/cluster/ConvergenceSpec.scala | 16 +- .../DisallowJoinOfTwoClustersSpec.scala | 2 +- .../akka/cluster/InitialHeartbeatSpec.scala | 4 +- .../akka/cluster/JoinInProgressSpec.scala | 2 +- .../akka/cluster/LeaderElectionSpec.scala | 12 +- .../akka/cluster/LeaderLeavingSpec.scala | 6 +- .../scala/akka/cluster/MBeanSpec.scala | 46 ++--- .../akka/cluster/MinMembersBeforeUpSpec.scala | 12 +- .../akka/cluster/MultiNodeClusterSpec.scala | 26 +-- ...LeavingAndExitingAndBeingRemovedSpec.scala | 4 +- .../akka/cluster/NodeMembershipSpec.scala | 16 +- .../scala/akka/cluster/NodeUpSpec.scala | 6 +- .../cluster/RestartFirstSeedNodeSpec.scala | 10 +- .../akka/cluster/SingletonClusterSpec.scala | 6 +- .../scala/akka/cluster/StressSpec.scala | 40 ++--- .../scala/akka/cluster/SunnyWeatherSpec.scala | 2 +- .../SurviveNetworkInstabilitySpec.scala | 16 +- .../scala/akka/cluster/TransitionSpec.scala | 32 ++-- .../UnreachableNodeJoinsAgainSpec.scala | 22 +-- .../AdaptiveLoadBalancingRouterSpec.scala | 24 +-- .../ClusterConsistentHashingRouterSpec.scala | 16 +- .../ClusterRoundRobinRoutedActorSpec.scala | 90 +++++----- .../AdaptiveLoadBalancingRouterSpec.scala | 24 +-- .../ClusterConsistentHashingRouterSpec.scala | 16 +- .../routing/ClusterRoundRobinSpec.scala | 90 +++++----- .../akka/cluster/ClusterConfigSpec.scala | 66 +++---- .../akka/cluster/ClusterDeployerSpec.scala | 16 +- .../akka/cluster/ClusterDomainEventSpec.scala | 56 +++--- .../ClusterHeartbeatSenderStateSpec.scala | 74 ++++---- .../test/scala/akka/cluster/ClusterSpec.scala | 18 +- .../test/scala/akka/cluster/EWMASpec.scala | 40 ++--- .../test/scala/akka/cluster/GossipSpec.scala | 50 +++--- .../cluster/HeartbeatNodeRingPerfSpec.scala | 4 +- .../akka/cluster/HeartbeatNodeRingSpec.scala | 18 +- .../akka/cluster/MemberOrderingSpec.scala | 80 ++++----- .../cluster/MetricNumericConverterSpec.scala | 36 ++-- .../scala/akka/cluster/MetricValuesSpec.scala | 18 +- .../akka/cluster/MetricsCollectorSpec.scala | 38 ++-- .../akka/cluster/MetricsGossipSpec.scala | 62 +++---- .../scala/akka/cluster/NodeMetricsSpec.scala | 20 +-- .../akka/cluster/ReachabilityPerfSpec.scala | 4 +- .../scala/akka/cluster/ReachabilitySpec.scala | 134 +++++++------- .../cluster/SerializationChecksSpec.scala | 4 +- .../SerializeCreatorsVerificationSpec.scala | 4 +- .../akka/cluster/VectorClockPerfSpec.scala | 4 +- .../scala/akka/cluster/VectorClockSpec.scala | 100 +++++------ .../ClusterMessageSerializerSpec.scala | 8 +- .../cluster/routing/MetricsSelectorSpec.scala | 40 ++--- .../cluster/routing/WeightedRouteesSpec.scala | 28 +-- .../contrib/pattern/ClusterClientSpec.scala | 4 +- .../contrib/pattern/ClusterShardingSpec.scala | 22 +-- .../ClusterSingletonManagerChaosSpec.scala | 8 +- .../pattern/ClusterSingletonManagerSpec.scala | 4 +- .../DistributedPubSubMediatorSpec.scala | 30 ++-- .../contrib/pattern/ReliableProxySpec.scala | 6 +- .../akka/contrib/jul/JavaLoggerSpec.scala | 32 ++-- .../contrib/mailbox/PeekMailboxSpec.scala | 2 +- .../akka/contrib/pattern/AggregatorSpec.scala | 4 +- .../LeastShardAllocationStrategySpec.scala | 14 +- ...stributedPubSubMessageSerializerSpec.scala | 2 +- .../throttle/TimerBasedThrottlerSpec.scala | 4 +- .../code/docs/config/ConfigDocSpec.scala | 4 +- .../scala/code/docs/actor/ActorDocSpec.scala | 14 +- .../code/docs/actor/SchedulerDocSpec.scala | 2 +- .../code/docs/actor/TypedActorDocSpec.scala | 10 +- .../scala/code/docs/agent/AgentDocSpec.scala | 22 +-- .../docs/dispatcher/DispatcherDocSpec.scala | 2 +- .../docs/dispatcher/MyUnboundedMailbox.scala | 2 +- .../code/docs/future/FutureDocSpec.scala | 50 +++--- .../rst/scala/code/docs/io/IODocSpec.scala | 6 +- .../rst/scala/code/docs/io/Pipelines.scala | 10 +- .../remoting/RemoteDeploymentDocSpec.scala | 6 +- .../docs/routing/CustomRouterDocSpec.scala | 6 +- .../code/docs/routing/RouterDocSpec.scala | 2 +- .../serialization/SerializationDocSpec.scala | 12 +- .../code/docs/testkit/PlainWordSpec.scala | 4 +- .../code/docs/testkit/TestKitUsageSpec.scala | 4 +- .../code/docs/testkit/TestkitDocSpec.scala | 2 +- .../filebased/FileBasedMailboxSpec.scala | 6 +- .../actor/mailbox/DurableMailboxSpec.scala | 16 +- .../blueprint/NamespaceHandlerTest.scala | 26 +-- .../akka/osgi/ActorSystemActivatorTest.scala | 14 +- .../scala/akka/persistence/ChannelSpec.scala | 18 +- .../scala/akka/persistence/FailureSpec.scala | 4 +- .../akka/persistence/ProcessorSpec.scala | 2 +- .../scala/akka/persistence/SnapshotSpec.scala | 26 +-- .../serialization/SerializerSpec.scala | 12 +- .../akka/remote/LookupRemoteActorSpec.scala | 4 +- .../akka/remote/NewRemoteActorSpec.scala | 18 +- .../RemoteDeploymentDeathWatchSpec.scala | 2 +- .../remote/RemoteNodeDeathWatchSpec.scala | 10 +- .../remote/RemoteQuarantinePiercingSpec.scala | 4 +- .../RandomRoutedRemoteActorSpec.scala | 6 +- .../RoundRobinRoutedRemoteActorSpec.scala | 14 +- .../ScatterGatherRoutedRemoteActorSpec.scala | 6 +- .../remote/routing/RemoteRandomSpec.scala | 6 +- .../remote/routing/RemoteRoundRobinSpec.scala | 22 +-- .../routing/RemoteScatterGatherSpec.scala | 6 +- .../testconductor/TestConductorSpec.scala | 4 +- .../akka/remote/SerializationChecksSpec.scala | 4 +- .../remote/testconductor/BarrierSpec.scala | 2 +- .../remote/testconductor/ControllerSpec.scala | 2 +- .../akka/remote/testkit/STMultiNodeSpec.scala | 4 +- .../scala/akka/io/ssl/SslTlsSupportSpec.scala | 4 +- .../remote/AccrualFailureDetectorSpec.scala | 88 ++++----- .../scala/akka/remote/AckedDeliverySpec.scala | 112 ++++++------ .../test/scala/akka/remote/DaemonicSpec.scala | 2 +- .../akka/remote/EndpointRegistrySpec.scala | 74 ++++---- .../remote/FailureDetectorRegistrySpec.scala | 32 ++-- .../scala/akka/remote/LogSourceSpec.scala | 6 +- .../scala/akka/remote/RemoteConfigSpec.scala | 138 +++++++------- .../akka/remote/RemoteDeployerSpec.scala | 4 +- .../scala/akka/remote/RemoteRouterSpec.scala | 68 +++---- .../test/scala/akka/remote/RemotingSpec.scala | 52 +++--- ...SerializationChecksPlainRemotingSpec.scala | 4 +- .../SerializeCreatorsVerificationSpec.scala | 4 +- .../remote/Ticket1978CommunicationSpec.scala | 2 +- .../akka/remote/Ticket1978ConfigSpec.scala | 16 +- .../remote/TypedActorRemoteDeploySpec.scala | 2 +- .../remote/oldrouting/RemoteRouterSpec.scala | 68 +++---- .../DaemonMsgCreateSerializerSpec.scala | 2 +- .../MessageContainerSerializerSpec.scala | 4 +- .../ProtobufSerializerSpec.scala | 4 +- .../remote/transport/AkkaProtocolSpec.scala | 38 ++-- .../transport/GenericTransportSpec.scala | 10 +- .../SwitchableLoggedBehaviorSpec.scala | 22 +-- .../SystemMessageDeliveryStressTest.scala | 2 +- .../remote/transport/TestTransportSpec.scala | 12 +- .../remote/transport/ThrottleModeSpec.scala | 70 ++++---- .../ThrottlerTransportAdapterSpec.scala | 12 +- .../stats/StatsSampleSingleMasterSpec.scala | 8 +- .../cluster/stats/StatsSampleSpec.scala | 8 +- .../TransformationSampleSpec.scala | 6 +- .../stats/StatsSampleSingleMasterSpec.scala | 10 +- .../cluster/stats/StatsSampleSpec.scala | 10 +- .../TransformationSampleSpec.scala | 6 +- .../sample/multinode/STMultiNodeSpec.scala | 4 +- .../sample/osgi/test/HakkerStatusTest.scala | 4 +- .../akka/event/slf4j/Slf4jLoggerSpec.scala | 64 +++---- .../test/scala/akka/testkit/AkkaSpec.scala | 4 +- .../scala/akka/testkit/AkkaSpecSpec.scala | 10 +- .../test/scala/akka/testkit/CoronerSpec.scala | 34 ++-- .../scala/akka/testkit/JavaTestKitSpec.scala | 10 +- .../scala/akka/testkit/TestActorRefSpec.scala | 42 ++--- .../scala/akka/testkit/TestFSMRefSpec.scala | 24 +-- .../scala/akka/testkit/TestProbeSpec.scala | 20 +-- .../scala/akka/testkit/TestTimeSpec.scala | 12 +- .../transactor/CoordinatedIncrementSpec.scala | 4 +- .../akka/transactor/FickleFriendsSpec.scala | 4 +- .../akka/transactor/TransactorSpec.scala | 6 +- .../zeromq/ConcurrentSocketActorSpec.scala | 10 +- 246 files changed, 2822 insertions(+), 2822 deletions(-) diff --git a/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala b/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala index a4f1953176..210bf74f2e 100644 --- a/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala @@ -1,7 +1,7 @@ package akka; import akka.actor._ -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.WordSpec; /** @@ -9,7 +9,7 @@ import org.scalatest.WordSpec; * * This is required to make Akka Exceptions be friends with serialization/deserialization. */ -class AkkaExceptionSpec extends WordSpec with MustMatchers { +class AkkaExceptionSpec extends WordSpec with Matchers { "AkkaException" must { "have a AkkaException(String msg) constructor to be serialization friendly" in { diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorDSLSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorDSLSpec.scala index cdfa9019f0..2e85ea45b1 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorDSLSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorDSLSpec.scala @@ -36,7 +36,7 @@ class ActorDSLSpec extends AkkaSpec { //#inbox implicit val i = inbox() echo ! "hello" - i.receive() must be("hello") + i.receive() should be("hello") //#inbox } @@ -50,7 +50,7 @@ class ActorDSLSpec extends AkkaSpec { i watch target //#watch target ! PoisonPill - i receive 1.second must be(Terminated(target)(true, false)) + i receive 1.second should be(Terminated(target)(true, false)) } "support queueing multiple queries" in { @@ -61,11 +61,11 @@ class ActorDSLSpec extends AkkaSpec { Future { Thread.sleep(100); i.select() { case "world" ⇒ 1 } } recover { case x ⇒ x }, Future { Thread.sleep(200); i.select() { case "hello" ⇒ 2 } } recover { case x ⇒ x })) Thread.sleep(1000) - res.isCompleted must be(false) + res.isCompleted should be(false) i.receiver ! 42 i.receiver ! "hello" i.receiver ! "world" - Await.result(res, 5 second) must be(Seq(42, 1, 2)) + Await.result(res, 5 second) should be(Seq(42, 1, 2)) } "support selective receives" in { @@ -75,8 +75,8 @@ class ActorDSLSpec extends AkkaSpec { val result = i.select() { case "world" ⇒ true } - result must be(true) - i.receive() must be("hello") + result should be(true) + i.receive() should be("hello") } "have a maximum queue size" in { @@ -92,7 +92,7 @@ class ActorDSLSpec extends AkkaSpec { i.receiver ! 42 expectNoMsg(1 second) val gotit = for (_ ← 1 to 1000) yield i.receive() - gotit must be((1 to 1000) map (_ ⇒ 0)) + gotit should be((1 to 1000) map (_ ⇒ 0)) intercept[TimeoutException] { i.receive(1 second) } @@ -126,7 +126,7 @@ class ActorDSLSpec extends AkkaSpec { implicit val i = inbox() a ! "hello" - i.receive() must be("hi") + i.receive() should be("hi") } "support becomeStacked" in { @@ -231,7 +231,7 @@ class ActorDSLSpec extends AkkaSpec { }) //#nested-actor expectMsg("hello from akka://ActorDSLSpec/user/fred/barney") - lastSender must be(a) + lastSender should be(a) } "support Stash" in { diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorFireForgetRequestReplySpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorFireForgetRequestReplySpec.scala index 97d6daebde..e64e9c01ae 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorFireForgetRequestReplySpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorFireForgetRequestReplySpec.scala @@ -68,7 +68,7 @@ class ActorFireForgetRequestReplySpec extends AkkaSpec with BeforeAndAfterEach w val senderActor = system.actorOf(Props(new SenderActor(replyActor))) senderActor ! "Init" state.finished.await - state.s must be("Reply") + state.s should be("Reply") } "reply to bang message using implicit sender" in { @@ -76,7 +76,7 @@ class ActorFireForgetRequestReplySpec extends AkkaSpec with BeforeAndAfterEach w val senderActor = system.actorOf(Props(new SenderActor(replyActor))) senderActor ! "InitImplicit" state.finished.await - state.s must be("ReplyImplicit") + state.s should be("ReplyImplicit") } "shutdown crashed temporary actor" in { @@ -84,11 +84,11 @@ class ActorFireForgetRequestReplySpec extends AkkaSpec with BeforeAndAfterEach w val supervisor = system.actorOf(Props(new Supervisor( OneForOneStrategy(maxNrOfRetries = 0)(List(classOf[Exception]))))) val actor = Await.result((supervisor ? Props[CrashingActor]).mapTo[ActorRef], timeout.duration) - actor.isTerminated must be(false) + actor.isTerminated should be(false) actor ! "Die" state.finished.await Thread.sleep(1.second.dilated.toMillis) - actor.isTerminated must be(true) + actor.isTerminated should be(true) system.stop(supervisor) } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala index ba49a4f24b..8a1a1857ac 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorLifeCycleSpec.scala @@ -7,7 +7,7 @@ package akka.actor import language.postfixOps import org.scalatest.BeforeAndAfterEach -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Actor._ import akka.testkit._ diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorLookupSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorLookupSpec.scala index d708c033eb..45178d131e 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorLookupSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorLookupSpec.scala @@ -56,14 +56,14 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "An ActorSystem" must { "find actors by looking up their path" in { - system.actorFor(c1.path) must be === c1 - system.actorFor(c2.path) must be === c2 - system.actorFor(c21.path) must be === c21 - system.actorFor(system / "c1") must be === c1 - system.actorFor(system / "c2") must be === c2 - system.actorFor(system / "c2" / "c21") must be === c21 - system.actorFor(system child "c2" child "c21") must be === c21 // test Java API - system.actorFor(system / Seq("c2", "c21")) must be === c21 + system.actorFor(c1.path) should equal(c1) + system.actorFor(c2.path) should equal(c2) + system.actorFor(c21.path) should equal(c21) + system.actorFor(system / "c1") should equal(c1) + system.actorFor(system / "c2") should equal(c2) + system.actorFor(system / "c2" / "c21") should equal(c21) + system.actorFor(system child "c2" child "c21") should equal(c21) // test Java API + system.actorFor(system / Seq("c2", "c21")) should equal(c21) import scala.collection.JavaConverters._ system.actorFor(system descendant Seq("c2", "c21").asJava) // test Java API @@ -71,9 +71,9 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find actors by looking up their string representation" in { // this is only true for local actor references - system.actorFor(c1.path.toString) must be === c1 - system.actorFor(c2.path.toString) must be === c2 - system.actorFor(c21.path.toString) must be === c21 + system.actorFor(c1.path.toString) should equal(c1) + system.actorFor(c2.path.toString) should equal(c2) + system.actorFor(c21.path.toString) should equal(c21) } "take actor incarnation into account when comparing actor references" in { @@ -87,13 +87,13 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { expectNoMsg(1 second) // not equal because it's terminated - system.actorFor(a1.path.toString) must not be (a1) + system.actorFor(a1.path.toString) should not be (a1) val a2 = system.actorOf(p, name) - a2.path must be(a1.path) - a2.path.toString must be(a1.path.toString) - a2 must not be (a1) - a2.toString must not be (a1.toString) + a2.path should be(a1.path) + a2.path.toString should be(a1.path.toString) + a2 should not be (a1) + a2.toString should not be (a1.toString) watch(a2) a2 ! PoisonPill @@ -101,45 +101,45 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { } "find actors by looking up their root-anchored relative path" in { - system.actorFor(c1.path.elements.mkString("/", "/", "")) must be === c1 - system.actorFor(c2.path.elements.mkString("/", "/", "")) must be === c2 - system.actorFor(c21.path.elements.mkString("/", "/", "")) must be === c21 + system.actorFor(c1.path.elements.mkString("/", "/", "")) should equal(c1) + system.actorFor(c2.path.elements.mkString("/", "/", "")) should equal(c2) + system.actorFor(c21.path.elements.mkString("/", "/", "")) should equal(c21) } "find actors by looking up their relative path" in { - system.actorFor(c1.path.elements.mkString("/")) must be === c1 - system.actorFor(c2.path.elements.mkString("/")) must be === c2 - system.actorFor(c21.path.elements.mkString("/")) must be === c21 + system.actorFor(c1.path.elements.mkString("/")) should equal(c1) + system.actorFor(c2.path.elements.mkString("/")) should equal(c2) + system.actorFor(c21.path.elements.mkString("/")) should equal(c21) } "find actors by looking up their path elements" in { - system.actorFor(c1.path.elements) must be === c1 - system.actorFor(c2.path.elements) must be === c2 - system.actorFor(c21.path.getElements) must be === c21 // test Java API + system.actorFor(c1.path.elements) should equal(c1) + system.actorFor(c2.path.elements) should equal(c2) + system.actorFor(c21.path.getElements) should equal(c21) // test Java API } "find system-generated actors" in { - system.actorFor("/user") must be === user - system.actorFor("/deadLetters") must be === system.deadLetters - system.actorFor("/system") must be === syst - system.actorFor(syst.path) must be === syst - system.actorFor(syst.path.toString) must be === syst - system.actorFor("/") must be === root - system.actorFor("..") must be === root - system.actorFor(root.path) must be === root - system.actorFor(root.path.toString) must be === root - system.actorFor("user") must be === user - system.actorFor("deadLetters") must be === system.deadLetters - system.actorFor("system") must be === syst - system.actorFor("user/") must be === user - system.actorFor("deadLetters/") must be === system.deadLetters - system.actorFor("system/") must be === syst + system.actorFor("/user") should equal(user) + system.actorFor("/deadLetters") should equal(system.deadLetters) + system.actorFor("/system") should equal(syst) + system.actorFor(syst.path) should equal(syst) + system.actorFor(syst.path.toString) should equal(syst) + system.actorFor("/") should equal(root) + system.actorFor("..") should equal(root) + system.actorFor(root.path) should equal(root) + system.actorFor(root.path.toString) should equal(root) + system.actorFor("user") should equal(user) + system.actorFor("deadLetters") should equal(system.deadLetters) + system.actorFor("system") should equal(syst) + system.actorFor("user/") should equal(user) + system.actorFor("deadLetters/") should equal(system.deadLetters) + system.actorFor("system/") should equal(syst) } "return deadLetters or EmptyLocalActorRef, respectively, for non-existing paths" in { def check(lookup: ActorRef, result: ActorRef) = { - lookup.getClass must be === result.getClass - lookup must be === result + lookup.getClass should equal(result.getClass) + lookup should equal(result) } check(system.actorFor("a/b/c"), empty("a/b/c")) check(system.actorFor(""), system.deadLetters) @@ -153,17 +153,17 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find temporary actors" in { val f = c1 ? GetSender(testActor) val a = expectMsgType[ActorRef] - a.path.elements.head must be === "temp" - system.actorFor(a.path) must be === a - system.actorFor(a.path.toString) must be === a - system.actorFor(a.path.elements) must be === a - system.actorFor(a.path.toString + "/") must be === a - system.actorFor(a.path.toString + "/hallo").isTerminated must be === true - f.isCompleted must be === false - a.isTerminated must be === false + a.path.elements.head should equal("temp") + system.actorFor(a.path) should equal(a) + system.actorFor(a.path.toString) should equal(a) + system.actorFor(a.path.elements) should equal(a) + system.actorFor(a.path.toString + "/") should equal(a) + system.actorFor(a.path.toString + "/hallo").isTerminated should equal(true) + f.isCompleted should equal(false) + a.isTerminated should equal(false) a ! 42 - f.isCompleted must be === true - Await.result(f, timeout.duration) must be === 42 + f.isCompleted should equal(true) + Await.result(f, timeout.duration) should equal(42) // clean-up is run as onComplete callback, i.e. dispatched on another thread awaitCond(system.actorFor(a.path).isTerminated, 1 second) } @@ -176,7 +176,7 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find actors by looking up their path" in { def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) { - Await.result(looker ? LookupPath(pathOf.path), timeout.duration) must be === result + Await.result(looker ? LookupPath(pathOf.path), timeout.duration) should equal(result) } for { looker ← all @@ -186,11 +186,11 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find actors by looking up their string representation" in { def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) { - Await.result(looker ? LookupString(pathOf.path.toString), timeout.duration) must be === result + Await.result(looker ? LookupString(pathOf.path.toString), timeout.duration) should equal(result) // with uid - Await.result(looker ? LookupString(pathOf.path.toSerializationFormat), timeout.duration) must be === result + Await.result(looker ? LookupString(pathOf.path.toSerializationFormat), timeout.duration) should equal(result) // with trailing / - Await.result(looker ? LookupString(pathOf.path.toString + "/"), timeout.duration) must be === result + Await.result(looker ? LookupString(pathOf.path.toString + "/"), timeout.duration) should equal(result) } for { looker ← all @@ -200,8 +200,8 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find actors by looking up their root-anchored relative path" in { def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) { - Await.result(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "")), timeout.duration) must be === result - Await.result(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "/")), timeout.duration) must be === result + Await.result(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "")), timeout.duration) should equal(result) + Await.result(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "/")), timeout.duration) should equal(result) } for { looker ← all @@ -211,9 +211,9 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find actors by looking up their relative path" in { def check(looker: ActorRef, result: ActorRef, elems: String*) { - Await.result(looker ? LookupElems(elems), timeout.duration) must be === result - Await.result(looker ? LookupString(elems mkString "/"), timeout.duration) must be === result - Await.result(looker ? LookupString(elems mkString ("", "/", "/")), timeout.duration) must be === result + Await.result(looker ? LookupElems(elems), timeout.duration) should equal(result) + Await.result(looker ? LookupString(elems mkString "/"), timeout.duration) should equal(result) + Await.result(looker ? LookupString(elems mkString ("", "/", "/")), timeout.duration) should equal(result) } check(c1, user, "..") for { @@ -228,11 +228,11 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find system-generated actors" in { def check(target: ActorRef) { for (looker ← all) { - Await.result(looker ? LookupPath(target.path), timeout.duration) must be === target - Await.result(looker ? LookupString(target.path.toString), timeout.duration) must be === target - Await.result(looker ? LookupString(target.path.toString + "/"), timeout.duration) must be === target - Await.result(looker ? LookupString(target.path.elements.mkString("/", "/", "")), timeout.duration) must be === target - if (target != root) Await.result(looker ? LookupString(target.path.elements.mkString("/", "/", "/")), timeout.duration) must be === target + Await.result(looker ? LookupPath(target.path), timeout.duration) should equal(target) + Await.result(looker ? LookupString(target.path.toString), timeout.duration) should equal(target) + Await.result(looker ? LookupString(target.path.toString + "/"), timeout.duration) should equal(target) + Await.result(looker ? LookupString(target.path.elements.mkString("/", "/", "")), timeout.duration) should equal(target) + if (target != root) Await.result(looker ? LookupString(target.path.elements.mkString("/", "/", "/")), timeout.duration) should equal(target) } } for (target ← Seq(root, syst, user, system.deadLetters)) check(target) @@ -243,8 +243,8 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { def checkOne(looker: ActorRef, query: Query, result: ActorRef) { val lookup = Await.result(looker ? query, timeout.duration) - lookup.getClass must be === result.getClass - lookup must be === result + lookup.getClass should equal(result.getClass) + lookup should equal(result) } def check(looker: ActorRef) { val lookname = looker.path.elements.mkString("", "/", "/") @@ -266,21 +266,21 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout { "find temporary actors" in { val f = c1 ? GetSender(testActor) val a = expectMsgType[ActorRef] - a.path.elements.head must be === "temp" - Await.result(c2 ? LookupPath(a.path), timeout.duration) must be === a - Await.result(c2 ? LookupString(a.path.toString), timeout.duration) must be === a - Await.result(c2 ? LookupString(a.path.elements.mkString("/", "/", "")), timeout.duration) must be === a - Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/")), timeout.duration) must be === a - Await.result(c2 ? LookupString(a.path.toString + "/"), timeout.duration) must be === a - Await.result(c2 ? LookupString(a.path.elements.mkString("/", "/", "") + "/"), timeout.duration) must be === a - Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/") + "/"), timeout.duration) must be === a - Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements), timeout.duration) must be === a - Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements :+ ""), timeout.duration) must be === a - f.isCompleted must be === false - a.isTerminated must be === false + a.path.elements.head should equal("temp") + Await.result(c2 ? LookupPath(a.path), timeout.duration) should equal(a) + Await.result(c2 ? LookupString(a.path.toString), timeout.duration) should equal(a) + Await.result(c2 ? LookupString(a.path.elements.mkString("/", "/", "")), timeout.duration) should equal(a) + Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/")), timeout.duration) should equal(a) + Await.result(c2 ? LookupString(a.path.toString + "/"), timeout.duration) should equal(a) + Await.result(c2 ? LookupString(a.path.elements.mkString("/", "/", "") + "/"), timeout.duration) should equal(a) + Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/") + "/"), timeout.duration) should equal(a) + Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements), timeout.duration) should equal(a) + Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements :+ ""), timeout.duration) should equal(a) + f.isCompleted should equal(false) + a.isTerminated should equal(false) a ! 42 - f.isCompleted must be === true - Await.result(f, timeout.duration) must be === 42 + f.isCompleted should equal(true) + Await.result(f, timeout.duration) should equal(42) // clean-up is run as onComplete callback, i.e. dispatched on another thread awaitCond(Await.result(c2 ? LookupPath(a.path), timeout.duration).asInstanceOf[ActorRef].isTerminated, 1 second) } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorMailboxSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorMailboxSpec.scala index 108eb5290a..d349c91a2a 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorMailboxSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorMailboxSpec.scala @@ -254,7 +254,7 @@ class ActorMailboxSpec(conf: Config) extends AkkaSpec(conf) with DefaultTimeout "get a bounded message queue with 0 push timeout when defined in dispatcher" in { val q = checkMailboxQueue(Props[QueueReportingActor], "default-bounded-mailbox-with-zero-pushtimeout", BoundedMailboxTypes) - q.asInstanceOf[BoundedMessageQueueSemantics].pushTimeOut must be === Duration.Zero + q.asInstanceOf[BoundedMessageQueueSemantics].pushTimeOut should equal(Duration.Zero) } "get an unbounded message queue when it's configured as mailbox overriding bounded in dispatcher" in { diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorPathSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorPathSpec.scala index e03c0c337a..862b5145fd 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorPathSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorPathSpec.scala @@ -4,21 +4,21 @@ package akka.actor import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import java.net.MalformedURLException -class ActorPathSpec extends WordSpec with MustMatchers { +class ActorPathSpec extends WordSpec with Matchers { "An ActorPath" must { "support parsing its String rep" in { val path = RootActorPath(Address("akka.tcp", "mysys")) / "user" - ActorPath.fromString(path.toString) must be(path) + ActorPath.fromString(path.toString) should be(path) } "support parsing remote paths" in { val remote = "akka://sys@host:1234/some/ref" - ActorPath.fromString(remote).toString must be(remote) + ActorPath.fromString(remote).toString should be(remote) } "throw exception upon malformed paths" in { @@ -31,14 +31,14 @@ class ActorPathSpec extends WordSpec with MustMatchers { "create correct toString" in { val a = Address("akka.tcp", "mysys") - RootActorPath(a).toString must be("akka.tcp://mysys/") - (RootActorPath(a) / "user").toString must be("akka.tcp://mysys/user") - (RootActorPath(a) / "user" / "foo").toString must be("akka.tcp://mysys/user/foo") - (RootActorPath(a) / "user" / "foo" / "bar").toString must be("akka.tcp://mysys/user/foo/bar") + RootActorPath(a).toString should be("akka.tcp://mysys/") + (RootActorPath(a) / "user").toString should be("akka.tcp://mysys/user") + (RootActorPath(a) / "user" / "foo").toString should be("akka.tcp://mysys/user/foo") + (RootActorPath(a) / "user" / "foo" / "bar").toString should be("akka.tcp://mysys/user/foo/bar") } "have correct path elements" in { - (RootActorPath(Address("akka.tcp", "mysys")) / "user" / "foo" / "bar").elements.toSeq must be(Seq("user", "foo", "bar")) + (RootActorPath(Address("akka.tcp", "mysys")) / "user" / "foo" / "bar").elements.toSeq should be(Seq("user", "foo", "bar")) } "create correct toStringWithAddress" in { @@ -47,22 +47,22 @@ class ActorPathSpec extends WordSpec with MustMatchers { val b = a.copy(host = Some("bb")) val c = a.copy(host = Some("cccc")) val root = RootActorPath(local) - root.toStringWithAddress(a) must be("akka.tcp://mysys@aaa:2552/") - (root / "user").toStringWithAddress(a) must be("akka.tcp://mysys@aaa:2552/user") - (root / "user" / "foo").toStringWithAddress(a) must be("akka.tcp://mysys@aaa:2552/user/foo") + root.toStringWithAddress(a) should be("akka.tcp://mysys@aaa:2552/") + (root / "user").toStringWithAddress(a) should be("akka.tcp://mysys@aaa:2552/user") + (root / "user" / "foo").toStringWithAddress(a) should be("akka.tcp://mysys@aaa:2552/user/foo") - // root.toStringWithAddress(b) must be("akka.tcp://mysys@bb:2552/") - (root / "user").toStringWithAddress(b) must be("akka.tcp://mysys@bb:2552/user") - (root / "user" / "foo").toStringWithAddress(b) must be("akka.tcp://mysys@bb:2552/user/foo") + // root.toStringWithAddress(b) should be("akka.tcp://mysys@bb:2552/") + (root / "user").toStringWithAddress(b) should be("akka.tcp://mysys@bb:2552/user") + (root / "user" / "foo").toStringWithAddress(b) should be("akka.tcp://mysys@bb:2552/user/foo") - root.toStringWithAddress(c) must be("akka.tcp://mysys@cccc:2552/") - (root / "user").toStringWithAddress(c) must be("akka.tcp://mysys@cccc:2552/user") - (root / "user" / "foo").toStringWithAddress(c) must be("akka.tcp://mysys@cccc:2552/user/foo") + root.toStringWithAddress(c) should be("akka.tcp://mysys@cccc:2552/") + (root / "user").toStringWithAddress(c) should be("akka.tcp://mysys@cccc:2552/user") + (root / "user" / "foo").toStringWithAddress(c) should be("akka.tcp://mysys@cccc:2552/user/foo") val rootA = RootActorPath(a) - rootA.toStringWithAddress(b) must be("akka.tcp://mysys@aaa:2552/") - (rootA / "user").toStringWithAddress(b) must be("akka.tcp://mysys@aaa:2552/user") - (rootA / "user" / "foo").toStringWithAddress(b) must be("akka.tcp://mysys@aaa:2552/user/foo") + rootA.toStringWithAddress(b) should be("akka.tcp://mysys@aaa:2552/") + (rootA / "user").toStringWithAddress(b) should be("akka.tcp://mysys@aaa:2552/user") + (rootA / "user" / "foo").toStringWithAddress(b) should be("akka.tcp://mysys@aaa:2552/user/foo") } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala index 8ec2e1a999..028b84f9cb 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala @@ -139,7 +139,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { new Actor { def receive = { case _ ⇒ } } } - def contextStackMustBeEmpty(): Unit = ActorCell.contextStack.get.headOption must be === None + def contextStackMustBeEmpty(): Unit = ActorCell.contextStack.get.headOption should equal(None) EventFilter[ActorInitializationException](occurrences = 1) intercept { intercept[akka.actor.ActorInitializationException] { @@ -249,7 +249,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { (intercept[java.lang.IllegalStateException] { wrap(result ⇒ actorOf(Props(new OuterActor(actorOf(Props(promiseIntercept({ throw new IllegalStateException("Ur state be b0rked"); new InnerActor })(result))))))) - }).getMessage must be === "Ur state be b0rked" + }).getMessage should equal("Ur state be b0rked") contextStackMustBeEmpty() } @@ -275,15 +275,15 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { val in = new ObjectInputStream(new ByteArrayInputStream(bytes)) val readA = in.readObject - a.isInstanceOf[ActorRefWithCell] must be === true - readA.isInstanceOf[ActorRefWithCell] must be === true - (readA eq a) must be === true + a.isInstanceOf[ActorRefWithCell] should equal(true) + readA.isInstanceOf[ActorRefWithCell] should equal(true) + (readA eq a) should equal(true) } val ser = new JavaSerializer(esys) val readA = ser.fromBinary(bytes, None) - readA.isInstanceOf[ActorRefWithCell] must be === true - (readA eq a) must be === true + readA.isInstanceOf[ActorRefWithCell] should equal(true) + (readA eq a) should equal(true) } "throw an exception on deserialize if no system in scope" in { @@ -303,8 +303,8 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { (intercept[java.lang.IllegalStateException] { in.readObject - }).getMessage must be === "Trying to deserialize a serialized ActorRef without an ActorSystem in scope." + - " Use 'akka.serialization.Serialization.currentSystem.withValue(system) { ... }'" + }).getMessage should equal("Trying to deserialize a serialized ActorRef without an ActorSystem in scope." + + " Use 'akka.serialization.Serialization.currentSystem.withValue(system) { ... }'") } "return EmptyLocalActorRef on deserialize if not present in actor hierarchy (and remoting is not enabled)" in { @@ -328,7 +328,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { JavaSerializer.currentSystem.withValue(sysImpl) { val in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray)) - in.readObject must be === new EmptyLocalActorRef(sysImpl.provider, ref.path, system.eventStream) + in.readObject should equal(new EmptyLocalActorRef(sysImpl.provider, ref.path, system.eventStream)) } } @@ -339,20 +339,20 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { })) val nested = Await.result((a ? "any").mapTo[ActorRef], timeout.duration) - a must not be null - nested must not be null - (a ne nested) must be === true + a should not be null + nested should not be null + (a ne nested) should equal(true) } "support advanced nested actorOfs" in { val a = system.actorOf(Props(new OuterActor(system.actorOf(Props(new InnerActor))))) val inner = Await.result(a ? "innerself", timeout.duration) - Await.result(a ? a, timeout.duration) must be(a) - Await.result(a ? "self", timeout.duration) must be(a) - inner must not be a + Await.result(a ? a, timeout.duration) should be(a) + Await.result(a ? "self", timeout.duration) should be(a) + inner should not be a - Await.result(a ? "msg", timeout.duration) must be === "msg" + Await.result(a ? "msg", timeout.duration) should equal("msg") } "support reply via sender" in { @@ -400,8 +400,8 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout { val fnull = (ref.ask(0)(timeout)).mapTo[String] ref ! PoisonPill - Await.result(ffive, timeout.duration) must be("five") - Await.result(fnull, timeout.duration) must be("null") + Await.result(ffive, timeout.duration) should be("five") + Await.result(fnull, timeout.duration) should be("null") verifyActorTermination(ref) } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorSelectionSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorSelectionSpec.scala index 4cd7312617..a9308723fd 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorSelectionSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorSelectionSpec.scala @@ -62,13 +62,13 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim case ActorIdentity(`selection`, ref) ⇒ ref } val asked = Await.result((selection ? Identify(selection)).mapTo[ActorIdentity], timeout.duration) - asked.ref must be(result) - asked.correlationId must be(selection) + asked.ref should be(result) + asked.correlationId should be(selection) implicit val ec = system.dispatcher val resolved = Await.result(selection.resolveOne(timeout.duration).mapTo[ActorRef] recover { case _ ⇒ null }, timeout.duration) - Option(resolved) must be(result) + Option(resolved) should be(result) result } @@ -86,27 +86,27 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "An ActorSystem" must { "select actors by their path" in { - identify(c1.path) must be === Some(c1) - identify(c2.path) must be === Some(c2) - identify(c21.path) must be === Some(c21) - identify(system / "c1") must be === Some(c1) - identify(system / "c2") must be === Some(c2) - identify(system / "c2" / "c21") must be === Some(c21) - identify(system child "c2" child "c21") must be === Some(c21) // test Java API - identify(system / Seq("c2", "c21")) must be === Some(c21) + identify(c1.path) should equal(Some(c1)) + identify(c2.path) should equal(Some(c2)) + identify(c21.path) should equal(Some(c21)) + identify(system / "c1") should equal(Some(c1)) + identify(system / "c2") should equal(Some(c2)) + identify(system / "c2" / "c21") should equal(Some(c21)) + identify(system child "c2" child "c21") should equal(Some(c21)) // test Java API + identify(system / Seq("c2", "c21")) should equal(Some(c21)) import scala.collection.JavaConverters._ identify(system descendant Seq("c2", "c21").asJava) // test Java API } "select actors by their string path representation" in { - identify(c1.path.toString) must be === Some(c1) - identify(c2.path.toString) must be === Some(c2) - identify(c21.path.toString) must be === Some(c21) + identify(c1.path.toString) should equal(Some(c1)) + identify(c2.path.toString) should equal(Some(c2)) + identify(c21.path.toString) should equal(Some(c21)) - identify(c1.path.elements.mkString("/", "/", "")) must be === Some(c1) - identify(c2.path.elements.mkString("/", "/", "")) must be === Some(c2) - identify(c21.path.elements.mkString("/", "/", "")) must be === Some(c21) + identify(c1.path.elements.mkString("/", "/", "")) should equal(Some(c1)) + identify(c2.path.elements.mkString("/", "/", "")) should equal(Some(c2)) + identify(c21.path.elements.mkString("/", "/", "")) should equal(Some(c21)) } "take actor incarnation into account when comparing actor references" in { @@ -114,60 +114,60 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim val a1 = system.actorOf(p, name) watch(a1) a1 ! PoisonPill - expectMsgType[Terminated].actor must be === a1 + expectMsgType[Terminated].actor should equal(a1) // not equal because it's terminated - identify(a1.path) must be === None + identify(a1.path) should equal(None) val a2 = system.actorOf(p, name) - a2.path must be(a1.path) - a2.path.toString must be(a1.path.toString) - a2 must not be (a1) - a2.toString must not be (a1.toString) + a2.path should be(a1.path) + a2.path.toString should be(a1.path.toString) + a2 should not be (a1) + a2.toString should not be (a1.toString) watch(a2) a2 ! PoisonPill - expectMsgType[Terminated].actor must be === a2 + expectMsgType[Terminated].actor should equal(a2) } "select actors by their root-anchored relative path" in { - identify(c1.path.elements.mkString("/", "/", "")) must be === Some(c1) - identify(c2.path.elements.mkString("/", "/", "")) must be === Some(c2) - identify(c21.path.elements.mkString("/", "/", "")) must be === Some(c21) + identify(c1.path.elements.mkString("/", "/", "")) should equal(Some(c1)) + identify(c2.path.elements.mkString("/", "/", "")) should equal(Some(c2)) + identify(c21.path.elements.mkString("/", "/", "")) should equal(Some(c21)) } "select actors by their relative path" in { - identify(c1.path.elements.mkString("/")) must be === Some(c1) - identify(c2.path.elements.mkString("/")) must be === Some(c2) - identify(c21.path.elements.mkString("/")) must be === Some(c21) + identify(c1.path.elements.mkString("/")) should equal(Some(c1)) + identify(c2.path.elements.mkString("/")) should equal(Some(c2)) + identify(c21.path.elements.mkString("/")) should equal(Some(c21)) } "select system-generated actors" in { - identify("/user") must be === Some(user) - identify("/deadLetters") must be === Some(system.deadLetters) - identify("/system") must be === Some(syst) - identify(syst.path) must be === Some(syst) - identify(syst.path.elements.mkString("/", "/", "")) must be === Some(syst) - identify("/") must be === Some(root) - identify("") must be === Some(root) - identify(RootActorPath(root.path.address)) must be === Some(root) - identify("..") must be === Some(root) - identify(root.path) must be === Some(root) - identify(root.path.elements.mkString("/", "/", "")) must be === Some(root) - identify("user") must be === Some(user) - identify("deadLetters") must be === Some(system.deadLetters) - identify("system") must be === Some(syst) - identify("user/") must be === Some(user) - identify("deadLetters/") must be === Some(system.deadLetters) - identify("system/") must be === Some(syst) + identify("/user") should equal(Some(user)) + identify("/deadLetters") should equal(Some(system.deadLetters)) + identify("/system") should equal(Some(syst)) + identify(syst.path) should equal(Some(syst)) + identify(syst.path.elements.mkString("/", "/", "")) should equal(Some(syst)) + identify("/") should equal(Some(root)) + identify("") should equal(Some(root)) + identify(RootActorPath(root.path.address)) should equal(Some(root)) + identify("..") should equal(Some(root)) + identify(root.path) should equal(Some(root)) + identify(root.path.elements.mkString("/", "/", "")) should equal(Some(root)) + identify("user") should equal(Some(user)) + identify("deadLetters") should equal(Some(system.deadLetters)) + identify("system") should equal(Some(syst)) + identify("user/") should equal(Some(user)) + identify("deadLetters/") should equal(Some(system.deadLetters)) + identify("system/") should equal(Some(syst)) } "return deadLetters or ActorIdentity(None), respectively, for non-existing paths" in { - identify("a/b/c") must be === None - identify("a/b/c") must be === None - identify("akka://all-systems/Nobody") must be === None - identify("akka://all-systems/user") must be === None - identify(system / "hallo") must be === None + identify("a/b/c") should equal(None) + identify("a/b/c") should equal(None) + identify("akka://all-systems/Nobody") should equal(None) + identify("akka://all-systems/user") should equal(None) + identify(system / "hallo") should equal(None) } } @@ -178,7 +178,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "select actors by their path" in { def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) { - askNode(looker, SelectPath(pathOf.path)) must be === Some(result) + askNode(looker, SelectPath(pathOf.path)) should equal(Some(result)) } for { looker ← all @@ -188,9 +188,9 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "select actors by their string path representation" in { def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) { - askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", ""))) must be === Some(result) + askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", ""))) should equal(Some(result)) // with trailing / - askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", "") + "/")) must be === Some(result) + askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", "") + "/")) should equal(Some(result)) } for { looker ← all @@ -200,8 +200,8 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "select actors by their root-anchored relative path" in { def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) { - askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", ""))) must be === Some(result) - askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", "/"))) must be === Some(result) + askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", ""))) should equal(Some(result)) + askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", "/"))) should equal(Some(result)) } for { looker ← all @@ -211,8 +211,8 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "select actors by their relative path" in { def check(looker: ActorRef, result: ActorRef, elems: String*) { - askNode(looker, SelectString(elems mkString "/")) must be === Some(result) - askNode(looker, SelectString(elems mkString ("", "/", "/"))) must be === Some(result) + askNode(looker, SelectString(elems mkString "/")) should equal(Some(result)) + askNode(looker, SelectString(elems mkString ("", "/", "/"))) should equal(Some(result)) } check(c1, user, "..") for { @@ -227,12 +227,12 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "find system-generated actors" in { def check(target: ActorRef) { for (looker ← all) { - askNode(looker, SelectPath(target.path)) must be === Some(target) - askNode(looker, SelectString(target.path.toString)) must be === Some(target) - askNode(looker, SelectString(target.path.toString + "/")) must be === Some(target) + askNode(looker, SelectPath(target.path)) should equal(Some(target)) + askNode(looker, SelectString(target.path.toString)) should equal(Some(target)) + askNode(looker, SelectString(target.path.toString + "/")) should equal(Some(target)) } if (target != root) - askNode(c1, SelectString("../.." + target.path.elements.mkString("/", "/", "/"))) must be === Some(target) + askNode(c1, SelectString("../.." + target.path.elements.mkString("/", "/", "/"))) should equal(Some(target)) } for (target ← Seq(root, syst, user)) check(target) } @@ -242,7 +242,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim def checkOne(looker: ActorRef, query: Query, result: Option[ActorRef]) { val lookup = askNode(looker, query) - lookup must be === result + lookup should equal(result) } def check(looker: ActorRef) { val lookname = looker.path.elements.mkString("", "/", "/") @@ -265,19 +265,19 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim "send messages directly" in { ActorSelection(c1, "") ! GetSender(testActor) expectMsg(system.deadLetters) - lastSender must be === c1 + lastSender should equal(c1) } "send messages to string path" in { system.actorSelection("/user/c2/c21") ! GetSender(testActor) expectMsg(system.deadLetters) - lastSender must be === c21 + lastSender should equal(c21) } "send messages to actor path" in { system.actorSelection(system / "c2" / "c21") ! GetSender(testActor) expectMsg(system.deadLetters) - lastSender must be === c21 + lastSender should equal(c21) } "send messages with correct sender" in { @@ -286,7 +286,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim val actors = Set() ++ receiveWhile(messages = 2) { case `c1` ⇒ lastSender } - actors must be === Set(c1, c2) + actors should equal(Set(c1, c2)) expectNoMsg(1 second) } @@ -296,20 +296,20 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim val actors = receiveWhile(messages = 2) { case `c2` ⇒ lastSender } - actors must be === Seq(c21) + actors should equal(Seq(c21)) expectNoMsg(1 second) } "resolve one actor with explicit timeout" in { val s = system.actorSelection(system / "c2") // Java and Scala API - Await.result(s.resolveOne(1.second.dilated), timeout.duration) must be === c2 + Await.result(s.resolveOne(1.second.dilated), timeout.duration) should equal(c2) } "resolve one actor with implicit timeout" in { val s = system.actorSelection(system / "c2") // Scala API; implicit timeout from DefaultTimeout trait - Await.result(s.resolveOne(), timeout.duration) must be === c2 + Await.result(s.resolveOne(), timeout.duration) should equal(c2) } "resolve non-existing with Failure" in { @@ -319,16 +319,16 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim } "compare equally" in { - ActorSelection(c21, "../*/hello") must be === ActorSelection(c21, "../*/hello") - ActorSelection(c21, "../*/hello").## must be === ActorSelection(c21, "../*/hello").## - ActorSelection(c2, "../*/hello") must not be ActorSelection(c21, "../*/hello") - ActorSelection(c2, "../*/hello").## must not be ActorSelection(c21, "../*/hello").## - ActorSelection(c21, "../*/hell") must not be ActorSelection(c21, "../*/hello") - ActorSelection(c21, "../*/hell").## must not be ActorSelection(c21, "../*/hello").## + ActorSelection(c21, "../*/hello") should equal(ActorSelection(c21, "../*/hello")) + ActorSelection(c21, "../*/hello").## should equal(ActorSelection(c21, "../*/hello").##) + ActorSelection(c2, "../*/hello") should not be ActorSelection(c21, "../*/hello") + ActorSelection(c2, "../*/hello").## should not be ActorSelection(c21, "../*/hello").## + ActorSelection(c21, "../*/hell") should not be ActorSelection(c21, "../*/hello") + ActorSelection(c21, "../*/hell").## should not be ActorSelection(c21, "../*/hello").## } "print nicely" in { - ActorSelection(c21, "../*/hello").toString must be( + ActorSelection(c21, "../*/hello").toString should be( s"ActorSelection[Anchor(akka://ActorSelectionSpec/user/c2/c21#${c21.path.uid}), Path(/../*/hello)]") } @@ -337,9 +337,9 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim system.eventStream.subscribe(p.ref, classOf[DeadLetter]) system.actorSelection("/user/missing").tell("boom", testActor) val d = p.expectMsgType[DeadLetter] - d.message must be("boom") - d.sender must be(testActor) - d.recipient.path.elements.mkString("/", "/", "") must be("/user/missing") + d.message should be("boom") + d.sender should be(testActor) + d.recipient.path.elements.mkString("/", "/", "") should be("/user/missing") } "send ActorSelection wildcard targeted to missing actor to deadLetters" in { @@ -354,16 +354,16 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim val d1 = probe.expectMsgType[DeadLetter] val d2 = probe.expectMsgType[DeadLetter] List(d1, d2) foreach { d ⇒ - d.message must be("wild") - d.sender must be(testActor) - d.recipient.path.elements.mkString("/", "/", "") must (equal("/user/top/child1/a") or equal("/user/top/child2/a")) + d.message should be("wild") + d.sender should be(testActor) + d.recipient.path.elements.mkString("/", "/", "") should (equal("/user/top/child1/a") or equal("/user/top/child2/a")) } } "forward to selection" in { c2.tell(Forward("c21", "hello"), testActor) expectMsg("hello") - lastSender must be(c21) + lastSender should be(c21) } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala index 8af619a521..b971bac502 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala @@ -125,7 +125,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend "An ActorSystem" must { "use scala.concurrent.Future's InternalCallbackEC" in { - system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName must be === "scala.concurrent.Future$InternalCallbackExecutor$" + system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName should equal("scala.concurrent.Future$InternalCallbackExecutor$") } "reject invalid names" in { @@ -150,9 +150,9 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend "support extensions" in { // TestExtension is configured and should be loaded at startup - system.hasExtension(TestExtension) must be(true) - TestExtension(system).system must be === system - system.extension(TestExtension).system must be === system + system.hasExtension(TestExtension) should be(true) + TestExtension(system).system should equal(system) + system.extension(TestExtension).system should equal(system) } "log dead letters" in { @@ -187,7 +187,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend val expected = (for (i ← 1 to count) yield i).reverse - immutableSeq(result) must be(expected) + immutableSeq(result) should be(expected) } "awaitTermination after termination callbacks" in { @@ -203,15 +203,15 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend system2.scheduler.scheduleOnce(200.millis.dilated) { system2.shutdown() } system2.awaitTermination(5 seconds) - callbackWasRun must be(true) + callbackWasRun should be(true) } "return isTerminated status correctly" in { val system = ActorSystem() - system.isTerminated must be(false) + system.isTerminated should be(false) system.shutdown() system.awaitTermination(10 seconds) - system.isTerminated must be(true) + system.isTerminated should be(true) } "throw RejectedExecutionException when shutdown" in { @@ -221,19 +221,19 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend intercept[RejectedExecutionException] { system2.registerOnTermination { println("IF YOU SEE THIS THEN THERE'S A BUG HERE") } - }.getMessage must be("Must be called prior to system shutdown.") + }.getMessage should be("Must be called prior to system shutdown.") } "reliably create waves of actors" in { import system.dispatcher implicit val timeout = Timeout((20 seconds).dilated) val waves = for (i ← 1 to 3) yield system.actorOf(Props[ActorSystemSpec.Waves]) ? 50000 - Await.result(Future.sequence(waves), timeout.duration + 5.seconds) must be === Seq("done", "done", "done") + Await.result(Future.sequence(waves), timeout.duration + 5.seconds) should equal(Seq("done", "done", "done")) } "find actors that just have been created" in { system.actorOf(Props(new FastActor(TestLatch(), testActor)).withDispatcher("slow")) - expectMsgType[Class[_]] must be(classOf[LocalActorRef]) + expectMsgType[Class[_]] should be(classOf[LocalActorRef]) } "reliable deny creation of actors while shutting down" in { @@ -245,7 +245,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend while (!system.isTerminated) { try { val t = system.actorOf(Props[ActorSystemSpec.Terminater]) - failing must not be true // because once failing => always failing (it’s due to shutdown) + failing should not be true // because once failing => always failing (it’s due to shutdown) created :+= t } catch { case _: IllegalStateException ⇒ failing = true @@ -258,7 +258,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend } } - created filter (ref ⇒ !ref.isTerminated && !ref.asInstanceOf[ActorRefWithCell].underlying.isInstanceOf[UnstartedCell]) must be(Seq()) + created filter (ref ⇒ !ref.isTerminated && !ref.asInstanceOf[ActorRefWithCell].underlying.isInstanceOf[UnstartedCell]) should be(Seq()) } "shut down when /user fails" in { @@ -284,8 +284,8 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend a ! "die" } val t = probe.expectMsg(Terminated(a)(existenceConfirmed = true, addressTerminated = false)) - t.existenceConfirmed must be(true) - t.addressTerminated must be(false) + t.existenceConfirmed should be(true) + t.addressTerminated should be(false) shutdown(system) } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorWithStashSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorWithStashSpec.scala index 4662c34328..822e8d7f5c 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorWithStashSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorWithStashSpec.scala @@ -119,7 +119,7 @@ class ActorWithStashSpec extends AkkaSpec(ActorWithStashSpec.testConf) with Defa stasher ! "bye" stasher ! "hello" state.finished.await - state.s must be("bye") + state.s should be("bye") } "support protocols" in { diff --git a/akka-actor-tests/src/test/scala/akka/actor/DeathWatchSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/DeathWatchSpec.scala index c6e0735c51..be8bdaec83 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/DeathWatchSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/DeathWatchSpec.scala @@ -120,11 +120,11 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout terminal ! Kill terminal ! Kill - Await.result(terminal ? "foo", timeout.duration) must be === "foo" + Await.result(terminal ? "foo", timeout.duration) should equal("foo") terminal ! Kill expectTerminationOf(terminal) - terminal.isTerminated must be === true + terminal.isTerminated should equal(true) system.stop(supervisor) } @@ -154,8 +154,8 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout case FF(Failed(_, DeathPactException(`failed`), _)) if lastSender eq brother ⇒ 2 case WrappedTerminated(Terminated(`brother`)) ⇒ 3 } - testActor.isTerminated must not be true - result must be(Seq(1, 2, 3)) + testActor.isTerminated should not be true + result should be(Seq(1, 2, 3)) } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/DeployerSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/DeployerSpec.scala index c5dcc41b56..7682fa5c53 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/DeployerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/DeployerSpec.scala @@ -77,7 +77,7 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) { val service = "/service1" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -90,14 +90,14 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) { "use None deployment for undefined service" in { val service = "/undefined" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must be(None) + deployment should be(None) } "be able to parse 'akka.actor.deployment._' with dispatcher config" in { val service = "/service3" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -111,7 +111,7 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) { val service = "/service4" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -149,8 +149,8 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) { shutdown(ActorSystem("invalid-path", invalidDeployerConf)) } - e.getMessage must include("[ubåt]") - e.getMessage must include("[/gul/ubåt]") + e.getMessage should include("[ubåt]") + e.getMessage should include("[/gul/ubåt]") } "be able to parse 'akka.actor.deployment._' with from-code router" in { @@ -189,27 +189,27 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) { "have correct router mappings" in { val mapping = system.asInstanceOf[ActorSystemImpl].provider.deployer.routerTypeMapping - mapping("from-code") must be(classOf[akka.routing.NoRouter].getName) - mapping("round-robin-pool") must be(classOf[akka.routing.RoundRobinPool].getName) - mapping("round-robin-group") must be(classOf[akka.routing.RoundRobinGroup].getName) - mapping("random-pool") must be(classOf[akka.routing.RandomPool].getName) - mapping("random-group") must be(classOf[akka.routing.RandomGroup].getName) - mapping("smallest-mailbox-pool") must be(classOf[akka.routing.SmallestMailboxPool].getName) - mapping("broadcast-pool") must be(classOf[akka.routing.BroadcastPool].getName) - mapping("broadcast-group") must be(classOf[akka.routing.BroadcastGroup].getName) - mapping("scatter-gather-pool") must be(classOf[akka.routing.ScatterGatherFirstCompletedPool].getName) - mapping("scatter-gather-group") must be(classOf[akka.routing.ScatterGatherFirstCompletedGroup].getName) - mapping("consistent-hashing-pool") must be(classOf[akka.routing.ConsistentHashingPool].getName) - mapping("consistent-hashing-group") must be(classOf[akka.routing.ConsistentHashingGroup].getName) + mapping("from-code") should be(classOf[akka.routing.NoRouter].getName) + mapping("round-robin-pool") should be(classOf[akka.routing.RoundRobinPool].getName) + mapping("round-robin-group") should be(classOf[akka.routing.RoundRobinGroup].getName) + mapping("random-pool") should be(classOf[akka.routing.RandomPool].getName) + mapping("random-group") should be(classOf[akka.routing.RandomGroup].getName) + mapping("smallest-mailbox-pool") should be(classOf[akka.routing.SmallestMailboxPool].getName) + mapping("broadcast-pool") should be(classOf[akka.routing.BroadcastPool].getName) + mapping("broadcast-group") should be(classOf[akka.routing.BroadcastGroup].getName) + mapping("scatter-gather-pool") should be(classOf[akka.routing.ScatterGatherFirstCompletedPool].getName) + mapping("scatter-gather-group") should be(classOf[akka.routing.ScatterGatherFirstCompletedGroup].getName) + mapping("consistent-hashing-pool") should be(classOf[akka.routing.ConsistentHashingPool].getName) + mapping("consistent-hashing-group") should be(classOf[akka.routing.ConsistentHashingGroup].getName) } def assertRouting(service: String, expected: RouterConfig, expectPath: String): Unit = { val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment.map(_.path).getOrElse("NOT FOUND") must be(expectPath) - deployment.get.routerConfig.getClass must be(expected.getClass) - deployment.get.scope must be(NoScopeGiven) + deployment.map(_.path).getOrElse("NOT FOUND") should be(expectPath) + deployment.get.routerConfig.getClass should be(expected.getClass) + deployment.get.scope should be(NoScopeGiven) expected match { - case pool: Pool ⇒ deployment.get.routerConfig.asInstanceOf[Pool].resizer must be(pool.resizer) + case pool: Pool ⇒ deployment.get.routerConfig.asInstanceOf[Pool].resizer should be(pool.resizer) case _ ⇒ } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/FSMActorSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/FSMActorSpec.scala index e4ab624d1e..2a2de81b5c 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/FSMActorSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/FSMActorSpec.scala @@ -239,8 +239,8 @@ class FSMActorSpec extends AkkaSpec(Map("akka.actor.debug.fsm" -> true)) with Im }) def checkTimersActive(active: Boolean) { - for (timer ← timerNames) fsmref.isTimerActive(timer) must be(active) - fsmref.isStateTimerActive must be(active) + for (timer ← timerNames) fsmref.isTimerActive(timer) should be(active) + fsmref.isStateTimerActive should be(active) } checkTimersActive(false) diff --git a/akka-actor-tests/src/test/scala/akka/actor/FSMTimingSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/FSMTimingSpec.scala index 66b0df9152..15a73431d1 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/FSMTimingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/FSMTimingSpec.scala @@ -115,7 +115,7 @@ class FSMTimingSpec extends AkkaSpec with ImplicitSender { val seq = receiveWhile(2 seconds) { case Tick ⇒ Tick } - seq must have length 5 + seq should have length 5 within(500 millis) { expectMsg(Transition(fsm, TestRepeatedTimer, Initial)) } diff --git a/akka-actor-tests/src/test/scala/akka/actor/LocalActorRefProviderSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/LocalActorRefProviderSpec.scala index ca329fee90..f0348e1d78 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/LocalActorRefProviderSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/LocalActorRefProviderSpec.scala @@ -36,7 +36,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi "find actor refs using actorFor" in { val a = system.actorOf(Props(new Actor { def receive = { case _ ⇒ } })) val b = system.actorFor(a.path) - a must be === b + a should equal(b) } "find child actor with URL encoded name using actorFor" in { @@ -51,8 +51,8 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi })) a.tell("lookup", testActor) val b = expectMsgType[ActorRef] - b.isTerminated must be(false) - b.path.name must be(childName) + b.isTerminated should be(false) + b.path.name should be(childName) } } @@ -67,15 +67,15 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi a.tell(GetChild, testActor) val child = expectMsgType[ActorRef] val childProps1 = child.asInstanceOf[LocalActorRef].underlying.props - childProps1 must be(Props.empty) + childProps1 should be(Props.empty) system stop a expectTerminated(a) // the fields are cleared after the Terminated message has been sent, // so we need to check for a reasonable time after we receive it awaitAssert({ val childProps2 = child.asInstanceOf[LocalActorRef].underlying.props - childProps2 must not be theSameInstanceAs(childProps1) - childProps2 must be theSameInstanceAs ActorCell.terminatedProps + childProps2 should not be theSameInstanceAs(childProps1) + childProps2 should be theSameInstanceAs ActorCell.terminatedProps }, 1 second) } } @@ -86,7 +86,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi val impl = system.asInstanceOf[ActorSystemImpl] val provider = impl.provider - provider.isInstanceOf[LocalActorRefProvider] must be(true) + provider.isInstanceOf[LocalActorRefProvider] should be(true) for (i ← 0 until 100) { val address = "new-actor" + i @@ -97,7 +97,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi case Some(Failure(ex: InvalidActorNameException)) ⇒ 2 case x ⇒ x }) - set must be === Set(1, 2) + set should equal(Set(1, 2)) } } @@ -114,14 +114,14 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi } "throw suitable exceptions for malformed actor names" in { - intercept[InvalidActorNameException](system.actorOf(Props.empty, null)).getMessage.contains("null") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "")).getMessage.contains("empty") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "$hallo")).getMessage.contains("conform") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "a%")).getMessage.contains("conform") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "%3")).getMessage.contains("conform") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "%1t")).getMessage.contains("conform") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "a?")).getMessage.contains("conform") must be(true) - intercept[InvalidActorNameException](system.actorOf(Props.empty, "üß")).getMessage.contains("conform") must be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, null)).getMessage.contains("null") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "")).getMessage.contains("empty") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "$hallo")).getMessage.contains("conform") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "a%")).getMessage.contains("conform") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "%3")).getMessage.contains("conform") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "%1t")).getMessage.contains("conform") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "a?")).getMessage.contains("conform") should be(true) + intercept[InvalidActorNameException](system.actorOf(Props.empty, "üß")).getMessage.contains("conform") should be(true) } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/ReceiveTimeoutSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ReceiveTimeoutSpec.scala index af06f59c5f..64cc3aa0f3 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ReceiveTimeoutSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ReceiveTimeoutSpec.scala @@ -73,7 +73,7 @@ class ReceiveTimeoutSpec extends AkkaSpec { timeoutActor ! Tick Await.ready(timeoutLatch, TestLatch.DefaultTimeout) - count.get must be(1) + count.get should be(1) system.stop(timeoutActor) } diff --git a/akka-actor-tests/src/test/scala/akka/actor/RelativeActorPathSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/RelativeActorPathSpec.scala index 5cf80eac88..9e7252cc12 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/RelativeActorPathSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/RelativeActorPathSpec.scala @@ -4,27 +4,27 @@ package akka.actor import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import java.net.URLEncoder import scala.collection.immutable -class RelativeActorPathSpec extends WordSpec with MustMatchers { +class RelativeActorPathSpec extends WordSpec with Matchers { def elements(path: String): immutable.Seq[String] = RelativeActorPath.unapply(path).getOrElse(Nil) "RelativeActorPath" must { "match single name" in { - elements("foo") must be(List("foo")) + elements("foo") should be(List("foo")) } "match path separated names" in { - elements("foo/bar/baz") must be(List("foo", "bar", "baz")) + elements("foo/bar/baz") should be(List("foo", "bar", "baz")) } "match url encoded name" in { val name = URLEncoder.encode("akka://ClusterSystem@127.0.0.1:2552", "UTF-8") - elements(name) must be(List(name)) + elements(name) should be(List(name)) } "match path with uid fragment" in { - elements("foo/bar/baz#1234") must be(List("foo", "bar", "baz#1234")) + elements("foo/bar/baz#1234") should be(List("foo", "bar", "baz#1234")) } } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala index 8978d86c21..b62889a636 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala @@ -91,12 +91,12 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit // should not be run immediately assert(countDownLatch.await(100, TimeUnit.MILLISECONDS) == false) - countDownLatch.getCount must be(3) + countDownLatch.getCount should be(3) // after 1 second the wait should fail assert(countDownLatch.await(2, TimeUnit.SECONDS) == false) // should still be 1 left - countDownLatch.getCount must be(1) + countDownLatch.getCount should be(1) } /** @@ -120,7 +120,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit timeout.cancel() Thread.sleep((initialDelay + 100.milliseconds.dilated).toMillis) - ticks.get must be(0) + ticks.get should be(0) } "be cancellable after initial delay" taggedAs TimingTest in { @@ -135,25 +135,25 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit timeout.cancel() Thread.sleep((delay + 100.milliseconds.dilated).toMillis) - ticks.get must be(1) + ticks.get should be(1) } "be canceled if cancel is performed before execution" in { val task = collectCancellable(system.scheduler.scheduleOnce(10 seconds)(())) - task.cancel() must be(true) - task.isCancelled must be(true) - task.cancel() must be(false) - task.isCancelled must be(true) + task.cancel() should be(true) + task.isCancelled should be(true) + task.cancel() should be(false) + task.isCancelled should be(true) } "not be canceled if cancel is performed after execution" in { val latch = TestLatch(1) val task = collectCancellable(system.scheduler.scheduleOnce(10 millis)(latch.countDown())) Await.ready(latch, remaining) - task.cancel() must be(false) - task.isCancelled must be(false) - task.cancel() must be(false) - task.isCancelled must be(false) + task.cancel() should be(false) + task.isCancelled should be(false) + task.cancel() should be(false) + task.isCancelled should be(false) } /** @@ -228,7 +228,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit // LARS is a bit more aggressive in scheduling recurring tasks at the right // frequency and may execute them a little earlier; the actual expected timing // is 1599ms on a fast machine or 1699ms on a loaded one (plus some room for jenkins) - (System.nanoTime() - startTime).nanos.toMillis must be(1750L plusOrMinus 250) + (System.nanoTime() - startTime).nanos.toMillis should be(1750L +- 250) } "adjust for scheduler inaccuracy" taggedAs TimingTest in { @@ -238,7 +238,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit system.scheduler.schedule(25.millis, 25.millis) { latch.countDown() } Await.ready(latch, 6.seconds) // Rate - n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis must be(40.0 plusOrMinus 4) + n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis should be(40.0 +- 4) } "not be affected by long running task" taggedAs TimingTest in { @@ -251,7 +251,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit } Await.ready(latch, 6.seconds) // Rate - n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis must be(4.4 plusOrMinus 0.3) + n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis should be(4.4 +- 0.3) } "handle timeouts equal to multiple of wheel period" taggedAs TimingTest in { @@ -377,7 +377,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev val N = 1000000 (1 to N) foreach (_ ⇒ sched.scheduleOnce(delay)(counter.incrementAndGet())) sched.close() - Await.result(terminated, 3.seconds.dilated) must be > 10 + Await.result(terminated, 3.seconds.dilated) should be > 10 awaitCond(counter.get == N) } } @@ -480,9 +480,9 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev .takeWhile(_.isSuccess || { overrun -= 1; overrun >= 0 }) .partition(_.isSuccess) val s = success.size - s must be < cap + s should be < cap awaitCond(s == counter.get, message = s"$s was not ${counter.get}") - failure.size must be === headroom + failure.size should equal(headroom) } } } @@ -490,7 +490,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev trait Driver { def wakeUp(d: FiniteDuration): Unit def expectWait(): FiniteDuration - def expectWait(d: FiniteDuration) { expectWait() must be(d) } + def expectWait(d: FiniteDuration) { expectWait() should be(d) } def probe: TestProbe def step: FiniteDuration def close(): Unit diff --git a/akka-actor-tests/src/test/scala/akka/actor/SupervisorHierarchySpec.scala b/akka-actor-tests/src/test/scala/akka/actor/SupervisorHierarchySpec.scala index 940da62696..e806eab102 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/SupervisorHierarchySpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/SupervisorHierarchySpec.scala @@ -859,9 +859,9 @@ class SupervisorHierarchySpec extends AkkaSpec(SupervisorHierarchySpec.config) w failResumer ! "blahonga" expectMsg("blahonga") } - createAttempt.get must equal(6) - preStartCalled.get must equal(1) - postRestartCalled.get must equal(0) + createAttempt.get should equal(6) + preStartCalled.get should equal(1) + postRestartCalled.get should equal(0) } "survive being stressed" in { diff --git a/akka-actor-tests/src/test/scala/akka/actor/SupervisorMiscSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/SupervisorMiscSpec.scala index 2f05b18ceb..2d5af75d98 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/SupervisorMiscSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/SupervisorMiscSpec.scala @@ -63,7 +63,7 @@ class SupervisorMiscSpec extends AkkaSpec(SupervisorMiscSpec.config) with Defaul Seq("actor1" -> actor1, "actor2" -> actor2, "actor3" -> actor3, "actor4" -> actor4) map { case (id, ref) ⇒ (id, ref ? "status") } foreach { - case (id, f) ⇒ (id, Await.result(f, timeout.duration)) must be === ((id, "OK")) + case (id, f) ⇒ (id, Await.result(f, timeout.duration)) should equal((id, "OK")) } } } @@ -80,7 +80,7 @@ class SupervisorMiscSpec extends AkkaSpec(SupervisorMiscSpec.config) with Defaul } expectMsg("preStart") expectMsg("preStart") - a.isTerminated must be(false) + a.isTerminated should be(false) } "be able to recreate child when old child is Terminated" in { @@ -156,8 +156,8 @@ class SupervisorMiscSpec extends AkkaSpec(SupervisorMiscSpec.config) with Defaul parent ! "doit" } val p = expectMsgType[ActorRef].path - p.parent must be === parent.path - p.name must be === "child" + p.parent should equal(parent.path) + p.name should equal("child") } } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/SupervisorSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/SupervisorSpec.scala index 2fcdcf9a9c..d1bdeaa2e4 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/SupervisorSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/SupervisorSpec.scala @@ -139,7 +139,7 @@ class SupervisorSpec extends AkkaSpec("akka.actor.serialize-messages = off") wit } def ping(pingPongActor: ActorRef) = { - Await.result(pingPongActor.?(Ping)(DilatedTimeout), DilatedTimeout) must be === PongMessage + Await.result(pingPongActor.?(Ping)(DilatedTimeout), DilatedTimeout) should equal(PongMessage) expectMsg(Timeout, PingMessage) } @@ -371,7 +371,7 @@ class SupervisorSpec extends AkkaSpec("akka.actor.serialize-messages = off") wit dyingActor ! Ping expectMsg(PongMessage) - inits.get must be(3) + inits.get should be(3) system.stop(supervisor) } diff --git a/akka-actor-tests/src/test/scala/akka/actor/SupervisorTreeSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/SupervisorTreeSpec.scala index d05904f7dc..d00d173bca 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/SupervisorTreeSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/SupervisorTreeSpec.scala @@ -6,7 +6,7 @@ package akka.actor import language.postfixOps import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.Await import scala.concurrent.duration._ import akka.actor.Actor._ diff --git a/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala index 852f672344..7fb8869b9e 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala @@ -224,13 +224,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) TypedActor(system).typedActorOf( TypedProps[StackedImpl](classOf[Stacked], classOf[StackedImpl]).withTimeout(timeout)) - def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) must be(true) + def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) should be(true) "TypedActors" must { "be able to instantiate" in { val t = newFooBar - TypedActor(system).isTypedActor(t) must be(true) + TypedActor(system).isTypedActor(t) should be(true) mustStop(t) } @@ -240,71 +240,71 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) } "not stop non-started ones" in { - TypedActor(system).stop(null) must be(false) + TypedActor(system).stop(null) should be(false) } "throw an IllegalStateExcpetion when TypedActor.self is called in the wrong scope" in { filterEvents(EventFilter[IllegalStateException]("Calling")) { (intercept[IllegalStateException] { TypedActor.self[Foo] - }).getMessage must equal("Calling TypedActor.self outside of a TypedActor implementation method!") + }).getMessage should equal("Calling TypedActor.self outside of a TypedActor implementation method!") } } "have access to itself when executing a method call" in { val t = newFooBar - t.self must be(t) + t.self should be(t) mustStop(t) } "be able to call toString" in { val t = newFooBar - t.toString must be(TypedActor(system).getActorRefFor(t).toString) + t.toString should be(TypedActor(system).getActorRefFor(t).toString) mustStop(t) } "be able to call equals" in { val t = newFooBar - t must equal(t) - t must not equal (null) + t should equal(t) + t should not equal (null) mustStop(t) } "be able to call hashCode" in { val t = newFooBar - t.hashCode must be(TypedActor(system).getActorRefFor(t).hashCode) + t.hashCode should be(TypedActor(system).getActorRefFor(t).hashCode) mustStop(t) } "be able to call user-defined void-methods" in { val t = newFooBar t.incr() - t.read() must be(1) + t.read() should be(1) t.incr() - t.read() must be(2) - t.read() must be(2) + t.read() should be(2) + t.read() should be(2) mustStop(t) } "be able to call normally returning methods" in { val t = newFooBar - t.pigdog() must be("Pigdog") + t.pigdog() should be("Pigdog") mustStop(t) } "be able to call null returning methods" in { val t = newFooBar - t.nullJOption() must be === JOption.none - t.nullOption() must be === None - t.nullReturn() must be === null - Await.result(t.nullFuture(), timeout.duration) must be === null + t.nullJOption() should equal(JOption.none) + t.nullOption() should equal(None) + t.nullReturn() should ===(null) + Await.result(t.nullFuture(), timeout.duration) should ===(null) } "be able to call Future-returning methods non-blockingly" in { val t = newFooBar val f = t.futurePigdog(200 millis) - f.isCompleted must be(false) - Await.result(f, timeout.duration) must be("Pigdog") + f.isCompleted should be(false) + Await.result(f, timeout.duration) should be("Pigdog") mustStop(t) } @@ -312,36 +312,36 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) val t = newFooBar val futures = for (i ← 1 to 20) yield (i, t.futurePigdog(20 millis, i)) for ((i, f) ← futures) { - Await.result(f, remaining) must be("Pigdog" + i) + Await.result(f, remaining) should be("Pigdog" + i) } mustStop(t) } "be able to call methods returning Java Options" taggedAs TimingTest in { val t = newFooBar(1 second) - t.joptionPigdog(100 millis).get must be("Pigdog") - t.joptionPigdog(2 seconds) must be(JOption.none[String]) + t.joptionPigdog(100 millis).get should be("Pigdog") + t.joptionPigdog(2 seconds) should be(JOption.none[String]) mustStop(t) } "be able to handle AskTimeoutException as None" taggedAs TimingTest in { val t = newFooBar(200 millis) - t.joptionPigdog(600 millis) must be(JOption.none[String]) + t.joptionPigdog(600 millis) should be(JOption.none[String]) mustStop(t) } "be able to call methods returning Scala Options" taggedAs TimingTest in { val t = newFooBar(1 second) - t.optionPigdog(100 millis).get must be("Pigdog") - t.optionPigdog(2 seconds) must be(None) + t.optionPigdog(100 millis).get should be("Pigdog") + t.optionPigdog(2 seconds) should be(None) mustStop(t) } "be able to compose futures without blocking" in within(timeout.duration) { val t, t2 = newFooBar(remaining) val f = t.futureComposePigdogFrom(t2) - f.isCompleted must be(false) - Await.result(f, remaining) must equal("PIGDOG") + f.isCompleted should be(false) + Await.result(f, remaining) should equal("PIGDOG") mustStop(t) mustStop(t2) } @@ -360,17 +360,17 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) t.incr() t.failingPigdog() - t.read() must be(1) //Make sure state is not reset after failure + t.read() should be(1) //Make sure state is not reset after failure - intercept[IllegalStateException] { Await.result(t.failingFuturePigdog, 2 seconds) }.getMessage must be("expected") - t.read() must be(1) //Make sure state is not reset after failure + intercept[IllegalStateException] { Await.result(t.failingFuturePigdog, 2 seconds) }.getMessage should be("expected") + t.read() should be(1) //Make sure state is not reset after failure - (intercept[IllegalStateException] { t.failingJOptionPigdog }).getMessage must be("expected") - t.read() must be(1) //Make sure state is not reset after failure + (intercept[IllegalStateException] { t.failingJOptionPigdog }).getMessage should be("expected") + t.read() should be(1) //Make sure state is not reset after failure - (intercept[IllegalStateException] { t.failingOptionPigdog }).getMessage must be("expected") + (intercept[IllegalStateException] { t.failingOptionPigdog }).getMessage should be("expected") - t.read() must be(1) //Make sure state is not reset after failure + t.read() should be(1) //Make sure state is not reset after failure mustStop(t) } @@ -379,13 +379,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) "be restarted on failure" in { filterEvents(EventFilter[IllegalStateException]("expected")) { val t = newFooBar(Duration(2, "s")) - intercept[IllegalStateException] { t.failingOptionPigdog() }.getMessage must be === "expected" - t.optionPigdog() must be === Some("Pigdog") + intercept[IllegalStateException] { t.failingOptionPigdog() }.getMessage should equal("expected") + t.optionPigdog() should equal(Some("Pigdog")) mustStop(t) val ta: F = TypedActor(system).typedActorOf(TypedProps[FI]()) - intercept[IllegalStateException] { ta.f(true) }.getMessage must be === "expected" - ta.f(false) must be === 1 + intercept[IllegalStateException] { ta.f(true) }.getMessage should equal("expected") + ta.f(false) should equal(1) mustStop(ta) } @@ -393,8 +393,8 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) "be able to support stacked traits for the interface part" in { val t = newStacked() - t.notOverriddenStacked must be("foobar") - t.stacked must be("FOOBAR") + t.notOverriddenStacked should be("foobar") + t.stacked should be("FOOBAR") mustStop(t) } @@ -402,16 +402,16 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) val t: Foo = TypedActor(system).typedActorOf(TypedProps[Bar]()) val f = t.futurePigdog(200 millis) val f2 = t.futurePigdog(Duration.Zero) - f2.isCompleted must be(false) - f.isCompleted must be(false) - Await.result(f, remaining) must equal(Await.result(f2, remaining)) + f2.isCompleted should be(false) + f.isCompleted should be(false) + Await.result(f, remaining) should equal(Await.result(f2, remaining)) mustStop(t) } "be able to support implementation only typed actors with complex interfaces" in { val t: Stackable1 with Stackable2 = TypedActor(system).typedActorOf(TypedProps[StackedImpl]()) - t.stackable1 must be("foo") - t.stackable2 must be("bar") + t.stackable1 should be("foo") + t.stackable2 should be("bar") mustStop(t) } @@ -421,7 +421,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) val results = for (i ← 1 to 120) yield (i, iterator.next.futurePigdog(200 millis, i)) - for ((i, r) ← results) Await.result(r, remaining) must be("Pigdog" + i) + for ((i, r) ← results) Await.result(r, remaining) should be("Pigdog" + i) for (t ← thais) mustStop(t) } @@ -440,7 +440,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) val mNew = in.readObject().asInstanceOf[TypedActor.MethodCall] - mNew.method must be(m.method) + mNew.method should be(m.method) } } @@ -459,13 +459,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) val mNew = in.readObject().asInstanceOf[TypedActor.MethodCall] - mNew.method must be(m.method) - mNew.parameters must have size 3 - mNew.parameters(0) must not be null - mNew.parameters(0).getClass must be === classOf[Bar] - mNew.parameters(1) must be(null) - mNew.parameters(2) must not be null - mNew.parameters(2).asInstanceOf[Int] must be === 1 + mNew.method should be(m.method) + mNew.parameters should have size 3 + mNew.parameters(0) should not be null + mNew.parameters(0).getClass should equal(classOf[Bar]) + mNew.parameters(1) should be(null) + mNew.parameters(2) should not be null + mNew.parameters(2).asInstanceOf[Int] should equal(1) } } @@ -474,7 +474,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) JavaSerializer.currentSystem.withValue(system.asInstanceOf[ExtendedActorSystem]) { val t = newFooBar(Duration(2, "s")) - t.optionPigdog() must be === Some("Pigdog") + t.optionPigdog() should equal(Some("Pigdog")) val baos = new ByteArrayOutputStream(8192 * 4) val out = new ObjectOutputStream(baos) @@ -486,9 +486,9 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) val tNew = in.readObject().asInstanceOf[Foo] - tNew must be === t + tNew should equal(t) - tNew.optionPigdog() must be === Some("Pigdog") + tNew.optionPigdog() should equal(Some("Pigdog")) mustStop(t) } @@ -512,7 +512,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config) //Done with that now ta.poisonPill(t) - latch.await(10, TimeUnit.SECONDS) must be === true + latch.await(10, TimeUnit.SECONDS) should equal(true) } } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/dispatch/BalancingDispatcherSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/dispatch/BalancingDispatcherSpec.scala index 1a5c7e8661..71a293f188 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/dispatch/BalancingDispatcherSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/dispatch/BalancingDispatcherSpec.scala @@ -80,10 +80,10 @@ class BalancingDispatcherSpec extends AkkaSpec(BalancingDispatcherSpec.config) { } finishedCounter.await(5, TimeUnit.SECONDS) - fast.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages must be(false) - slow.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages must be(false) - fast.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount must be > sentToFast - fast.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount must be > + fast.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages should be(false) + slow.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages should be(false) + fast.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount should be > sentToFast + fast.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount should be > (slow.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount) system.stop(slow) system.stop(fast) diff --git a/akka-actor-tests/src/test/scala/akka/actor/dispatch/DispatchersSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/dispatch/DispatchersSpec.scala index 62dc857b27..4c2ad27209 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/dispatch/DispatchersSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/dispatch/DispatchersSpec.scala @@ -96,12 +96,12 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend "use defined properties" in { val dispatcher = lookup("myapp.mydispatcher") - dispatcher.throughput must be(17) + dispatcher.throughput should be(17) } "use specific id" in { val dispatcher = lookup("myapp.mydispatcher") - dispatcher.id must be("myapp.mydispatcher") + dispatcher.id should be("myapp.mydispatcher") } "complain about missing config" in { @@ -112,8 +112,8 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend "have only one default dispatcher" in { val dispatcher = lookup(Dispatchers.DefaultDispatcherId) - dispatcher must be === defaultGlobalDispatcher - dispatcher must be === system.dispatcher + dispatcher should equal(defaultGlobalDispatcher) + dispatcher should equal(system.dispatcher) } "throw ConfigurationException if type does not exist" in { @@ -131,7 +131,7 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend "provide lookup of dispatchers by id" in { val d1 = lookup("myapp.mydispatcher") val d2 = lookup("myapp.mydispatcher") - d1 must be === d2 + d1 should equal(d2) } "include system name and dispatcher id in thread names for fork-join-executor" in { diff --git a/akka-actor-tests/src/test/scala/akka/actor/routing/ListenerSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/routing/ListenerSpec.scala index 22f96adc63..3edc7b3447 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/routing/ListenerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/routing/ListenerSpec.scala @@ -47,7 +47,7 @@ class ListenerSpec extends AkkaSpec { broadcast ! "foo" Await.ready(barLatch, TestLatch.DefaultTimeout) - barCount.get must be(2) + barCount.get should be(2) Await.ready(fooLatch, TestLatch.DefaultTimeout) diff --git a/akka-actor-tests/src/test/scala/akka/config/ConfigSpec.scala b/akka-actor-tests/src/test/scala/akka/config/ConfigSpec.scala index fb8e2f39dc..ccccb42423 100644 --- a/akka-actor-tests/src/test/scala/akka/config/ConfigSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/config/ConfigSpec.scala @@ -24,44 +24,44 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin { import config._ - getString("akka.version") must equal("2.3-SNAPSHOT") - settings.ConfigVersion must equal("2.3-SNAPSHOT") + getString("akka.version") should equal("2.3-SNAPSHOT") + settings.ConfigVersion should equal("2.3-SNAPSHOT") - getBoolean("akka.daemonic") must equal(false) + getBoolean("akka.daemonic") should equal(false) - // WARNING: This setting must be off in the default reference.conf, but must be on when running + // WARNING: This setting should be off in the default reference.conf, but should be on when running // the test suite. - getBoolean("akka.actor.serialize-messages") must equal(true) - settings.SerializeAllMessages must equal(true) + getBoolean("akka.actor.serialize-messages") should equal(true) + settings.SerializeAllMessages should equal(true) - getInt("akka.scheduler.ticks-per-wheel") must equal(512) - getMilliseconds("akka.scheduler.tick-duration") must equal(10) - getString("akka.scheduler.implementation") must equal("akka.actor.LightArrayRevolverScheduler") + getInt("akka.scheduler.ticks-per-wheel") should equal(512) + getMilliseconds("akka.scheduler.tick-duration") should equal(10) + getString("akka.scheduler.implementation") should equal("akka.actor.LightArrayRevolverScheduler") - getBoolean("akka.daemonic") must be(false) - settings.Daemonicity must be(false) + getBoolean("akka.daemonic") should be(false) + settings.Daemonicity should be(false) - getBoolean("akka.jvm-exit-on-fatal-error") must be(true) - settings.JvmExitOnFatalError must be(true) + getBoolean("akka.jvm-exit-on-fatal-error") should be(true) + settings.JvmExitOnFatalError should be(true) - getInt("akka.actor.deployment.default.virtual-nodes-factor") must be(10) - settings.DefaultVirtualNodesFactor must be(10) + getInt("akka.actor.deployment.default.virtual-nodes-factor") should be(10) + settings.DefaultVirtualNodesFactor should be(10) - getMilliseconds("akka.actor.unstarted-push-timeout") must be(10.seconds.toMillis) - settings.UnstartedPushTimeout.duration must be(10.seconds) + getMilliseconds("akka.actor.unstarted-push-timeout") should be(10.seconds.toMillis) + settings.UnstartedPushTimeout.duration should be(10.seconds) - settings.Loggers.size must be(1) - settings.Loggers.head must be(classOf[DefaultLogger].getName) - getStringList("akka.loggers").get(0) must be(classOf[DefaultLogger].getName) + settings.Loggers.size should be(1) + settings.Loggers.head should be(classOf[DefaultLogger].getName) + getStringList("akka.loggers").get(0) should be(classOf[DefaultLogger].getName) - getMilliseconds("akka.logger-startup-timeout") must be(5.seconds.toMillis) - settings.LoggerStartTimeout.duration must be(5.seconds) + getMilliseconds("akka.logger-startup-timeout") should be(5.seconds.toMillis) + settings.LoggerStartTimeout.duration should be(5.seconds) - getInt("akka.log-dead-letters") must be(10) - settings.LogDeadLetters must be(10) + getInt("akka.log-dead-letters") should be(10) + settings.LogDeadLetters should be(10) - getBoolean("akka.log-dead-letters-during-shutdown") must be(true) - settings.LogDeadLettersDuringShutdown must be(true) + getBoolean("akka.log-dead-letters-during-shutdown") should be(true) + settings.LogDeadLettersDuringShutdown should be(true) } { @@ -70,21 +70,21 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin //General dispatcher config { - c.getString("type") must equal("Dispatcher") - c.getString("executor") must equal("fork-join-executor") - c.getMilliseconds("shutdown-timeout") must equal(1 * 1000) - c.getInt("throughput") must equal(5) - c.getMilliseconds("throughput-deadline-time") must equal(0) - c.getBoolean("attempt-teamwork") must equal(true) + c.getString("type") should equal("Dispatcher") + c.getString("executor") should equal("fork-join-executor") + c.getMilliseconds("shutdown-timeout") should equal(1 * 1000) + c.getInt("throughput") should equal(5) + c.getMilliseconds("throughput-deadline-time") should equal(0) + c.getBoolean("attempt-teamwork") should equal(true) } //Fork join executor config { val pool = c.getConfig("fork-join-executor") - pool.getInt("parallelism-min") must equal(8) - pool.getDouble("parallelism-factor") must equal(3.0) - pool.getInt("parallelism-max") must equal(64) + pool.getInt("parallelism-min") should equal(8) + pool.getDouble("parallelism-factor") should equal(3.0) + pool.getInt("parallelism-max") should equal(64) } //Thread pool executor config @@ -92,38 +92,38 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin { val pool = c.getConfig("thread-pool-executor") import pool._ - getMilliseconds("keep-alive-time") must equal(60 * 1000) - getDouble("core-pool-size-factor") must equal(3.0) - getDouble("max-pool-size-factor") must equal(3.0) - getInt("task-queue-size") must equal(-1) - getString("task-queue-type") must equal("linked") - getBoolean("allow-core-timeout") must equal(true) + getMilliseconds("keep-alive-time") should equal(60 * 1000) + getDouble("core-pool-size-factor") should equal(3.0) + getDouble("max-pool-size-factor") should equal(3.0) + getInt("task-queue-size") should equal(-1) + getString("task-queue-type") should equal("linked") + getBoolean("allow-core-timeout") should equal(true) } // Debug config { val debug = config.getConfig("akka.actor.debug") import debug._ - getBoolean("receive") must be(false) - settings.AddLoggingReceive must be(false) + getBoolean("receive") should be(false) + settings.AddLoggingReceive should be(false) - getBoolean("autoreceive") must be(false) - settings.DebugAutoReceive must be(false) + getBoolean("autoreceive") should be(false) + settings.DebugAutoReceive should be(false) - getBoolean("lifecycle") must be(false) - settings.DebugLifecycle must be(false) + getBoolean("lifecycle") should be(false) + settings.DebugLifecycle should be(false) - getBoolean("fsm") must be(false) - settings.FsmDebugEvent must be(false) + getBoolean("fsm") should be(false) + settings.FsmDebugEvent should be(false) - getBoolean("event-stream") must be(false) - settings.DebugEventStream must be(false) + getBoolean("event-stream") should be(false) + settings.DebugEventStream should be(false) - getBoolean("unhandled") must be(false) - settings.DebugUnhandledMessage must be(false) + getBoolean("unhandled") should be(false) + settings.DebugUnhandledMessage should be(false) - getBoolean("router-misconfiguration") must be(false) - settings.DebugRouterMisconfiguration must be(false) + getBoolean("router-misconfiguration") should be(false) + settings.DebugRouterMisconfiguration should be(false) } } @@ -134,9 +134,9 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin // general mailbox config { - c.getInt("mailbox-capacity") must equal(1000) - c.getMilliseconds("mailbox-push-timeout-time") must equal(10 * 1000) - c.getString("mailbox-type") must be("akka.dispatch.UnboundedMailbox") + c.getInt("mailbox-capacity") should equal(1000) + c.getMilliseconds("mailbox-push-timeout-time") should equal(10 * 1000) + c.getString("mailbox-type") should be("akka.dispatch.UnboundedMailbox") } } } diff --git a/akka-actor-tests/src/test/scala/akka/dataflow/Future2Actor.scala b/akka-actor-tests/src/test/scala/akka/dataflow/Future2Actor.scala index 572f0b5ef4..4251ebbc68 100644 --- a/akka-actor-tests/src/test/scala/akka/dataflow/Future2Actor.scala +++ b/akka-actor-tests/src/test/scala/akka/dataflow/Future2Actor.scala @@ -26,14 +26,14 @@ class Future2ActorSpec extends AkkaSpec with DefaultTimeout { implicit val someActor = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior })) Future(42) pipeTo testActor pipeTo testActor expectMsgAllOf(1 second, 42, 42) - lastSender must be(someActor) + lastSender should be(someActor) } "support convenient sending with explicit sender" in { val someActor = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior })) Future(42).to(testActor, someActor) expectMsgAllOf(1 second, 42) - lastSender must be(someActor) + lastSender should be(someActor) } "support reply via sender" in { @@ -43,10 +43,10 @@ class Future2ActorSpec extends AkkaSpec with DefaultTimeout { case "ex" ⇒ Future(throw new AssertionError) pipeTo context.sender } })) - Await.result(actor ? "do", timeout.duration) must be(31) + Await.result(actor ? "do", timeout.duration) should be(31) intercept[ExecutionException] { Await.result(actor ? "ex", timeout.duration) - }.getCause.isInstanceOf[AssertionError] must be(true) + }.getCause.isInstanceOf[AssertionError] should be(true) } } } diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/ExecutionContextSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/ExecutionContextSpec.scala index e4713adfe0..249743a40f 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/ExecutionContextSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/ExecutionContextSpec.scala @@ -15,23 +15,23 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout { val es = Executors.newCachedThreadPool() try { val executor: Executor with ExecutionContext = ExecutionContext.fromExecutor(es) - executor must not be (null) + executor should not be (null) val executorService: ExecutorService with ExecutionContext = ExecutionContext.fromExecutorService(es) - executorService must not be (null) + executorService should not be (null) val jExecutor: ExecutionContextExecutor = ExecutionContext.fromExecutor(es) - jExecutor must not be (null) + jExecutor should not be (null) val jExecutorService: ExecutionContextExecutorService = ExecutionContexts.fromExecutorService(es) - jExecutorService must not be (null) + jExecutorService should not be (null) } finally { es.shutdown } } "be able to use Batching" in { - system.dispatcher.isInstanceOf[BatchingExecutor] must be(true) + system.dispatcher.isInstanceOf[BatchingExecutor] should be(true) import system.dispatcher @@ -55,11 +55,11 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout { } callingThreadLock.compareAndSet(1, 0) // Disable the lock } - Await.result(p.future, timeout.duration) must be === (()) + Await.result(p.future, timeout.duration) should equal(()) } "be able to avoid starvation when Batching is used and Await/blocking is called" in { - system.dispatcher.isInstanceOf[BatchingExecutor] must be(true) + system.dispatcher.isInstanceOf[BatchingExecutor] should be(true) import system.dispatcher def batchable[T](f: ⇒ T)(implicit ec: ExecutionContext): Unit = ec.execute(new Batchable { @@ -93,15 +93,15 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout { awaitCond(counter.get == 2) perform(_ + 4) perform(_ * 2) - sec.size must be === 2 + sec.size should equal(2) Thread.sleep(500) - sec.size must be === 2 - counter.get must be === 2 + sec.size should equal(2) + counter.get should equal(2) sec.resume() awaitCond(counter.get == 12) perform(_ * 2) awaitCond(counter.get == 24) - sec.isEmpty must be === true + sec.isEmpty should equal(true) } "execute 'throughput' number of tasks per sweep" in { @@ -118,11 +118,11 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout { val total = 1000 1 to total foreach { _ ⇒ perform(_ + 1) } - sec.size() must be === total + sec.size() should equal(total) sec.resume() awaitCond(counter.get == total) - submissions.get must be === (total / throughput) - sec.isEmpty must be === true + submissions.get should equal(total / throughput) + sec.isEmpty should equal(true) } "execute tasks in serial" in { @@ -133,7 +133,7 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout { 1 to total foreach { i ⇒ perform(c ⇒ if (c == (i - 1)) c + 1 else c) } awaitCond(counter.get == total) - sec.isEmpty must be === true + sec.isEmpty should equal(true) } "relinquish thread when suspended" in { @@ -151,13 +151,13 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout { 1 to 10 foreach { _ ⇒ perform(identity) } perform(x ⇒ { sec.suspend(); x * 2 }) perform(_ + 8) - sec.size must be === 13 + sec.size should equal(13) sec.resume() awaitCond(counter.get == 2) sec.resume() awaitCond(counter.get == 10) - sec.isEmpty must be === true - submissions.get must be === 2 + sec.isEmpty should equal(true) + submissions.get should equal(2) } } } 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 28a85734c6..07a2c4ae41 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala @@ -68,12 +68,12 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa val empty = Promise[String]().future val timedOut = Promise.successful[String]("Timedout").future - Await.result(failure fallbackTo timedOut, timeout.duration) must be("Timedout") - Await.result(timedOut fallbackTo empty, timeout.duration) must be("Timedout") - Await.result(failure fallbackTo failure fallbackTo timedOut, timeout.duration) must be("Timedout") + Await.result(failure fallbackTo timedOut, timeout.duration) should be("Timedout") + Await.result(timedOut fallbackTo empty, timeout.duration) should be("Timedout") + Await.result(failure fallbackTo failure fallbackTo timedOut, timeout.duration) should be("Timedout") intercept[RuntimeException] { Await.result(failure fallbackTo otherFailure, timeout.duration) - }.getMessage must be("last") + }.getMessage should be("last") } } "completed with a result" must { @@ -117,7 +117,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa p.completeWith(Future { "Hi " }(B)) try { - Await.result(result, timeout.duration) must be === "Hi A" + Await.result(result, timeout.duration) should equal("Hi A") } finally { A.shutdown() B.shutdown() @@ -261,7 +261,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa c ← (actor ? 7).mapTo[String] } yield b + "-" + c - Await.result(future1, timeout.duration) must be("10-14") + Await.result(future1, timeout.duration) should be("10-14") assert(checkType(future1, classTag[String])) intercept[ClassCastException] { Await.result(future2, timeout.duration) } system.stop(actor) @@ -289,7 +289,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa Res(c: Int) ← actor ? Req(7) } yield b + "-" + c - Await.result(future1, timeout.duration) must be("10-14") + Await.result(future1, timeout.duration) should be("10-14") intercept[NoSuchElementException] { Await.result(future2, timeout.duration) } system.stop(actor) } @@ -326,17 +326,17 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa } val future11 = actor ? "Failure" recover { case _ ⇒ "Oops!" } - Await.result(future1, timeout.duration) must be(5) + Await.result(future1, timeout.duration) should be(5) intercept[ArithmeticException] { Await.result(future2, timeout.duration) } intercept[ArithmeticException] { Await.result(future3, timeout.duration) } - Await.result(future4, timeout.duration) must be("5") - Await.result(future5, timeout.duration) must be("0") + Await.result(future4, timeout.duration) should be("5") + Await.result(future5, timeout.duration) should be("0") intercept[ArithmeticException] { Await.result(future6, timeout.duration) } - Await.result(future7, timeout.duration) must be("You got ERROR") + Await.result(future7, timeout.duration) should be("You got ERROR") intercept[RuntimeException] { Await.result(future8, timeout.duration) } - Await.result(future9, timeout.duration) must be("FAIL!") - Await.result(future10, timeout.duration) must be("World") - Await.result(future11, timeout.duration) must be("Oops!") + Await.result(future9, timeout.duration) should be("FAIL!") + Await.result(future10, timeout.duration) should be("World") + Await.result(future11, timeout.duration) should be("Oops!") system.stop(actor) } @@ -349,42 +349,42 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa intercept[IllegalStateException] { Await.result(Promise.failed[String](o).future recoverWith { case _ if false == true ⇒ yay }, timeout.duration) - } must be(o) + } should be(o) - Await.result(Promise.failed[String](o).future recoverWith { case _ ⇒ yay }, timeout.duration) must equal("yay!") + Await.result(Promise.failed[String](o).future recoverWith { case _ ⇒ yay }, timeout.duration) should equal("yay!") intercept[IllegalStateException] { Await.result(Promise.failed[String](o).future recoverWith { case _ ⇒ Promise.failed[String](r).future }, timeout.duration) - } must be(r) + } should be(r) } "andThen like a boss" in { val q = new LinkedBlockingQueue[Int] for (i ← 1 to 1000) { - Await.result(Future { q.add(1); 3 } andThen { case _ ⇒ q.add(2) } andThen { case Success(0) ⇒ q.add(Int.MaxValue) } andThen { case _ ⇒ q.add(3); }, timeout.duration) must be(3) - q.poll() must be(1) - q.poll() must be(2) - q.poll() must be(3) + Await.result(Future { q.add(1); 3 } andThen { case _ ⇒ q.add(2) } andThen { case Success(0) ⇒ q.add(Int.MaxValue) } andThen { case _ ⇒ q.add(3); }, timeout.duration) should be(3) + q.poll() should be(1) + q.poll() should be(2) + q.poll() should be(3) q.clear() } } "firstCompletedOf" in { val futures = Vector.fill[Future[Int]](10)(Promise[Int]().future) :+ Promise.successful[Int](5).future - Await.result(Future.firstCompletedOf(futures), timeout.duration) must be(5) + Await.result(Future.firstCompletedOf(futures), timeout.duration) should be(5) } "find" in { val futures = for (i ← 1 to 10) yield Future { i } val result = Future.find[Int](futures)(_ == 3) - Await.result(result, timeout.duration) must be(Some(3)) + Await.result(result, timeout.duration) should be(Some(3)) val notFound = Future.find[Int](futures)(_ == 11) - Await.result(notFound, timeout.duration) must be(None) + Await.result(notFound, timeout.duration) should be(None) } "fold" in { - Await.result(Future.fold((1 to 10).toList map { i ⇒ Future(i) })(0)(_ + _), remaining) must be(55) + Await.result(Future.fold((1 to 10).toList map { i ⇒ Future(i) })(0)(_ + _), remaining) should be(55) } "zip" in { @@ -392,22 +392,22 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa val f = new IllegalStateException("test") intercept[IllegalStateException] { Await.result(Promise.failed[String](f).future zip Promise.successful("foo").future, timeout) - } must be(f) + } should be(f) intercept[IllegalStateException] { Await.result(Promise.successful("foo").future zip Promise.failed[String](f).future, timeout) - } must be(f) + } should be(f) intercept[IllegalStateException] { Await.result(Promise.failed[String](f).future zip Promise.failed[String](f).future, timeout) - } must be(f) + } should be(f) - Await.result(Promise.successful("foo").future zip Promise.successful("foo").future, timeout) must be(("foo", "foo")) + Await.result(Promise.successful("foo").future zip Promise.successful("foo").future, timeout) should be(("foo", "foo")) } "fold by composing" in { val futures = (1 to 10).toList map { i ⇒ Future(i) } - Await.result(futures.foldLeft(Future(0))((fr, fa) ⇒ for (r ← fr; a ← fa) yield (r + a)), timeout.duration) must be(55) + Await.result(futures.foldLeft(Future(0))((fr, fa) ⇒ for (r ← fr; a ← fa) yield (r + a)), timeout.duration) should be(55) } "fold with an exception" in { @@ -416,7 +416,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa case 6 ⇒ Future(throw new IllegalArgumentException("shouldFoldResultsWithException: expected")) case i ⇒ Future(i) } - intercept[Throwable] { Await.result(Future.fold(futures)(0)(_ + _), remaining) }.getMessage must be("shouldFoldResultsWithException: expected") + intercept[Throwable] { Await.result(Future.fold(futures)(0)(_ + _), remaining) }.getMessage should be("shouldFoldResultsWithException: expected") } } @@ -437,7 +437,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa } "return zero value if folding empty list" in { - Await.result(Future.fold(List[Future[Int]]())(0)(_ + _), timeout.duration) must be(0) + Await.result(Future.fold(List[Future[Int]]())(0)(_ + _), timeout.duration) should be(0) } "reduce results" in { @@ -451,7 +451,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa case 6 ⇒ Future(throw new IllegalArgumentException("shouldReduceResultsWithException: expected")) case i ⇒ Future(i) } - intercept[Throwable] { Await.result(Future.reduce(futures)(_ + _), remaining) }.getMessage must be === "shouldReduceResultsWithException: expected" + intercept[Throwable] { Await.result(Future.reduce(futures)(_ + _), remaining) }.getMessage should equal("shouldReduceResultsWithException: expected") } } @@ -531,51 +531,51 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa FutureSpec.ready(latch(0), TestLatch.DefaultTimeout) - f1 must not be ('completed) - f2 must not be ('completed) + f1 should not be ('completed) + f2 should not be ('completed) latch(1).open() FutureSpec.ready(latch(2), TestLatch.DefaultTimeout) - f1 must be('completed) - f2 must not be ('completed) + f1 should be('completed) + f2 should not be ('completed) val f3 = f1 map { s ⇒ latch(5).open(); FutureSpec.ready(latch(6), TestLatch.DefaultTimeout); s.length * 2 } f3 foreach (_ ⇒ latch(3).open()) FutureSpec.ready(latch(5), TestLatch.DefaultTimeout) - f3 must not be ('completed) + f3 should not be ('completed) latch(6).open() FutureSpec.ready(latch(4), TestLatch.DefaultTimeout) - f2 must be('completed) - f3 must be('completed) + f2 should be('completed) + f3 should be('completed) val p1 = Promise[String]() val f4 = p1.future map { s ⇒ latch(7).open(); FutureSpec.ready(latch(8), TestLatch.DefaultTimeout); s.length } f4 foreach (_ ⇒ latch(9).open()) - p1 must not be ('completed) - f4 must not be ('completed) + p1 should not be ('completed) + f4 should not be ('completed) p1 complete Success("Hello") FutureSpec.ready(latch(7), TestLatch.DefaultTimeout) - p1 must be('completed) - f4 must not be ('completed) + p1 should be('completed) + f4 should not be ('completed) latch(8).open() FutureSpec.ready(latch(9), TestLatch.DefaultTimeout) - FutureSpec.ready(f4, timeout.duration) must be('completed) + FutureSpec.ready(f4, timeout.duration) should be('completed) } "not deadlock with nested await (ticket 1313)" in { val simple = Future(()) map (_ ⇒ Await.result((Future(()) map (_ ⇒ ())), timeout.duration)) - FutureSpec.ready(simple, timeout.duration) must be('completed) + FutureSpec.ready(simple, timeout.duration) should be('completed) val l1, l2 = new TestLatch val complex = Future(()) map { _ ⇒ @@ -585,7 +585,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa nested foreach (_ ⇒ l2.open()) FutureSpec.ready(l2, TestLatch.DefaultTimeout) } - FutureSpec.ready(complex, timeout.duration) must be('completed) + FutureSpec.ready(complex, timeout.duration) should be('completed) } "re-use the same thread for nested futures with batching ExecutionContext" in { @@ -608,98 +608,98 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa } Await.ready(f, timeout.duration) // TODO re-enable once we're using the batching dispatcher - // failCount.get must be(0) + // failCount.get should be(0) } } } def emptyFuture(f: (Future[Any] ⇒ Unit) ⇒ Unit) { - "not be completed" in { f(_ must not be ('completed)) } - "not contain a value" in { f(_.value must be(None)) } + "not be completed" in { f(_ should not be ('completed)) } + "not contain a value" in { f(_.value should be(None)) } } def futureWithResult(f: ((Future[Any], Any) ⇒ Unit) ⇒ Unit) { - "be completed" in { f((future, _) ⇒ future must be('completed)) } - "contain a value" in { f((future, result) ⇒ future.value must be(Some(Success(result)))) } - "return result with 'get'" in { f((future, result) ⇒ Await.result(future, timeout.duration) must be(result)) } - "return result with 'Await.result'" in { f((future, result) ⇒ Await.result(future, timeout.duration) must be(result)) } + "be completed" in { f((future, _) ⇒ future should be('completed)) } + "contain a value" in { f((future, result) ⇒ future.value should be(Some(Success(result)))) } + "return result with 'get'" in { f((future, result) ⇒ Await.result(future, timeout.duration) should be(result)) } + "return result with 'Await.result'" in { f((future, result) ⇒ Await.result(future, timeout.duration) should be(result)) } "not timeout" in { f((future, _) ⇒ FutureSpec.ready(future, 0 millis)) } "filter result" in { f { (future, result) ⇒ - Await.result((future filter (_ ⇒ true)), timeout.duration) must be(result) - evaluating { Await.result((future filter (_ ⇒ false)), timeout.duration) } must produce[java.util.NoSuchElementException] + Await.result((future filter (_ ⇒ true)), timeout.duration) should be(result) + evaluating { Await.result((future filter (_ ⇒ false)), timeout.duration) } should produce[java.util.NoSuchElementException] } } - "transform result with map" in { f((future, result) ⇒ Await.result((future map (_.toString.length)), timeout.duration) must be(result.toString.length)) } + "transform result with map" in { f((future, result) ⇒ Await.result((future map (_.toString.length)), timeout.duration) should be(result.toString.length)) } "compose result with flatMap" in { f { (future, result) ⇒ val r = for (r ← future; p ← Promise.successful("foo").future) yield r.toString + p - Await.result(r, timeout.duration) must be(result.toString + "foo") + Await.result(r, timeout.duration) should be(result.toString + "foo") } } "perform action with foreach" in { f { (future, result) ⇒ val p = Promise[Any]() future foreach p.success - Await.result(p.future, timeout.duration) must be(result) + Await.result(p.future, timeout.duration) should be(result) } } "zip properly" in { f { (future, result) ⇒ - Await.result(future zip Promise.successful("foo").future, timeout.duration) must be((result, "foo")) - (evaluating { Await.result(future zip Promise.failed(new RuntimeException("ohnoes")).future, timeout.duration) } must produce[RuntimeException]).getMessage must be("ohnoes") + Await.result(future zip Promise.successful("foo").future, timeout.duration) should be((result, "foo")) + (evaluating { Await.result(future zip Promise.failed(new RuntimeException("ohnoes")).future, timeout.duration) } should produce[RuntimeException]).getMessage should be("ohnoes") } } - "not recover from exception" in { f((future, result) ⇒ Await.result(future.recover({ case _ ⇒ "pigdog" }), timeout.duration) must be(result)) } + "not recover from exception" in { f((future, result) ⇒ Await.result(future.recover({ case _ ⇒ "pigdog" }), timeout.duration) should be(result)) } "perform action on result" in { f { (future, result) ⇒ val p = Promise[Any]() future.onSuccess { case x ⇒ p.success(x) } - Await.result(p.future, timeout.duration) must be(result) + Await.result(p.future, timeout.duration) should be(result) } } - "not project a failure" in { f((future, result) ⇒ (evaluating { Await.result(future.failed, timeout.duration) } must produce[NoSuchElementException]).getMessage must be("Future.failed not completed with a throwable.")) } + "not project a failure" in { f((future, result) ⇒ (evaluating { Await.result(future.failed, timeout.duration) } should produce[NoSuchElementException]).getMessage should be("Future.failed not completed with a throwable.")) } "not perform action on exception" is pending - "cast using mapTo" in { f((future, result) ⇒ Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException ⇒ false }), timeout.duration) must be(false)) } + "cast using mapTo" in { f((future, result) ⇒ Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException ⇒ false }), timeout.duration) should be(false)) } } def futureWithException[E <: Throwable: ClassTag](f: ((Future[Any], String) ⇒ Unit) ⇒ Unit) { - "be completed" in { f((future, _) ⇒ future must be('completed)) } + "be completed" in { f((future, _) ⇒ future should be('completed)) } "contain a value" in { f((future, message) ⇒ { - future.value must be('defined) - future.value.get must be('failure) + future.value should be('defined) + future.value.get should be('failure) val Failure(f) = future.value.get - f.getMessage must be(message) + f.getMessage should be(message) }) } - "throw exception with 'get'" in { f((future, message) ⇒ (evaluating { Await.result(future, timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message)) } - "throw exception with 'Await.result'" in { f((future, message) ⇒ (evaluating { Await.result(future, timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message)) } + "throw exception with 'get'" in { f((future, message) ⇒ (evaluating { Await.result(future, timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message)) } + "throw exception with 'Await.result'" in { f((future, message) ⇒ (evaluating { Await.result(future, timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message)) } "retain exception with filter" in { f { (future, message) ⇒ - (evaluating { Await.result(future filter (_ ⇒ true), timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message) - (evaluating { Await.result(future filter (_ ⇒ false), timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message) + (evaluating { Await.result(future filter (_ ⇒ true), timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message) + (evaluating { Await.result(future filter (_ ⇒ false), timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message) } } - "retain exception with map" in { f((future, message) ⇒ (evaluating { Await.result(future map (_.toString.length), timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message)) } - "retain exception with flatMap" in { f((future, message) ⇒ (evaluating { Await.result(future flatMap (_ ⇒ Promise.successful[Any]("foo").future), timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message)) } + "retain exception with map" in { f((future, message) ⇒ (evaluating { Await.result(future map (_.toString.length), timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message)) } + "retain exception with flatMap" in { f((future, message) ⇒ (evaluating { Await.result(future flatMap (_ ⇒ Promise.successful[Any]("foo").future), timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message)) } "not perform action with foreach" is pending "zip properly" in { - f { (future, message) ⇒ (evaluating { Await.result(future zip Promise.successful("foo").future, timeout.duration) } must produce[java.lang.Exception]).getMessage must be(message) } + f { (future, message) ⇒ (evaluating { Await.result(future zip Promise.successful("foo").future, timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message) } } - "recover from exception" in { f((future, message) ⇒ Await.result(future.recover({ case e if e.getMessage == message ⇒ "pigdog" }), timeout.duration) must be("pigdog")) } + "recover from exception" in { f((future, message) ⇒ Await.result(future.recover({ case e if e.getMessage == message ⇒ "pigdog" }), timeout.duration) should be("pigdog")) } "not perform action on result" is pending - "project a failure" in { f((future, message) ⇒ Await.result(future.failed, timeout.duration).getMessage must be(message)) } + "project a failure" in { f((future, message) ⇒ Await.result(future.failed, timeout.duration).getMessage should be(message)) } "perform action on exception" in { f { (future, message) ⇒ val p = Promise[Any]() future.onFailure { case _ ⇒ p.success(message) } - Await.result(p.future, timeout.duration) must be(message) + Await.result(p.future, timeout.duration) should be(message) } } - "always cast successfully using mapTo" in { f((future, message) ⇒ (evaluating { Await.result(future.mapTo[java.lang.Thread], timeout.duration) } must produce[java.lang.Exception]).getMessage must be(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 be(message)) } } sealed trait IntAction { def apply(that: Int): Int } diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/MailboxConfigSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/MailboxConfigSpec.scala index 99c7a0a4fb..b3ce7142b4 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/MailboxConfigSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/MailboxConfigSpec.scala @@ -34,11 +34,11 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn ensureInitialMailboxState(config, q) } - "UnboundedMailbox.numberOfMessages must be consistent with queue size" in { + "UnboundedMailbox.numberOfMessages should be consistent with queue size" in { ensureSingleConsumerEnqueueDequeue(UnboundedMailbox()) } - "BoundedMailbox.numberOfMessages must be consistent with queue size" in { + "BoundedMailbox.numberOfMessages should be consistent with queue size" in { ensureSingleConsumerEnqueueDequeue(BoundedMailbox(1000, 10 milliseconds)) } @@ -49,17 +49,17 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn for (i ← 1 to config.capacity) q.enqueue(testActor, exampleMessage) - q.numberOfMessages must be === config.capacity - q.hasMessages must be === true + q.numberOfMessages should equal(config.capacity) + q.hasMessages should equal(true) system.eventStream.subscribe(testActor, classOf[DeadLetter]) q.enqueue(testActor, exampleMessage) expectMsg(DeadLetter(exampleMessage.message, system.deadLetters, testActor)) system.eventStream.unsubscribe(testActor, classOf[DeadLetter]) - q.dequeue must be === exampleMessage - q.numberOfMessages must be(config.capacity - 1) - q.hasMessages must be === true + q.dequeue should equal(exampleMessage) + q.numberOfMessages should be(config.capacity - 1) + q.hasMessages should equal(true) } "dequeue what was enqueued properly for unbounded mailboxes" in { @@ -86,16 +86,16 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn def ensureMailboxSize(q: MessageQueue, expected: Int): Unit = q.numberOfMessages match { case -1 | `expected` ⇒ - q.hasMessages must be === (expected != 0) + q.hasMessages should equal(expected != 0) case other ⇒ - other must be === expected - q.hasMessages must be === (expected != 0) + other should equal(expected) + q.hasMessages should equal(expected != 0) } def ensureSingleConsumerEnqueueDequeue(config: MailboxType) { val q = factory(config) ensureMailboxSize(q, 0) - q.dequeue must be === null + q.dequeue should equal(null) for (i ← 1 to 100) { q.enqueue(testActor, exampleMessage) ensureMailboxSize(q, i) @@ -104,26 +104,26 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn ensureMailboxSize(q, 100) for (i ← 99 to 0 by -1) { - q.dequeue() must be === exampleMessage + q.dequeue() should equal(exampleMessage) ensureMailboxSize(q, i) } - q.dequeue must be === null + q.dequeue should equal(null) ensureMailboxSize(q, 0) } def ensureInitialMailboxState(config: MailboxType, q: MessageQueue) { - q must not be null + q should not be null q match { case aQueue: BlockingQueue[_] ⇒ config match { - case BoundedMailbox(capacity, _) ⇒ aQueue.remainingCapacity must be === capacity - case UnboundedMailbox() ⇒ aQueue.remainingCapacity must be === Int.MaxValue + case BoundedMailbox(capacity, _) ⇒ aQueue.remainingCapacity should equal(capacity) + case UnboundedMailbox() ⇒ aQueue.remainingCapacity should equal(Int.MaxValue) } case _ ⇒ } - q.numberOfMessages must be === 0 - q.hasMessages must be === false + q.numberOfMessages should equal(0) + q.hasMessages should equal(false) } def testEnqueueDequeue(config: MailboxType, @@ -166,14 +166,14 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn val ps = producers.map(Await.result(_, remaining)) val cs = consumers.map(Await.result(_, remaining)) - ps.map(_.size).sum must be === enqueueN //Must have produced 1000 messages - cs.map(_.size).sum must be === dequeueN //Must have consumed all produced messages + ps.map(_.size).sum should equal(enqueueN) //Must have produced 1000 messages + cs.map(_.size).sum should equal(dequeueN) //Must have consumed all produced messages //No message is allowed to be consumed by more than one consumer - cs.flatten.distinct.size must be === dequeueN - //All consumed messages must have been produced - (cs.flatten diff ps.flatten).size must be === 0 + cs.flatten.distinct.size should equal(dequeueN) + //All consumed messages should have been produced + (cs.flatten diff ps.flatten).size should equal(0) //The ones that were produced and not consumed - (ps.flatten diff cs.flatten).size must be === (enqueueN - dequeueN) + (ps.flatten diff cs.flatten).size should equal(enqueueN - dequeueN) } } } @@ -224,7 +224,7 @@ class CustomMailboxSpec extends AkkaSpec(CustomMailboxSpec.config) { case _ ⇒ true }, 1 second, 10 millis) val queue = actor.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox.messageQueue - queue.getClass must be(classOf[CustomMailboxSpec.MyMailbox]) + queue.getClass should be(classOf[CustomMailboxSpec.MyMailbox]) } } } diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala index 4e76c5bea6..298f0719d4 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala @@ -74,7 +74,7 @@ class PriorityDispatcherSpec extends AkkaSpec(PriorityDispatcherSpec.config) wit })) - expectMsgType[List[_]] must be === msgs + expectMsgType[List[_]] should equal(msgs) } } diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/sysmsg/SystemMessageListSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/sysmsg/SystemMessageListSpec.scala index 101b1fe35c..65e9bc9aee 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/sysmsg/SystemMessageListSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/sysmsg/SystemMessageListSpec.scala @@ -12,22 +12,22 @@ class SystemMessageListSpec extends AkkaSpec { "The SystemMessageList value class" must { "handle empty lists correctly" in { - LNil.head must be === null - LNil.isEmpty must be(true) - (LNil.reverse == ENil) must be(true) + LNil.head should equal(null) + LNil.isEmpty should be(true) + (LNil.reverse == ENil) should be(true) } "able to append messages" in { val create0 = Failed(null, null, 0) val create1 = Failed(null, null, 1) val create2 = Failed(null, null, 2) - ((create0 :: LNil).head eq create0) must be(true) - ((create1 :: create0 :: LNil).head eq create1) must be(true) - ((create2 :: create1 :: create0 :: LNil).head eq create2) must be(true) + ((create0 :: LNil).head eq create0) should be(true) + ((create1 :: create0 :: LNil).head eq create1) should be(true) + ((create2 :: create1 :: create0 :: LNil).head eq create2) should be(true) - (create2.next eq create1) must be(true) - (create1.next eq create0) must be(true) - (create0.next eq null) must be(true) + (create2.next eq create1) should be(true) + (create1.next eq create0) should be(true) + (create0.next eq null) should be(true) } "able to deconstruct head and tail" in { @@ -36,10 +36,10 @@ class SystemMessageListSpec extends AkkaSpec { val create2 = Failed(null, null, 2) val list = create2 :: create1 :: create0 :: LNil - (list.head eq create2) must be(true) - (list.tail.head eq create1) must be(true) - (list.tail.tail.head eq create0) must be(true) - (list.tail.tail.tail.head eq null) must be(true) + (list.head eq create2) should be(true) + (list.tail.head eq create1) should be(true) + (list.tail.tail.head eq create0) should be(true) + (list.tail.tail.tail.head eq null) should be(true) } "properly report size and emptyness" in { @@ -48,17 +48,17 @@ class SystemMessageListSpec extends AkkaSpec { val create2 = Failed(null, null, 2) val list = create2 :: create1 :: create0 :: LNil - list.size must be === 3 - list.isEmpty must be(false) + list.size should equal(3) + list.isEmpty should be(false) - list.tail.size must be === 2 - list.tail.isEmpty must be(false) + list.tail.size should equal(2) + list.tail.isEmpty should be(false) - list.tail.tail.size must be === 1 - list.tail.tail.isEmpty must be(false) + list.tail.tail.size should equal(1) + list.tail.tail.isEmpty should be(false) - list.tail.tail.tail.size must be === 0 - list.tail.tail.tail.isEmpty must be(true) + list.tail.tail.tail.size should equal(0) + list.tail.tail.tail.isEmpty should be(true) } @@ -69,17 +69,17 @@ class SystemMessageListSpec extends AkkaSpec { val list = create2 :: create1 :: create0 :: LNil val listRev: EarliestFirstSystemMessageList = list.reverse - listRev.isEmpty must be(false) - listRev.size must be === 3 + listRev.isEmpty should be(false) + listRev.size should equal(3) - (listRev.head eq create0) must be(true) - (listRev.tail.head eq create1) must be(true) - (listRev.tail.tail.head eq create2) must be(true) - (listRev.tail.tail.tail.head eq null) must be(true) + (listRev.head eq create0) should be(true) + (listRev.tail.head eq create1) should be(true) + (listRev.tail.tail.head eq create2) should be(true) + (listRev.tail.tail.tail.head eq null) should be(true) - (create0.next eq create1) must be(true) - (create1.next eq create2) must be(true) - (create2.next eq null) must be(true) + (create0.next eq create1) should be(true) + (create1.next eq create2) should be(true) + (create2.next eq null) should be(true) } } @@ -99,17 +99,17 @@ class SystemMessageListSpec extends AkkaSpec { val list = revList reverse_::: fwdList - (list.head eq create0) must be(true) - (list.tail.head eq create1) must be(true) - (list.tail.tail.head eq create2) must be(true) - (list.tail.tail.tail.head eq create3) must be(true) - (list.tail.tail.tail.tail.head eq create4) must be(true) - (list.tail.tail.tail.tail.tail.head eq create5) must be(true) - (list.tail.tail.tail.tail.tail.tail.head eq null) must be(true) + (list.head eq create0) should be(true) + (list.tail.head eq create1) should be(true) + (list.tail.tail.head eq create2) should be(true) + (list.tail.tail.tail.head eq create3) should be(true) + (list.tail.tail.tail.tail.head eq create4) should be(true) + (list.tail.tail.tail.tail.tail.head eq create5) should be(true) + (list.tail.tail.tail.tail.tail.tail.head eq null) should be(true) - (LNil reverse_::: ENil) == ENil must be(true) - ((create0 :: LNil reverse_::: ENil).head eq create0) must be(true) - ((LNil reverse_::: create0 :: ENil).head eq create0) must be(true) + (LNil reverse_::: ENil) == ENil should be(true) + ((create0 :: LNil reverse_::: ENil).head eq create0) should be(true) + ((LNil reverse_::: create0 :: ENil).head eq create0) should be(true) } } diff --git a/akka-actor-tests/src/test/scala/akka/event/EventBusSpec.scala b/akka-actor-tests/src/test/scala/akka/event/EventBusSpec.scala index d93fdbb4f6..823af7dcbd 100644 --- a/akka-actor-tests/src/test/scala/akka/event/EventBusSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/event/EventBusSpec.scala @@ -50,37 +50,37 @@ abstract class EventBusSpec(busName: String) extends AkkaSpec with BeforeAndAfte val subscriber = createNewSubscriber() "allow subscribers" in { - bus.subscribe(subscriber, classifier) must be === true + bus.subscribe(subscriber, classifier) should equal(true) } "allow to unsubscribe already existing subscriber" in { - bus.unsubscribe(subscriber, classifier) must be === true + bus.unsubscribe(subscriber, classifier) should equal(true) } "not allow to unsubscribe non-existing subscriber" in { val sub = createNewSubscriber() - bus.unsubscribe(sub, classifier) must be === false + bus.unsubscribe(sub, classifier) should equal(false) disposeSubscriber(system, sub) } "not allow for the same subscriber to subscribe to the same channel twice" in { - bus.subscribe(subscriber, classifier) must be === true - bus.subscribe(subscriber, classifier) must be === false - bus.unsubscribe(subscriber, classifier) must be === true + bus.subscribe(subscriber, classifier) should equal(true) + bus.subscribe(subscriber, classifier) should equal(false) + bus.unsubscribe(subscriber, classifier) should equal(true) } "not allow for the same subscriber to unsubscribe to the same channel twice" in { - bus.subscribe(subscriber, classifier) must be === true - bus.unsubscribe(subscriber, classifier) must be === true - bus.unsubscribe(subscriber, classifier) must be === false + bus.subscribe(subscriber, classifier) should equal(true) + bus.unsubscribe(subscriber, classifier) should equal(true) + bus.unsubscribe(subscriber, classifier) should equal(false) } "allow to add multiple subscribers" in { val subscribers = (1 to 10) map { _ ⇒ createNewSubscriber() } val events = createEvents(10) val classifiers = events map getClassifierFor - subscribers.zip(classifiers) forall { case (s, c) ⇒ bus.subscribe(s, c) } must be === true - subscribers.zip(classifiers) forall { case (s, c) ⇒ bus.unsubscribe(s, c) } must be === true + subscribers.zip(classifiers) forall { case (s, c) ⇒ bus.subscribe(s, c) } should equal(true) + subscribers.zip(classifiers) forall { case (s, c) ⇒ bus.unsubscribe(s, c) } should equal(true) subscribers foreach (disposeSubscriber(system, _)) } @@ -112,10 +112,10 @@ abstract class EventBusSpec(busName: String) extends AkkaSpec with BeforeAndAfte "publish the given event to all intended subscribers" in { val range = 0 until 10 val subscribers = range map (_ ⇒ createNewSubscriber()) - subscribers foreach { s ⇒ bus.subscribe(s, classifier) must be === true } + subscribers foreach { s ⇒ bus.subscribe(s, classifier) should equal(true) } bus.publish(event) range foreach { _ ⇒ expectMsg(event) } - subscribers foreach { s ⇒ bus.unsubscribe(s, classifier) must be === true; disposeSubscriber(system, s) } + subscribers foreach { s ⇒ bus.unsubscribe(s, classifier) should equal(true); disposeSubscriber(system, s) } } "not publish the given event to any other subscribers than the intended ones" in { diff --git a/akka-actor-tests/src/test/scala/akka/event/EventStreamSpec.scala b/akka-actor-tests/src/test/scala/akka/event/EventStreamSpec.scala index e0257b89d2..37027239fb 100644 --- a/akka-actor-tests/src/test/scala/akka/event/EventStreamSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/event/EventStreamSpec.scala @@ -88,13 +88,13 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { "not allow null as subscriber" in { val bus = new EventStream(true) - intercept[IllegalArgumentException] { bus.subscribe(null, classOf[M]) }.getMessage must be("subscriber is null") + intercept[IllegalArgumentException] { bus.subscribe(null, classOf[M]) }.getMessage should be("subscriber is null") } "not allow null as unsubscriber" in { val bus = new EventStream(true) - intercept[IllegalArgumentException] { bus.unsubscribe(null, classOf[M]) }.getMessage must be("subscriber is null") - intercept[IllegalArgumentException] { bus.unsubscribe(null) }.getMessage must be("subscriber is null") + intercept[IllegalArgumentException] { bus.unsubscribe(null, classOf[M]) }.getMessage should be("subscriber is null") + intercept[IllegalArgumentException] { bus.unsubscribe(null) }.getMessage should be("subscriber is null") } "be able to log unhandled messages" in { @@ -134,16 +134,16 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val c = new C val bus = new EventStream(false) within(2 seconds) { - bus.subscribe(testActor, classOf[B2]) must be === true + bus.subscribe(testActor, classOf[B2]) should equal(true) bus.publish(c) bus.publish(b2) expectMsg(b2) - bus.subscribe(testActor, classOf[A]) must be === true + bus.subscribe(testActor, classOf[A]) should equal(true) bus.publish(c) expectMsg(c) bus.publish(b1) expectMsg(b1) - bus.unsubscribe(testActor, classOf[B1]) must be === true + bus.unsubscribe(testActor, classOf[B1]) should equal(true) bus.publish(c) bus.publish(b2) bus.publish(a) @@ -159,21 +159,21 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val tm2 = new CCATBT val a1, a2, a3, a4 = TestProbe() - es.subscribe(a1.ref, classOf[AT]) must be === true - es.subscribe(a2.ref, classOf[BT]) must be === true - es.subscribe(a3.ref, classOf[CC]) must be === true - es.subscribe(a4.ref, classOf[CCATBT]) must be === true + es.subscribe(a1.ref, classOf[AT]) should equal(true) + es.subscribe(a2.ref, classOf[BT]) should equal(true) + es.subscribe(a3.ref, classOf[CC]) should equal(true) + es.subscribe(a4.ref, classOf[CCATBT]) should equal(true) es.publish(tm1) es.publish(tm2) - a1.expectMsgType[AT] must be === tm2 - a2.expectMsgType[BT] must be === tm2 - a3.expectMsgType[CC] must be === tm1 - a3.expectMsgType[CC] must be === tm2 - a4.expectMsgType[CCATBT] must be === tm2 - es.unsubscribe(a1.ref, classOf[AT]) must be === true - es.unsubscribe(a2.ref, classOf[BT]) must be === true - es.unsubscribe(a3.ref, classOf[CC]) must be === true - es.unsubscribe(a4.ref, classOf[CCATBT]) must be === true + a1.expectMsgType[AT] should equal(tm2) + a2.expectMsgType[BT] should equal(tm2) + a3.expectMsgType[CC] should equal(tm1) + a3.expectMsgType[CC] should equal(tm2) + a4.expectMsgType[CCATBT] should equal(tm2) + es.unsubscribe(a1.ref, classOf[AT]) should equal(true) + es.unsubscribe(a2.ref, classOf[BT]) should equal(true) + es.unsubscribe(a3.ref, classOf[CC]) should equal(true) + es.unsubscribe(a4.ref, classOf[CCATBT]) should equal(true) } "manage sub-channels using classes and traits (update on unsubscribe)" in { @@ -182,20 +182,20 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val tm2 = new CCATBT val a1, a2, a3, a4 = TestProbe() - es.subscribe(a1.ref, classOf[AT]) must be === true - es.subscribe(a2.ref, classOf[BT]) must be === true - es.subscribe(a3.ref, classOf[CC]) must be === true - es.subscribe(a4.ref, classOf[CCATBT]) must be === true - es.unsubscribe(a3.ref, classOf[CC]) must be === true + es.subscribe(a1.ref, classOf[AT]) should equal(true) + es.subscribe(a2.ref, classOf[BT]) should equal(true) + es.subscribe(a3.ref, classOf[CC]) should equal(true) + es.subscribe(a4.ref, classOf[CCATBT]) should equal(true) + es.unsubscribe(a3.ref, classOf[CC]) should equal(true) es.publish(tm1) es.publish(tm2) - a1.expectMsgType[AT] must be === tm2 - a2.expectMsgType[BT] must be === tm2 + a1.expectMsgType[AT] should equal(tm2) + a2.expectMsgType[BT] should equal(tm2) a3.expectNoMsg(1 second) - a4.expectMsgType[CCATBT] must be === tm2 - es.unsubscribe(a1.ref, classOf[AT]) must be === true - es.unsubscribe(a2.ref, classOf[BT]) must be === true - es.unsubscribe(a4.ref, classOf[CCATBT]) must be === true + a4.expectMsgType[CCATBT] should equal(tm2) + es.unsubscribe(a1.ref, classOf[AT]) should equal(true) + es.unsubscribe(a2.ref, classOf[BT]) should equal(true) + es.unsubscribe(a4.ref, classOf[CCATBT]) should equal(true) } "manage sub-channels using classes and traits (update on unsubscribe all)" in { @@ -204,20 +204,20 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val tm2 = new CCATBT val a1, a2, a3, a4 = TestProbe() - es.subscribe(a1.ref, classOf[AT]) must be === true - es.subscribe(a2.ref, classOf[BT]) must be === true - es.subscribe(a3.ref, classOf[CC]) must be === true - es.subscribe(a4.ref, classOf[CCATBT]) must be === true + es.subscribe(a1.ref, classOf[AT]) should equal(true) + es.subscribe(a2.ref, classOf[BT]) should equal(true) + es.subscribe(a3.ref, classOf[CC]) should equal(true) + es.subscribe(a4.ref, classOf[CCATBT]) should equal(true) es.unsubscribe(a3.ref) es.publish(tm1) es.publish(tm2) - a1.expectMsgType[AT] must be === tm2 - a2.expectMsgType[BT] must be === tm2 + a1.expectMsgType[AT] should equal(tm2) + a2.expectMsgType[BT] should equal(tm2) a3.expectNoMsg(1 second) - a4.expectMsgType[CCATBT] must be === tm2 - es.unsubscribe(a1.ref, classOf[AT]) must be === true - es.unsubscribe(a2.ref, classOf[BT]) must be === true - es.unsubscribe(a4.ref, classOf[CCATBT]) must be === true + a4.expectMsgType[CCATBT] should equal(tm2) + es.unsubscribe(a1.ref, classOf[AT]) should equal(true) + es.unsubscribe(a2.ref, classOf[BT]) should equal(true) + es.unsubscribe(a4.ref, classOf[CCATBT]) should equal(true) } "manage sub-channels using classes and traits (update on publish)" in { @@ -226,14 +226,14 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val tm2 = new CCATBT val a1, a2 = TestProbe() - es.subscribe(a1.ref, classOf[AT]) must be === true - es.subscribe(a2.ref, classOf[BT]) must be === true + es.subscribe(a1.ref, classOf[AT]) should equal(true) + es.subscribe(a2.ref, classOf[BT]) should equal(true) es.publish(tm1) es.publish(tm2) - a1.expectMsgType[AT] must be === tm2 - a2.expectMsgType[BT] must be === tm2 - es.unsubscribe(a1.ref, classOf[AT]) must be === true - es.unsubscribe(a2.ref, classOf[BT]) must be === true + a1.expectMsgType[AT] should equal(tm2) + a2.expectMsgType[BT] should equal(tm2) + es.unsubscribe(a1.ref, classOf[AT]) should equal(true) + es.unsubscribe(a2.ref, classOf[BT]) should equal(true) } "manage sub-channels using classes and traits (unsubscribe classes used with trait)" in { @@ -242,20 +242,20 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val tm2 = new CCATBT val a1, a2, a3 = TestProbe() - es.subscribe(a1.ref, classOf[AT]) must be === true - es.subscribe(a2.ref, classOf[BT]) must be === true - es.subscribe(a2.ref, classOf[CC]) must be === true - es.subscribe(a3.ref, classOf[CC]) must be === true - es.unsubscribe(a2.ref, classOf[CC]) must be === true - es.unsubscribe(a3.ref, classOf[CCATBT]) must be === true + es.subscribe(a1.ref, classOf[AT]) should equal(true) + es.subscribe(a2.ref, classOf[BT]) should equal(true) + es.subscribe(a2.ref, classOf[CC]) should equal(true) + es.subscribe(a3.ref, classOf[CC]) should equal(true) + es.unsubscribe(a2.ref, classOf[CC]) should equal(true) + es.unsubscribe(a3.ref, classOf[CCATBT]) should equal(true) es.publish(tm1) es.publish(tm2) - a1.expectMsgType[AT] must be === tm2 - a2.expectMsgType[BT] must be === tm2 - a3.expectMsgType[CC] must be === tm1 - es.unsubscribe(a1.ref, classOf[AT]) must be === true - es.unsubscribe(a2.ref, classOf[BT]) must be === true - es.unsubscribe(a3.ref, classOf[CC]) must be === true + a1.expectMsgType[AT] should equal(tm2) + a2.expectMsgType[BT] should equal(tm2) + a3.expectMsgType[CC] should equal(tm1) + es.unsubscribe(a1.ref, classOf[AT]) should equal(true) + es.unsubscribe(a2.ref, classOf[BT]) should equal(true) + es.unsubscribe(a3.ref, classOf[CC]) should equal(true) } "manage sub-channels using classes and traits (subscribe after publish)" in { @@ -263,16 +263,16 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) { val tm1 = new CCATBT val a1, a2 = TestProbe() - es.subscribe(a1.ref, classOf[AT]) must be === true + es.subscribe(a1.ref, classOf[AT]) should equal(true) es.publish(tm1) - a1.expectMsgType[AT] must be === tm1 + a1.expectMsgType[AT] should equal(tm1) a2.expectNoMsg(1 second) - es.subscribe(a2.ref, classOf[BTT]) must be === true + es.subscribe(a2.ref, classOf[BTT]) should equal(true) es.publish(tm1) - a1.expectMsgType[AT] must be === tm1 - a2.expectMsgType[BTT] must be === tm1 - es.unsubscribe(a1.ref, classOf[AT]) must be === true - es.unsubscribe(a2.ref, classOf[BTT]) must be === true + a1.expectMsgType[AT] should equal(tm1) + a2.expectMsgType[BTT] should equal(tm1) + es.unsubscribe(a1.ref, classOf[AT]) should equal(true) + es.unsubscribe(a2.ref, classOf[BTT]) should equal(true) } } diff --git a/akka-actor-tests/src/test/scala/akka/event/LoggerSpec.scala b/akka-actor-tests/src/test/scala/akka/event/LoggerSpec.scala index d14ae89e43..1b6229535b 100644 --- a/akka-actor-tests/src/test/scala/akka/event/LoggerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/event/LoggerSpec.scala @@ -9,7 +9,7 @@ import com.typesafe.config.{ Config, ConfigFactory } import akka.actor._ import java.util.{ Date, GregorianCalendar, TimeZone, Calendar } import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.serialization.SerializationExtension import akka.event.Logging._ import akka.util.Helpers @@ -112,7 +112,7 @@ object LoggerSpec { } @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class LoggerSpec extends WordSpec with MustMatchers { +class LoggerSpec extends WordSpec with Matchers { import LoggerSpec._ @@ -145,7 +145,7 @@ class LoggerSpec extends WordSpec with MustMatchers { "log messages to standard output" in { val out = createSystemAndLogToBuffer("defaultLogger", defaultConfig, true) - out.size must be > (0) + out.size should be > (0) } } @@ -153,7 +153,7 @@ class LoggerSpec extends WordSpec with MustMatchers { "not log messages to standard output" in { val out = createSystemAndLogToBuffer("noLogging", noLoggingConfig, false) - out.size must be(0) + out.size should be(0) } } @@ -230,7 +230,7 @@ class LoggerSpec extends WordSpec with MustMatchers { val minutes = c.get(Calendar.MINUTE) val seconds = c.get(Calendar.SECOND) val ms = c.get(Calendar.MILLISECOND) - Helpers.currentTimeMillisToUTCString(timestamp) must be(f"$hours%02d:$minutes%02d:$seconds%02d.$ms%03dUTC") + Helpers.currentTimeMillisToUTCString(timestamp) should be(f"$hours%02d:$minutes%02d:$seconds%02d.$ms%03dUTC") } } diff --git a/akka-actor-tests/src/test/scala/akka/io/BackpressureSpec.scala b/akka-actor-tests/src/test/scala/akka/io/BackpressureSpec.scala index e9312a9939..8cca6860d6 100644 --- a/akka-actor-tests/src/test/scala/akka/io/BackpressureSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/BackpressureSpec.scala @@ -198,9 +198,9 @@ class BackpressureSpec extends AkkaSpec("akka.actor.serialize-creators=on") with send ! StartSending(N) val hash = expectMsgType[Done].hash implicit val t = Timeout(100.millis) - awaitAssert(Await.result(recv ? GetProgress, t.duration) must be === Progress(N)) + awaitAssert(Await.result(recv ? GetProgress, t.duration) should equal(Progress(N))) recv ! GetHash - expectMsgType[Hash].hash must be === hash + expectMsgType[Hash].hash should equal(hash) } } catch { case NonFatal(e) ⇒ @@ -215,7 +215,7 @@ class BackpressureSpec extends AkkaSpec("akka.actor.serialize-creators=on") with val terminated = receiveWhile(1.second, messages = 2) { case Terminated(t) ⇒ t } - terminated.toSet must be === Set(send, recv) + terminated.toSet should equal(Set(send, recv)) } "transmit the right bytes with hiccups" in { @@ -229,9 +229,9 @@ class BackpressureSpec extends AkkaSpec("akka.actor.serialize-creators=on") with send ! StartSending(N) val hash = expectMsgType[Done].hash implicit val t = Timeout(100.millis) - awaitAssert(Await.result(recv ? GetProgress, t.duration) must be === Progress(N)) + awaitAssert(Await.result(recv ? GetProgress, t.duration) should equal(Progress(N))) recv ! GetHash - expectMsgType[Hash].hash must be === hash + expectMsgType[Hash].hash should equal(hash) } } catch { case NonFatal(e) ⇒ @@ -246,7 +246,7 @@ class BackpressureSpec extends AkkaSpec("akka.actor.serialize-creators=on") with val terminated = receiveWhile(1.second, messages = 2) { case Terminated(t) ⇒ t } - terminated.toSet must be === Set(send, recv) + terminated.toSet should equal(Set(send, recv)) } } diff --git a/akka-actor-tests/src/test/scala/akka/io/CapacityLimitSpec.scala b/akka-actor-tests/src/test/scala/akka/io/CapacityLimitSpec.scala index 04fb2f5d78..9722f73ef7 100644 --- a/akka-actor-tests/src/test/scala/akka/io/CapacityLimitSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/CapacityLimitSpec.scala @@ -31,11 +31,11 @@ class CapacityLimitSpec extends AkkaSpec(""" val bindToFail = Bind(bindHandler.ref, addresses(1)) commander.send(IO(Tcp), bindToFail) - commander.expectMsgType[CommandFailed].cmd must be theSameInstanceAs (bindToFail) + commander.expectMsgType[CommandFailed].cmd should be theSameInstanceAs (bindToFail) val connectToFail = Connect(endpoint) commander.send(IO(Tcp), connectToFail) - commander.expectMsgType[CommandFailed].cmd must be theSameInstanceAs (connectToFail) + commander.expectMsgType[CommandFailed].cmd should be theSameInstanceAs (connectToFail) } } diff --git a/akka-actor-tests/src/test/scala/akka/io/PipelineSpec.scala b/akka-actor-tests/src/test/scala/akka/io/PipelineSpec.scala index eee29ceaab..cddf6b4171 100644 --- a/akka-actor-tests/src/test/scala/akka/io/PipelineSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/PipelineSpec.scala @@ -49,20 +49,20 @@ class PipelineSpec extends AkkaSpec("akka.actor.serialize-creators = on") { "be correctly evaluated if single stage" in { val PipelinePorts(cmd, evt, _) = PipelineFactory.buildFunctionTriple(ctx, stage[Level2, Level1](1, 0, false)) - cmd(Level2.msgA) must be(Nil -> Seq(Level1.msgA)) - evt(Level1.msgA) must be(Seq(Level2.msgA) -> Nil) - cmd(Level2.msgB) must be(Nil -> Seq(Level1.msgB)) - evt(Level1.msgB) must be(Seq(Level2.msgB) -> Nil) + cmd(Level2.msgA) should be(Nil -> Seq(Level1.msgA)) + evt(Level1.msgA) should be(Seq(Level2.msgA) -> Nil) + cmd(Level2.msgB) should be(Nil -> Seq(Level1.msgB)) + evt(Level1.msgB) should be(Seq(Level2.msgB) -> Nil) } "be correctly evaluated when two combined" in { val stage1 = stage[Level3, Level2](1, 0, false) val stage2 = stage[Level2, Level1](1, 0, false) val PipelinePorts(cmd, evt, _) = PipelineFactory.buildFunctionTriple(ctx, stage1 >> stage2) - cmd(Level3.msgA) must be(Nil -> Seq(Level1.msgA)) - evt(Level1.msgA) must be(Seq(Level3.msgA) -> Nil) - cmd(Level3.msgB) must be(Nil -> Seq(Level1.msgB)) - evt(Level1.msgB) must be(Seq(Level3.msgB) -> Nil) + cmd(Level3.msgA) should be(Nil -> Seq(Level1.msgA)) + evt(Level1.msgA) should be(Seq(Level3.msgA) -> Nil) + cmd(Level3.msgB) should be(Nil -> Seq(Level1.msgB)) + evt(Level1.msgB) should be(Seq(Level3.msgB) -> Nil) } "be correctly evaluated when three combined" in { @@ -70,10 +70,10 @@ class PipelineSpec extends AkkaSpec("akka.actor.serialize-creators = on") { val stage2 = stage[Level3, Level2](2, 0, false) val stage3 = stage[Level2, Level1](1, 0, false) val PipelinePorts(cmd, evt, _) = PipelineFactory.buildFunctionTriple(ctx, stage1 >> stage2 >> stage3) - cmd(Level4.msgA) must be(Nil -> Seq(Level1.msgA, Level1.msgA)) - evt(Level1.msgA) must be(Seq(Level4.msgA, Level4.msgA) -> Nil) - cmd(Level4.msgB) must be(Nil -> Seq(Level1.msgB, Level1.msgB)) - evt(Level1.msgB) must be(Seq(Level4.msgB, Level4.msgB) -> Nil) + cmd(Level4.msgA) should be(Nil -> Seq(Level1.msgA, Level1.msgA)) + evt(Level1.msgA) should be(Seq(Level4.msgA, Level4.msgA) -> Nil) + cmd(Level4.msgB) should be(Nil -> Seq(Level1.msgB, Level1.msgB)) + evt(Level1.msgB) should be(Seq(Level4.msgB, Level4.msgB) -> Nil) } "be correctly evaluated with back-scatter" in { @@ -81,8 +81,8 @@ class PipelineSpec extends AkkaSpec("akka.actor.serialize-creators = on") { val stage2 = stage[Level3, Level2](1, 1, true) val stage3 = stage[Level2, Level1](1, 0, false) val PipelinePorts(cmd, evt, _) = PipelineFactory.buildFunctionTriple(ctx, stage1 >> stage2 >> stage3) - cmd(Level4.msgA) must be(Seq(Level4.msgB) -> Seq(Level1.msgA)) - evt(Level1.msgA) must be(Seq(Level4.msgA) -> Seq(Level1.msgB)) + cmd(Level4.msgA) should be(Seq(Level4.msgB) -> Seq(Level1.msgA)) + evt(Level1.msgA) should be(Seq(Level4.msgA) -> Seq(Level1.msgB)) } "handle management commands" in { @@ -90,14 +90,14 @@ class PipelineSpec extends AkkaSpec("akka.actor.serialize-creators = on") { val stage2 = stage[Level3, Level2](2, 0, true, { case "doit" ⇒ Seq(Left(Level3.msgA), Right(Level2.msgA)) }) val stage3 = stage[Level2, Level1](1, 0, true, { case "doit" ⇒ Seq(Left(Level2.msgA), Right(Level1.msgA)) }) val PipelinePorts(cmd, evt, mgmt) = PipelineFactory.buildFunctionTriple(ctx, stage1 >> stage2 >> stage3) - mgmt(42: java.lang.Integer) must be(Seq() -> Seq()) + mgmt(42: java.lang.Integer) should be(Seq() -> Seq()) val (events, commands) = mgmt("doit") - events must have size 4 - events count (_ == Level4.msgA) must be === 3 - events count (_ == Level4.msgB) must be === 1 - commands must have size 4 - commands count (_ == Level1.msgA) must be === 3 - commands count (_ == Level1.msgB) must be === 1 + events should have size 4 + events count (_ == Level4.msgA) should equal(3) + events count (_ == Level4.msgB) should equal(1) + commands should have size 4 + commands count (_ == Level1.msgA) should equal(3) + commands count (_ == Level1.msgB) should equal(1) } } 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 2243367a81..c5e81c93d7 100644 --- a/akka-actor-tests/src/test/scala/akka/io/TcpConnectionSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/TcpConnectionSpec.scala @@ -81,7 +81,7 @@ class TcpConnectionSpec extends AkkaSpec(""" run { val connectionActor = createConnectionActor(options = Vector(Inet.SO.ReuseAddress(true))) val clientChannel = connectionActor.underlyingActor.channel - clientChannel.socket.getReuseAddress must be(true) + clientChannel.socket.getReuseAddress should be(true) } } @@ -90,10 +90,10 @@ class TcpConnectionSpec extends AkkaSpec(""" // Workaround for systems where SO_KEEPALIVE is true by default val connectionActor = createConnectionActor(options = Vector(SO.KeepAlive(false))) val clientChannel = connectionActor.underlyingActor.channel - clientChannel.socket.getKeepAlive must be(true) // only set after connection is established + clientChannel.socket.getKeepAlive should be(true) // only set after connection is established EventFilter.warning(pattern = "registration timeout", occurrences = 1) intercept { selector.send(connectionActor, ChannelConnectable) - clientChannel.socket.getKeepAlive must be(false) + clientChannel.socket.getKeepAlive should be(false) } } } @@ -123,14 +123,14 @@ class TcpConnectionSpec extends AkkaSpec(""" serverSideChannel.socket.setSendBufferSize(150000) val wrote = serverSideChannel.write(buffer) - wrote must be(DataSize) + wrote should be(DataSize) expectNoMsg(1000.millis) // data should have been transferred fully by now selector.send(connectionActor, ChannelReadable) - connectionHandler.expectMsgType[Received].data.length must be(bufferSize) - connectionHandler.expectMsgType[Received].data.length must be(1500) + connectionHandler.expectMsgType[Received].data.length should be(bufferSize) + connectionHandler.expectMsgType[Received].data.length should be(1500) } } @@ -146,7 +146,7 @@ class TcpConnectionSpec extends AkkaSpec(""" userHandler.expectMsg(Connected(serverAddress, clientSideChannel.socket.getLocalSocketAddress.asInstanceOf[InetSocketAddress])) userHandler.send(connectionActor, Register(userHandler.ref)) - userHandler.expectMsgType[Received].data.decodeString("ASCII") must be("immediatedata") + userHandler.expectMsgType[Received].data.decodeString("ASCII") should be("immediatedata") interestCallReceiver.expectMsg(OP_READ) } } @@ -158,22 +158,22 @@ class TcpConnectionSpec extends AkkaSpec(""" // reply to write commander with Ack val ackedWrite = Write(ByteString("testdata"), Ack) val buffer = ByteBuffer.allocate(100) - serverSideChannel.read(buffer) must be(0) + serverSideChannel.read(buffer) should be(0) writer.send(connectionActor, ackedWrite) writer.expectMsg(Ack) pullFromServerSide(remaining = 8, into = buffer) buffer.flip() - buffer.limit must be(8) + buffer.limit should be(8) // not reply to write commander for writes without Ack val unackedWrite = Write(ByteString("morestuff!")) buffer.clear() - serverSideChannel.read(buffer) must be(0) + serverSideChannel.read(buffer) should be(0) writer.send(connectionActor, unackedWrite) writer.expectNoMsg(500.millis) pullFromServerSide(remaining = 10, into = buffer) buffer.flip() - ByteString(buffer).utf8String must be("morestuff!") + ByteString(buffer).utf8String should be("morestuff!") } } @@ -189,13 +189,13 @@ class TcpConnectionSpec extends AkkaSpec(""" val write = Write(testData, Ack) val buffer = ByteBuffer.allocate(bufferSize) - serverSideChannel.read(buffer) must be(0) + serverSideChannel.read(buffer) should be(0) writer.send(connectionActor, write) pullFromServerSide(remaining = bufferSize, into = buffer) buffer.flip() - buffer.limit must be(bufferSize) + buffer.limit should be(bufferSize) - ByteString(buffer) must be(testData) + ByteString(buffer) should be(testData) } } @@ -258,12 +258,12 @@ class TcpConnectionSpec extends AkkaSpec(""" // reply to write commander with Ack val buffer = ByteBuffer.allocate(100) - serverSideChannel.read(buffer) must be(0) + serverSideChannel.read(buffer) should be(0) writer.send(connectionActor, compoundWrite) pullFromServerSide(remaining = 15, into = buffer) buffer.flip() - ByteString(buffer).utf8String must be("test1test2test4") + ByteString(buffer).utf8String should be("test1test2test4") writer.expectMsg(Ack(1)) writer.expectMsg(Ack(3)) writer.expectMsg(Ack(4)) @@ -375,10 +375,10 @@ class TcpConnectionSpec extends AkkaSpec(""" closeCommander.expectMsg(Closed) assertThisConnectionActorTerminated() - serverSelectionKey must be(selectedAs(OP_READ, 2.seconds)) + serverSelectionKey should be(selectedAs(OP_READ, 2.seconds)) val buffer = ByteBuffer.allocate(1) - serverSideChannel.read(buffer) must be(-1) + serverSideChannel.read(buffer) should be(-1) } } @@ -400,8 +400,8 @@ class TcpConnectionSpec extends AkkaSpec(""" assertThisConnectionActorTerminated() val buffer = ByteBuffer.allocate(1) - val thrown = evaluating { serverSideChannel.read(buffer) } must produce[IOException] - thrown.getMessage must be(ConnectionResetByPeerMessage) + val thrown = evaluating { serverSideChannel.read(buffer) } should produce[IOException] + thrown.getMessage should be(ConnectionResetByPeerMessage) } } @@ -436,8 +436,8 @@ class TcpConnectionSpec extends AkkaSpec(""" selector.send(connectionActor, ChannelReadable) val buffer = ByteBuffer.allocate(1) - serverSelectionKey must be(selectedAs(OP_READ, 2.seconds)) - serverSideChannel.read(buffer) must be(-1) + serverSelectionKey should be(selectedAs(OP_READ, 2.seconds)) + serverSideChannel.read(buffer) should be(-1) closeServerSideAndWaitForClientReadable() @@ -471,8 +471,8 @@ class TcpConnectionSpec extends AkkaSpec(""" connectionHandler.expectNoMsg(100.millis) // not yet val buffer = ByteBuffer.allocate(1) - serverSelectionKey must be(selectedAs(SelectionKey.OP_READ, 2.seconds)) - serverSideChannel.read(buffer) must be(-1) + serverSelectionKey should be(selectedAs(SelectionKey.OP_READ, 2.seconds)) + serverSideChannel.read(buffer) should be(-1) closeServerSideAndWaitForClientReadable() @@ -535,7 +535,7 @@ class TcpConnectionSpec extends AkkaSpec(""" abortClose(serverSideChannel) selector.send(connectionActor, ChannelReadable) val err = connectionHandler.expectMsgType[ErrorClosed] - err.cause must be(ConnectionResetByPeerMessage) + err.cause should be(ConnectionResetByPeerMessage) // wait a while connectionHandler.expectNoMsg(200.millis) @@ -570,7 +570,7 @@ class TcpConnectionSpec extends AkkaSpec(""" // This timeout should be large enough to work on Windows sel.select(3000) - key.isConnectable must be(true) + key.isConnectable should be(true) val forceThisLazyVal = connectionActor.toString Thread.sleep(300) selector.send(connectionActor, ChannelConnectable) @@ -595,7 +595,7 @@ class TcpConnectionSpec extends AkkaSpec(""" new UnacceptedConnectionTest() { override lazy val connectionActor = createConnectionActor(serverAddress = UnboundAddress, timeout = Option(100.millis)) run { - connectionActor.toString must not be ("") + connectionActor.toString should not be ("") userHandler.expectMsg(CommandFailed(Connect(UnboundAddress, timeout = Option(100.millis)))) verifyActorTermination(connectionActor) } @@ -629,7 +629,7 @@ class TcpConnectionSpec extends AkkaSpec(""" EventFilter[DeathPactException](occurrences = 1) intercept { system.stop(connectionHandler.ref) val deaths = Set(expectMsgType[Terminated].actor, expectMsgType[Terminated].actor) - deaths must be(Set(connectionHandler.ref, connectionActor)) + deaths should be(Set(connectionHandler.ref, connectionActor)) } } } @@ -649,7 +649,7 @@ class TcpConnectionSpec extends AkkaSpec(""" writer.receiveWhile(1.second) { case CommandFailed(write) ⇒ written -= 1 } - writer.msgAvailable must be(false) + writer.msgAvailable should be(false) // writes must fail now writer.send(connectionActor, write) @@ -723,7 +723,7 @@ class TcpConnectionSpec extends AkkaSpec(""" writer.receiveWhile(1.second) { case CommandFailed(write) ⇒ written -= 1 } - writer.msgAvailable must be(false) + writer.msgAvailable should be(false) // writes must fail now writer.send(connectionActor, write) @@ -830,14 +830,14 @@ class TcpConnectionSpec extends AkkaSpec(""" } abstract class UnacceptedConnectionTest extends LocalServerTest { - // lazy init since potential exceptions must not be triggered in the constructor but during execution of `run` + // lazy init since potential exceptions should not be triggered in the constructor but during execution of `run` private[io] lazy val connectionActor = createConnectionActor(serverAddress) // calling .underlyingActor ensures that the actor is actually created at this point lazy val clientSideChannel = connectionActor.underlyingActor.channel override def run(body: ⇒ Unit): Unit = super.run { registerCallReceiver.expectMsg(Registration(clientSideChannel, 0)) - registerCallReceiver.sender must be(connectionActor) + registerCallReceiver.sender should be(connectionActor) body } } @@ -845,7 +845,7 @@ class TcpConnectionSpec extends AkkaSpec(""" abstract class EstablishedConnectionTest(keepOpenOnPeerClosed: Boolean = false, useResumeWriting: Boolean = true) extends UnacceptedConnectionTest { - // lazy init since potential exceptions must not be triggered in the constructor but during execution of `run` + // lazy init since potential exceptions should not be triggered in the constructor but during execution of `run` lazy val serverSideChannel = acceptServerSideConnection(localServerChannel) lazy val connectionHandler = TestProbe() lazy val nioSelector = SelectorProvider.provider().openSelector() @@ -856,7 +856,7 @@ class TcpConnectionSpec extends AkkaSpec(""" override def run(body: ⇒ Unit): Unit = super.run { try { serverSideChannel.configureBlocking(false) - serverSideChannel must not be (null) + serverSideChannel should not be (null) interestCallReceiver.expectMsg(OP_CONNECT) selector.send(connectionActor, ChannelConnectable) @@ -881,7 +881,7 @@ class TcpConnectionSpec extends AkkaSpec(""" def closeServerSideAndWaitForClientReadable(fullClose: Boolean = true): Unit = { if (fullClose) serverSideChannel.close() else serverSideChannel.socket.shutdownOutput() - checkFor(clientSelectionKey, OP_READ, 3.seconds.toMillis.toInt) must be(true) + checkFor(clientSelectionKey, OP_READ, 3.seconds.toMillis.toInt) should be(true) } def registerChannel(channel: SocketChannel, name: String): SelectionKey = { @@ -943,20 +943,20 @@ class TcpConnectionSpec extends AkkaSpec(""" } @tailrec final def expectReceivedString(data: String): Unit = { - data.length must be > 0 + data.length should be > 0 selector.send(connectionActor, ChannelReadable) val gotReceived = connectionHandler.expectMsgType[Received] val receivedString = gotReceived.data.decodeString("ASCII") - data.startsWith(receivedString) must be(true) + data.startsWith(receivedString) should be(true) if (receivedString.length < data.length) expectReceivedString(data.drop(receivedString.length)) } def assertThisConnectionActorTerminated(): Unit = { verifyActorTermination(connectionActor) - clientSideChannel must not be ('open) + clientSideChannel should not be ('open) } def selectedAs(interest: Int, duration: Duration): BeMatcher[SelectionKey] = diff --git a/akka-actor-tests/src/test/scala/akka/io/TcpIntegrationSpec.scala b/akka-actor-tests/src/test/scala/akka/io/TcpIntegrationSpec.scala index aa049bdbd3..712ef0755c 100644 --- a/akka-actor-tests/src/test/scala/akka/io/TcpIntegrationSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/TcpIntegrationSpec.scala @@ -46,11 +46,11 @@ class TcpIntegrationSpec extends AkkaSpec(""" clientHandler.send(clientConnection, Write(ByteString("Captain on the bridge!"), Aye)) clientHandler.expectMsg(Aye) - serverHandler.expectMsgType[Received].data.decodeString("ASCII") must be("Captain on the bridge!") + serverHandler.expectMsgType[Received].data.decodeString("ASCII") should be("Captain on the bridge!") serverHandler.send(serverConnection, Write(ByteString("For the king!"), Yes)) serverHandler.expectMsg(Yes) - clientHandler.expectMsgType[Received].data.decodeString("ASCII") must be("For the king!") + clientHandler.expectMsgType[Received].data.decodeString("ASCII") should be("For the king!") serverHandler.send(serverConnection, Close) serverHandler.expectMsg(Closed) diff --git a/akka-actor-tests/src/test/scala/akka/io/TcpListenerSpec.scala b/akka-actor-tests/src/test/scala/akka/io/TcpListenerSpec.scala index 74d2bd70b6..2f6c901f6f 100644 --- a/akka-actor-tests/src/test/scala/akka/io/TcpListenerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/TcpListenerSpec.scala @@ -125,8 +125,8 @@ class TcpListenerSpec extends AkkaSpec(""" def expectWorkerForCommand: SocketChannel = selectorRouter.expectMsgPF() { case WorkerForCommand(RegisterIncoming(chan), commander, _) ⇒ - chan.isOpen must be(true) - commander must be === listener + chan.isOpen should be(true) + commander should equal(listener) chan } diff --git a/akka-actor-tests/src/test/scala/akka/io/UdpConnectedIntegrationSpec.scala b/akka-actor-tests/src/test/scala/akka/io/UdpConnectedIntegrationSpec.scala index 377e7ba8a6..a1006b5dde 100644 --- a/akka-actor-tests/src/test/scala/akka/io/UdpConnectedIntegrationSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/UdpConnectedIntegrationSpec.scala @@ -41,13 +41,13 @@ class UdpConnectedIntegrationSpec extends AkkaSpec(""" val clientAddress = expectMsgPF() { case Udp.Received(d, a) ⇒ - d must be === data1 + d should equal(data1) a } server ! Udp.Send(data2, clientAddress) - expectMsgType[UdpConnected.Received].data must be === data2 + expectMsgType[UdpConnected.Received].data should equal(data2) } "be able to send and receive with binding" in { @@ -60,13 +60,13 @@ class UdpConnectedIntegrationSpec extends AkkaSpec(""" expectMsgPF() { case Udp.Received(d, a) ⇒ - d must be === data1 - a must be === clientAddress + d should equal(data1) + a should equal(clientAddress) } server ! Udp.Send(data2, clientAddress) - expectMsgType[UdpConnected.Received].data must be === data2 + expectMsgType[UdpConnected.Received].data should equal(data2) } } diff --git a/akka-actor-tests/src/test/scala/akka/io/UdpIntegrationSpec.scala b/akka-actor-tests/src/test/scala/akka/io/UdpIntegrationSpec.scala index 721cb4c34f..1a843eeafd 100644 --- a/akka-actor-tests/src/test/scala/akka/io/UdpIntegrationSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/io/UdpIntegrationSpec.scala @@ -38,7 +38,7 @@ class UdpIntegrationSpec extends AkkaSpec(""" val data = ByteString("To infinity and beyond!") simpleSender ! Send(data, serverAddress) - expectMsgType[Received].data must be === data + expectMsgType[Received].data should equal(data) } @@ -53,16 +53,16 @@ class UdpIntegrationSpec extends AkkaSpec(""" server ! Send(data, clientAddress) expectMsgPF() { case Received(d, a) ⇒ - d must be === data - a must be === serverAddress + d should equal(data) + a should equal(serverAddress) } } def checkSendingToServer(): Unit = { client ! Send(data, serverAddress) expectMsgPF() { case Received(d, a) ⇒ - d must be === data - a must be === clientAddress + d should equal(data) + a should equal(clientAddress) } } diff --git a/akka-actor-tests/src/test/scala/akka/oldrouting/ConfiguredLocalRoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/oldrouting/ConfiguredLocalRoutingSpec.scala index 329defca9e..eb71fda037 100644 --- a/akka-actor-tests/src/test/scala/akka/oldrouting/ConfiguredLocalRoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/oldrouting/ConfiguredLocalRoutingSpec.scala @@ -65,7 +65,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con case "get" ⇒ sender ! context.props } }).withRouter(RoundRobinRouter(12)), "someOther") - routerConfig(actor) must be === RoundRobinRouter(12) + routerConfig(actor) should equal(RoundRobinRouter(12)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } @@ -75,7 +75,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con case "get" ⇒ sender ! context.props } }).withRouter(RoundRobinRouter(12)), "config") - routerConfig(actor) must be === RandomPool(4) + routerConfig(actor) should equal(RandomPool(4)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } @@ -85,7 +85,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con case "get" ⇒ sender ! context.props } }).withRouter(FromConfig).withDeploy(Deploy(routerConfig = RoundRobinRouter(12))), "someOther") - routerConfig(actor) must be === RoundRobinRouter(12) + routerConfig(actor) should equal(RoundRobinRouter(12)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } @@ -95,7 +95,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con case "get" ⇒ sender ! context.props } }).withRouter(FromConfig).withDeploy(Deploy(routerConfig = RoundRobinRouter(12))), "config") - routerConfig(actor) must be === RandomPool(4) + routerConfig(actor) should equal(RandomPool(4)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } @@ -112,7 +112,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con }).withRouter(FromConfig), "weird") val recv = Set() ++ (for (_ ← 1 to 3) yield expectMsgType[ActorRef]) val expc = Set('a', 'b', 'c') map (i ⇒ system.actorFor("/user/weird/$" + i)) - recv must be(expc) + recv should be(expc) expectNoMsg(1 second) } @@ -171,12 +171,12 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con } } - counter.get must be(connectionCount) + counter.get should be(connectionCount) actor ! Broadcast("end") Await.ready(doneLatch, 5 seconds) - replies.values foreach { _ must be(iterationCount) } + replies.values foreach { _ should be(iterationCount) } } "deliver a broadcast message using the !" in { @@ -256,13 +256,13 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con } } - counter.get must be(connectionCount) + counter.get should be(connectionCount) actor ! Broadcast("end") Await.ready(doneLatch, 5 seconds) - replies.values foreach { _ must be > (0) } - replies.values.sum must be === iterationCount * connectionCount + replies.values foreach { _ should be > (0) } + replies.values.sum should equal(iterationCount * connectionCount) } "deliver a broadcast message using the !" in { diff --git a/akka-actor-tests/src/test/scala/akka/oldrouting/ConsistentHashingRouterSpec.scala b/akka-actor-tests/src/test/scala/akka/oldrouting/ConsistentHashingRouterSpec.scala index b56588471f..d1271d7ed9 100644 --- a/akka-actor-tests/src/test/scala/akka/oldrouting/ConsistentHashingRouterSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/oldrouting/ConsistentHashingRouterSpec.scala @@ -58,7 +58,7 @@ class ConsistentHashingRouterSpec extends AkkaSpec(ConsistentHashingRouterSpec.c "consistent hashing router" must { "create routees from configuration" in { val currentRoutees = Await.result(router1 ? CurrentRoutees, remaining).asInstanceOf[RouterRoutees] - currentRoutees.routees.size must be(3) + currentRoutees.routees.size should be(3) } "select destination based on consistentHashKey of the message" in { diff --git a/akka-actor-tests/src/test/scala/akka/oldrouting/ResizerSpec.scala b/akka-actor-tests/src/test/scala/akka/oldrouting/ResizerSpec.scala index 487c3995c5..9c93ffcd2b 100644 --- a/akka-actor-tests/src/test/scala/akka/oldrouting/ResizerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/oldrouting/ResizerSpec.scala @@ -63,13 +63,13 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with upperBound = 3) val c1 = resizer.capacity(Vector.empty[Routee]) - c1 must be(2) + c1 should be(2) val current = Vector( ActorRefRoutee(system.actorOf(Props[TestActor])), ActorRefRoutee(system.actorOf(Props[TestActor]))) val c2 = resizer.capacity(current) - c2 must be(0) + c2 should be(0) } "use settings to evaluate rampUp" in { @@ -78,9 +78,9 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with upperBound = 10, rampupRate = 0.2) - resizer.rampup(pressure = 9, capacity = 10) must be(0) - resizer.rampup(pressure = 5, capacity = 5) must be(1) - resizer.rampup(pressure = 6, capacity = 6) must be(2) + resizer.rampup(pressure = 9, capacity = 10) should be(0) + resizer.rampup(pressure = 5, capacity = 5) should be(1) + resizer.rampup(pressure = 6, capacity = 6) should be(2) } "use settings to evaluate backoff" in { @@ -90,13 +90,13 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with backoffThreshold = 0.3, backoffRate = 0.1) - resizer.backoff(pressure = 10, capacity = 10) must be(0) - resizer.backoff(pressure = 4, capacity = 10) must be(0) - resizer.backoff(pressure = 3, capacity = 10) must be(0) - resizer.backoff(pressure = 2, capacity = 10) must be(-1) - resizer.backoff(pressure = 0, capacity = 10) must be(-1) - resizer.backoff(pressure = 1, capacity = 9) must be(-1) - resizer.backoff(pressure = 0, capacity = 9) must be(-1) + resizer.backoff(pressure = 10, capacity = 10) should be(0) + resizer.backoff(pressure = 4, capacity = 10) should be(0) + resizer.backoff(pressure = 3, capacity = 10) should be(0) + resizer.backoff(pressure = 2, capacity = 10) should be(-1) + resizer.backoff(pressure = 0, capacity = 10) should be(-1) + resizer.backoff(pressure = 1, capacity = 9) should be(-1) + resizer.backoff(pressure = 0, capacity = 9) should be(-1) } "be possible to define programmatically" in { @@ -114,7 +114,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with Await.ready(latch, remaining) // messagesPerResize is 10 so there is no risk of additional resize - routeeSize(router) must be(2) + routeeSize(router) should be(2) } "be possible to define in configuration" in { @@ -128,7 +128,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with Await.ready(latch, remaining) - routeeSize(router) must be(2) + routeeSize(router) should be(2) } "grow as needed under pressure" in { @@ -156,7 +156,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with router ! "echo" expectMsg("reply") - routeeSize(router) must be(resizer.lowerBound) + routeeSize(router) should be(resizer.lowerBound) def loop(loops: Int, d: FiniteDuration) = { for (m ← 0 until loops) { @@ -171,11 +171,11 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with // 2 more should go thru without triggering more loop(2, 200 millis) - routeeSize(router) must be(resizer.lowerBound) + routeeSize(router) should be(resizer.lowerBound) // a whole bunch should max it out loop(20, 500 millis) - routeeSize(router) must be(resizer.upperBound) + routeeSize(router) should be(resizer.upperBound) } "backoff" in within(10 seconds) { @@ -203,7 +203,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with } val z = routeeSize(router) - z must be > (2) + z should be > (2) Thread.sleep((300 millis).dilated.toMillis) diff --git a/akka-actor-tests/src/test/scala/akka/oldrouting/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/oldrouting/RoutingSpec.scala index fb95123a89..3bd5ebe8d4 100644 --- a/akka-actor-tests/src/test/scala/akka/oldrouting/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/oldrouting/RoutingSpec.scala @@ -70,7 +70,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with watch(router) watch(c2) system.stop(c2) - expectTerminated(c2).existenceConfirmed must be === true + expectTerminated(c2).existenceConfirmed should equal(true) // it might take a while until the Router has actually processed the Terminated message awaitCond { router ! "" @@ -81,7 +81,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with res == Seq(c1, c1) } system.stop(c1) - expectTerminated(router).existenceConfirmed must be === true + expectTerminated(router).existenceConfirmed should equal(true) } "not terminate when resizer is used" in { @@ -98,7 +98,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(latch, remaining) router ! CurrentRoutees val routees = expectMsgType[RouterRoutees].routees - routees.size must be(2) + routees.size should be(2) routees foreach system.stop // expect no Terminated expectNoMsg(2.seconds) @@ -125,7 +125,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with 1 to actors foreach { _ ⇒ val routees = expectMsgType[RouterRoutees].routees - routees.map(_.path.name).toSet must be === names + routees.map(_.path.name).toSet should equal(names) } expectNoMsg(500.millis) } @@ -133,7 +133,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "use configured nr-of-instances when FromConfig" in { val router = system.actorOf(Props[TestActor].withRouter(FromConfig), "router1") router ! CurrentRoutees - expectMsgType[RouterRoutees].routees.size must be(3) + expectMsgType[RouterRoutees].routees.size should be(3) watch(router) system.stop(router) expectTerminated(router) @@ -142,7 +142,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "use configured nr-of-instances when router is specified" in { val router = system.actorOf(Props[TestActor].withRouter(RoundRobinRouter(nrOfInstances = 2)), "router2") router ! CurrentRoutees - expectMsgType[RouterRoutees].routees.size must be(3) + expectMsgType[RouterRoutees].routees.size should be(3) system.stop(router) } @@ -158,7 +158,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with val router = system.actorOf(Props[TestActor].withRouter(RoundRobinRouter(resizer = Some(resizer))), "router3") Await.ready(latch, remaining) router ! CurrentRoutees - expectMsgType[RouterRoutees].routees.size must be(3) + expectMsgType[RouterRoutees].routees.size should be(3) system.stop(router) } @@ -213,7 +213,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with EventFilter[Exception]("die", occurrences = 1) intercept { router ! "die" } - expectMsgType[Exception].getMessage must be("die") + expectMsgType[Exception].getMessage should be("die") expectMsg("restarted") expectMsg("restarted") expectMsg("restarted") @@ -236,7 +236,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "no router" must { "be started when constructed" in { val routedActor = system.actorOf(Props[TestActor].withRouter(NoRouter)) - routedActor.isTerminated must be(false) + routedActor.isTerminated should be(false) } "send message to connection" in { @@ -258,7 +258,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "round robin router" must { "be started when constructed" in { val routedActor = system.actorOf(Props[TestActor].withRouter(RoundRobinRouter(nrOfInstances = 1))) - routedActor.isTerminated must be(false) + routedActor.isTerminated should be(false) } //In this test a bunch of actors are created and each actor has its own counter. @@ -299,7 +299,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(doneLatch, remaining) for (i ← 0 until connectionCount) - counters(i).get must be((iterationCount * (i + 1))) + counters(i).get should be((iterationCount * (i + 1))) } "deliver a broadcast message using the !" in { @@ -328,8 +328,8 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(doneLatch, remaining) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } } @@ -337,7 +337,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "be started when constructed" in { val routedActor = system.actorOf(Props[TestActor].withRouter(RandomRouter(nrOfInstances = 1))) - routedActor.isTerminated must be(false) + routedActor.isTerminated should be(false) } "deliver a broadcast message" in { @@ -366,15 +366,15 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(doneLatch, remaining) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } } "smallest mailbox router" must { "be started when constructed" in { val routedActor = system.actorOf(Props[TestActor].withRouter(SmallestMailboxRouter(nrOfInstances = 1))) - routedActor.isTerminated must be(false) + routedActor.isTerminated should be(false) } "deliver messages to idle actor" in { @@ -413,15 +413,15 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with busy.countDown() val busyPath = usedActors.get(0) - busyPath must not be (null) + busyPath should not be (null) val path1 = usedActors.get(1) val path2 = usedActors.get(2) val path3 = usedActors.get(3) - path1 must not be (busyPath) - path2 must not be (busyPath) - path3 must not be (busyPath) + path1 should not be (busyPath) + path2 should not be (busyPath) + path3 should not be (busyPath) } } @@ -429,7 +429,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "broadcast router" must { "be started when constructed" in { val routedActor = system.actorOf(Props[TestActor].withRouter(BroadcastRouter(nrOfInstances = 1))) - routedActor.isTerminated must be(false) + routedActor.isTerminated should be(false) } "broadcast message using !" in { @@ -457,8 +457,8 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(doneLatch, remaining) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } "broadcast message using ?" in { @@ -488,8 +488,8 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(doneLatch, remaining) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } } @@ -498,7 +498,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "be started when constructed" in { val routedActor = system.actorOf(Props[TestActor].withRouter( ScatterGatherFirstCompletedRouter(routees = List(newActor(0)), within = 1 seconds))) - routedActor.isTerminated must be(false) + routedActor.isTerminated should be(false) } "deliver a broadcast message using the !" in { @@ -527,8 +527,8 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(doneLatch, TestLatch.DefaultTimeout) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } "return response, even if one of the actors has stopped" in { @@ -540,7 +540,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with routedActor ! Broadcast(Stop(Some(1))) Await.ready(shutdownLatch, TestLatch.DefaultTimeout) - Await.result(routedActor ? Broadcast(0), timeout.duration) must be(14) + Await.result(routedActor ? Broadcast(0), timeout.duration) should be(14) } case class Stop(id: Option[Int] = None) @@ -567,7 +567,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with val e = intercept[ConfigurationException] { system.actorOf(Props[TestActor].withRouter(FromConfig), "routerNotDefined") } - e.getMessage must include("routerNotDefined") + e.getMessage should include("routerNotDefined") } "allow external configuration" in { diff --git a/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala index ff3d05eb5c..1d8b880f09 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala @@ -20,7 +20,7 @@ class AskSpec extends AkkaSpec { implicit val timeout = Timeout(5 seconds) val dead = system.actorFor("/system/deadLetters") val f = dead.ask(42)(1 second) - f.isCompleted must be(true) + f.isCompleted should be(true) f.value.get match { case Failure(_: AskTimeoutException) ⇒ case v ⇒ fail(v + " was not Left(AskTimeoutException)") @@ -31,7 +31,7 @@ class AskSpec extends AkkaSpec { implicit val timeout = Timeout(5 seconds) val empty = system.actorFor("unknown") val f = empty ? 3.14 - f.isCompleted must be(true) + f.isCompleted should be(true) f.value.get match { case Failure(_: AskTimeoutException) ⇒ case v ⇒ fail(v + " was not Left(AskTimeoutException)") @@ -41,10 +41,10 @@ class AskSpec extends AkkaSpec { "return broken promises on unsupported ActorRefs" in { implicit val timeout = Timeout(5 seconds) val f = ask(null: ActorRef, 3.14) - f.isCompleted must be(true) + f.isCompleted should be(true) intercept[IllegalArgumentException] { Await.result(f, remaining) - }.getMessage must be === "Unsupported recipient ActorRef type, question not sent to [null]" + }.getMessage should equal("Unsupported recipient ActorRef type, question not sent to [null]") } "return broken promises on 0 timeout" in { @@ -54,7 +54,7 @@ class AskSpec extends AkkaSpec { val expectedMsg = "Timeout length must not be negative, question not sent to [%s]" format echo intercept[IllegalArgumentException] { Await.result(f, remaining) - }.getMessage must be === expectedMsg + }.getMessage should equal(expectedMsg) } "return broken promises on < 0 timeout" in { @@ -64,7 +64,7 @@ class AskSpec extends AkkaSpec { val expectedMsg = "Timeout length must not be negative, question not sent to [%s]" format echo intercept[IllegalArgumentException] { Await.result(f, remaining) - }.getMessage must be === expectedMsg + }.getMessage should equal(expectedMsg) } "include target information in AskTimeout" in { @@ -73,7 +73,7 @@ class AskSpec extends AkkaSpec { val f = silentOne ? "noreply" intercept[AskTimeoutException] { Await.result(f, remaining) - }.getMessage.contains("/user/silent") must be(true) + }.getMessage.contains("/user/silent") should be(true) } "work for ActorSelection" in { @@ -83,7 +83,7 @@ class AskSpec extends AkkaSpec { val identityFuture = (system.actorSelection("/user/select-echo") ? Identify(None)) .mapTo[ActorIdentity].map(_.ref.get) - Await.result(identityFuture, 5 seconds) must be === echo + Await.result(identityFuture, 5 seconds) should equal(echo) } } diff --git a/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerMTSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerMTSpec.scala index e8cca49c14..57e73b828d 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerMTSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerMTSpec.scala @@ -48,16 +48,16 @@ class CircuitBreakerMTSpec extends AkkaSpec { "allow many calls while in closed state with no errors" in { val futures = testCallsWithBreaker() val result = Await.result(Future.sequence(futures), 5.second.dilated) - result.size must be(numberOfTestCalls) - result.toSet must be === Set("succeed") + result.size should be(numberOfTestCalls) + result.toSet should equal(Set("succeed")) } "transition to open state upon reaching failure limit and fail-fast" in { openBreaker() val futures = testCallsWithBreaker() val result = Await.result(Future.sequence(futures), 5.second.dilated) - result.size must be(numberOfTestCalls) - result.toSet must be === Set("CBO") + result.size should be(numberOfTestCalls) + result.toSet should equal(Set("CBO")) } "allow a single call through in half-open state" in { @@ -71,8 +71,8 @@ class CircuitBreakerMTSpec extends AkkaSpec { val futures = testCallsWithBreaker() val result = Await.result(Future.sequence(futures), 5.second.dilated) - result.size must be(numberOfTestCalls) - result.toSet must be === Set("succeed", "CBO") + result.size should be(numberOfTestCalls) + result.toSet should equal(Set("succeed", "CBO")) } "recover and reset the breaker after the reset timeout" in { @@ -91,8 +91,8 @@ class CircuitBreakerMTSpec extends AkkaSpec { val futures = testCallsWithBreaker() val result = Await.result(Future.sequence(futures), 5.second.dilated) - result.size must be(numberOfTestCalls) - result.toSet must be === Set("succeed") + result.size should be(numberOfTestCalls) + result.toSet should equal(Set("succeed")) } } } diff --git a/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerSpec.scala index 05a5fcb5c6..b3f26c05a5 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/CircuitBreakerSpec.scala @@ -93,27 +93,27 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter { "A synchronous circuit breaker that is closed" must { "allow calls through" in { val breaker = CircuitBreakerSpec.longCallTimeoutCb() - breaker().withSyncCircuitBreaker(sayHi) must be("hi") + breaker().withSyncCircuitBreaker(sayHi) should be("hi") } "increment failure count on failure" in { val breaker = CircuitBreakerSpec.longCallTimeoutCb() - breaker().currentFailureCount must be(0) + breaker().currentFailureCount should be(0) intercept[TestException] { breaker().withSyncCircuitBreaker(throwException) } checkLatch(breaker.openLatch) - breaker().currentFailureCount must be(1) + breaker().currentFailureCount should be(1) } "reset failure count after success" in { val breaker = CircuitBreakerSpec.multiFailureCb() - breaker().currentFailureCount must be(0) + breaker().currentFailureCount should be(0) intercept[TestException] { val ct = Thread.currentThread() // Ensure that the thunk is executed in the tests thread breaker().withSyncCircuitBreaker({ if (Thread.currentThread() eq ct) throwException else "fail" }) } - breaker().currentFailureCount must be === 1 + breaker().currentFailureCount should equal(1) breaker().withSyncCircuitBreaker(sayHi) - breaker().currentFailureCount must be === 0 + breaker().currentFailureCount should equal(0) } "increment failure count on callTimeout" in { @@ -145,7 +145,7 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter { val breaker = CircuitBreakerSpec.shortResetTimeoutCb() breaker().withCircuitBreaker(Future(throwException)) checkLatch(breaker.halfOpenLatch) - Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) must be("hi") + Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) should be("hi") checkLatch(breaker.closedLatch) } @@ -170,21 +170,21 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter { "An asynchronous circuit breaker that is closed" must { "allow calls through" in { val breaker = CircuitBreakerSpec.longCallTimeoutCb() - Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) must be("hi") + Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) should be("hi") } "increment failure count on exception" in { val breaker = CircuitBreakerSpec.longCallTimeoutCb() intercept[TestException] { Await.result(breaker().withCircuitBreaker(Future(throwException)), awaitTimeout) } checkLatch(breaker.openLatch) - breaker().currentFailureCount must be(1) + breaker().currentFailureCount should be(1) } "increment failure count on async failure" in { val breaker = CircuitBreakerSpec.longCallTimeoutCb() breaker().withCircuitBreaker(Future(throwException)) checkLatch(breaker.openLatch) - breaker().currentFailureCount must be(1) + breaker().currentFailureCount should be(1) } "reset failure count after success" in { @@ -200,7 +200,7 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter { val breaker = CircuitBreakerSpec.shortCallTimeoutCb() breaker().withCircuitBreaker(Future { Thread.sleep(100.millis.dilated.toMillis); sayHi }) checkLatch(breaker.openLatch) - breaker().currentFailureCount must be(1) + breaker().currentFailureCount should be(1) } } diff --git a/akka-actor-tests/src/test/scala/akka/pattern/PatternSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/PatternSpec.scala index 67b2f00885..90ece13a89 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/PatternSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/PatternSpec.scala @@ -32,7 +32,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") { "provide Future for stopping an actor" in { val target = system.actorOf(Props[TargetActor]) val result = gracefulStop(target, 5 seconds) - Await.result(result, 6 seconds) must be(true) + Await.result(result, 6 seconds) should be(true) } "complete Future when actor already terminated" in { @@ -56,7 +56,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") { val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.successful(5).future) val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f)) - Await.result(r, remaining) must be(5) + Await.result(r, remaining) should be(5) } "be completed abnormally eventually" in { @@ -64,7 +64,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") { val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")).future) val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f)) - intercept[IllegalStateException] { Await.result(r, remaining) }.getMessage must be("Mexico") + intercept[IllegalStateException] { Await.result(r, remaining) }.getMessage should be("Mexico") } } } diff --git a/akka-actor-tests/src/test/scala/akka/pattern/PipeToSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/PipeToSpec.scala index aa1cf93f33..f3ddff4703 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/PipeToSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/PipeToSpec.scala @@ -24,7 +24,7 @@ class PipeToSpec extends AkkaSpec { "signal failure" in { val p = TestProbe() Future.failed(new Exception("failed")) pipeTo p.ref - p.expectMsgType[Status.Failure].cause.getMessage must be("failed") + p.expectMsgType[Status.Failure].cause.getMessage should be("failed") } "pick up an implicit sender" in { @@ -32,7 +32,7 @@ class PipeToSpec extends AkkaSpec { implicit val s = testActor Future(42) pipeTo p.ref p.expectMsg(42) - p.lastSender must be(s) + p.lastSender should be(s) } "work in Java form" in { @@ -45,7 +45,7 @@ class PipeToSpec extends AkkaSpec { val p = TestProbe() pipe(Future(42)) to (p.ref, testActor) p.expectMsg(42) - p.lastSender must be(testActor) + p.lastSender should be(testActor) } } @@ -63,7 +63,7 @@ class PipeToSpec extends AkkaSpec { val p = TestProbe() val sel = system.actorSelection(p.ref.path) Future.failed(new Exception("failed")) pipeToSelection sel - p.expectMsgType[Status.Failure].cause.getMessage must be("failed") + p.expectMsgType[Status.Failure].cause.getMessage should be("failed") } "pick up an implicit sender" in { @@ -72,7 +72,7 @@ class PipeToSpec extends AkkaSpec { implicit val s = testActor Future(42) pipeToSelection sel p.expectMsg(42) - p.lastSender must be(s) + p.lastSender should be(s) } "work in Java form" in { @@ -87,7 +87,7 @@ class PipeToSpec extends AkkaSpec { val sel = system.actorSelection(p.ref.path) pipe(Future(42)) to (sel, testActor) p.expectMsg(42) - p.lastSender must be(testActor) + p.lastSender should be(testActor) } } diff --git a/akka-actor-tests/src/test/scala/akka/performance/microbench/TellLatencyPerformanceSpec.scala b/akka-actor-tests/src/test/scala/akka/performance/microbench/TellLatencyPerformanceSpec.scala index 630f4cb813..1ead750130 100644 --- a/akka-actor-tests/src/test/scala/akka/performance/microbench/TellLatencyPerformanceSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/microbench/TellLatencyPerformanceSpec.scala @@ -68,7 +68,7 @@ class TellLatencyPerformanceSpec extends PerformanceSpec { val durationNs = (System.nanoTime - start) if (!warmup) { - ok must be(true) + ok should be(true) logMeasurement(numberOfClients, durationNs, stat) } clients.foreach(system.stop(_)) diff --git a/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputComputationPerformanceSpec.scala b/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputComputationPerformanceSpec.scala index 87aa78f2c7..fc64362942 100644 --- a/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputComputationPerformanceSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputComputationPerformanceSpec.scala @@ -114,7 +114,7 @@ class TellThroughputComputationPerformanceSpec extends PerformanceSpec { val durationNs = (System.nanoTime - start) if (!warmup) { - ok must be(true) + ok should be(true) logMeasurement(numberOfClients, durationNs, repeat) } clients.foreach(system.stop(_)) diff --git a/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputPerformanceSpec.scala b/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputPerformanceSpec.scala index 4975532c9a..05f7b8d477 100644 --- a/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputPerformanceSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/microbench/TellThroughputPerformanceSpec.scala @@ -123,7 +123,7 @@ class TellThroughputPerformanceSpec extends PerformanceSpec { val durationNs = (System.nanoTime - start) if (!warmup) { - ok must be(true) + ok should be(true) logMeasurement(numberOfClients, durationNs, repeat) } clients.foreach(system.stop(_)) diff --git a/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingLatencyPerformanceSpec.scala b/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingLatencyPerformanceSpec.scala index 58b2e7e315..d8b6fb872c 100644 --- a/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingLatencyPerformanceSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingLatencyPerformanceSpec.scala @@ -102,9 +102,9 @@ class TradingLatencyPerformanceSpec extends PerformanceSpec { val durationNs = (System.nanoTime - start) if (!warmup) { - ok must be(true) + ok should be(true) if (!Orderbook.useDummyOrderbook) { - totalTradeCounter.count must be(totalNumberOfOrders / 2) + totalTradeCounter.count should be(totalNumberOfOrders / 2) } logMeasurement(numberOfClients, durationNs, stat) } diff --git a/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingThroughputPerformanceSpec.scala b/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingThroughputPerformanceSpec.scala index a1033d7682..51e8319f13 100644 --- a/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingThroughputPerformanceSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/trading/system/TradingThroughputPerformanceSpec.scala @@ -99,9 +99,9 @@ class TradingThroughputPerformanceSpec extends PerformanceSpec { val durationNs = (System.nanoTime - start) if (!warmup) { - ok must be(true) + ok should be(true) if (!Orderbook.useDummyOrderbook) { - totalTradeCounter.count must be(totalNumberOfOrders / 2) + totalTradeCounter.count should be(totalNumberOfOrders / 2) } logMeasurement(numberOfClients, durationNs, totalNumberOfOrders) } diff --git a/akka-actor-tests/src/test/scala/akka/routing/BroadcastSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/BroadcastSpec.scala index 85871c2a9a..a65649a6d4 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/BroadcastSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/BroadcastSpec.scala @@ -48,8 +48,8 @@ class BroadcastSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { Await.ready(doneLatch, remaining) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } "broadcast message using ?" in { @@ -80,8 +80,8 @@ class BroadcastSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { Await.ready(doneLatch, remaining) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } } diff --git a/akka-actor-tests/src/test/scala/akka/routing/ConfiguredLocalRoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/ConfiguredLocalRoutingSpec.scala index 4e9a240aa9..fef29a1166 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/ConfiguredLocalRoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/ConfiguredLocalRoutingSpec.scala @@ -97,33 +97,33 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con "be picked up from Props" in { val actor = system.actorOf(RoundRobinPool(12).props(routeeProps = Props[EchoProps]), "someOther") - routerConfig(actor) must be === RoundRobinPool(12) + routerConfig(actor) should equal(RoundRobinPool(12)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } "be overridable in config" in { val actor = system.actorOf(RoundRobinPool(12).props(routeeProps = Props[EchoProps]), "config") - routerConfig(actor) must be === RandomPool(nrOfInstances = 4, usePoolDispatcher = true) + routerConfig(actor) should equal(RandomPool(nrOfInstances = 4, usePoolDispatcher = true)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } "use routees.paths from config" in { val actor = system.actorOf(RandomPool(12).props(routeeProps = Props[EchoProps]), "paths") - routerConfig(actor) must be === RandomGroup(List("/user/service1", "/user/service2")) + routerConfig(actor) should equal(RandomGroup(List("/user/service1", "/user/service2"))) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } "be overridable in explicit deployment" in { val actor = system.actorOf(FromConfig.props(routeeProps = Props[EchoProps]). withDeploy(Deploy(routerConfig = RoundRobinPool(12))), "someOther") - routerConfig(actor) must be === RoundRobinPool(12) + routerConfig(actor) should equal(RoundRobinPool(12)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } "be overridable in config even with explicit deployment" in { val actor = system.actorOf(FromConfig.props(routeeProps = Props[EchoProps]). withDeploy(Deploy(routerConfig = RoundRobinPool(12))), "config") - routerConfig(actor) must be === RandomPool(nrOfInstances = 4, usePoolDispatcher = true) + routerConfig(actor) should equal(RandomPool(nrOfInstances = 4, usePoolDispatcher = true)) Await.result(gracefulStop(actor, 3 seconds), 3 seconds) } @@ -137,7 +137,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con val router = system.actorOf(FromConfig.props(routeeProps = Props(classOf[SendRefAtStartup], testActor)), "weird") val recv = Set() ++ (for (_ ← 1 to 3) yield expectMsgType[ActorRef]) val expc = Set('a', 'b', 'c') map (i ⇒ system.actorFor("/user/weird/$" + i)) - recv must be(expc) + recv should be(expc) expectNoMsg(1 second) } diff --git a/akka-actor-tests/src/test/scala/akka/routing/ConsistentHashingRouterSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/ConsistentHashingRouterSpec.scala index 5472a505bb..332d3a14d1 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/ConsistentHashingRouterSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/ConsistentHashingRouterSpec.scala @@ -56,7 +56,7 @@ class ConsistentHashingRouterSpec extends AkkaSpec(ConsistentHashingRouterSpec.c "consistent hashing router" must { "create routees from configuration" in { val currentRoutees = Await.result(router1 ? GetRoutees, remaining).asInstanceOf[Routees] - currentRoutees.routees.size must be(3) + currentRoutees.routees.size should be(3) } "select destination based on consistentHashKey of the message" in { diff --git a/akka-actor-tests/src/test/scala/akka/routing/RandomSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RandomSpec.scala index 1997bd0d2f..eceb33f77c 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RandomSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RandomSpec.scala @@ -70,13 +70,13 @@ class RandomSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { } } - counter.get must be(connectionCount) + counter.get should be(connectionCount) actor ! akka.routing.Broadcast("end") Await.ready(doneLatch, 5 seconds) - replies.values foreach { _ must be > (0) } - replies.values.sum must be === iterationCount * connectionCount + replies.values foreach { _ should be > (0) } + replies.values.sum should equal(iterationCount * connectionCount) } "deliver a broadcast message using the !" in { diff --git a/akka-actor-tests/src/test/scala/akka/routing/ResizerSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/ResizerSpec.scala index bb9584b7a6..800ee21126 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/ResizerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/ResizerSpec.scala @@ -61,13 +61,13 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with upperBound = 3) val c1 = resizer.capacity(Vector.empty[Routee]) - c1 must be(2) + c1 should be(2) val current = Vector( ActorRefRoutee(system.actorOf(Props[TestActor])), ActorRefRoutee(system.actorOf(Props[TestActor]))) val c2 = resizer.capacity(current) - c2 must be(0) + c2 should be(0) } "use settings to evaluate rampUp" in { @@ -76,9 +76,9 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with upperBound = 10, rampupRate = 0.2) - resizer.rampup(pressure = 9, capacity = 10) must be(0) - resizer.rampup(pressure = 5, capacity = 5) must be(1) - resizer.rampup(pressure = 6, capacity = 6) must be(2) + resizer.rampup(pressure = 9, capacity = 10) should be(0) + resizer.rampup(pressure = 5, capacity = 5) should be(1) + resizer.rampup(pressure = 6, capacity = 6) should be(2) } "use settings to evaluate backoff" in { @@ -88,13 +88,13 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with backoffThreshold = 0.3, backoffRate = 0.1) - resizer.backoff(pressure = 10, capacity = 10) must be(0) - resizer.backoff(pressure = 4, capacity = 10) must be(0) - resizer.backoff(pressure = 3, capacity = 10) must be(0) - resizer.backoff(pressure = 2, capacity = 10) must be(-1) - resizer.backoff(pressure = 0, capacity = 10) must be(-1) - resizer.backoff(pressure = 1, capacity = 9) must be(-1) - resizer.backoff(pressure = 0, capacity = 9) must be(-1) + resizer.backoff(pressure = 10, capacity = 10) should be(0) + resizer.backoff(pressure = 4, capacity = 10) should be(0) + resizer.backoff(pressure = 3, capacity = 10) should be(0) + resizer.backoff(pressure = 2, capacity = 10) should be(-1) + resizer.backoff(pressure = 0, capacity = 10) should be(-1) + resizer.backoff(pressure = 1, capacity = 9) should be(-1) + resizer.backoff(pressure = 0, capacity = 9) should be(-1) } "be possible to define programmatically" in { @@ -113,7 +113,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with Await.ready(latch, remaining) // messagesPerResize is 10 so there is no risk of additional resize - routeeSize(router) must be(2) + routeeSize(router) should be(2) } "be possible to define in configuration" in { @@ -127,7 +127,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with Await.ready(latch, remaining) - routeeSize(router) must be(2) + routeeSize(router) should be(2) } "grow as needed under pressure" in { @@ -156,7 +156,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with router ! "echo" expectMsg("reply") - routeeSize(router) must be(resizer.lowerBound) + routeeSize(router) should be(resizer.lowerBound) def loop(loops: Int, d: FiniteDuration) = { for (m ← 0 until loops) { @@ -171,11 +171,11 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with // 2 more should go thru without triggering more loop(2, 200 millis) - routeeSize(router) must be(resizer.lowerBound) + routeeSize(router) should be(resizer.lowerBound) // a whole bunch should max it out loop(20, 500 millis) - routeeSize(router) must be(resizer.upperBound) + routeeSize(router) should be(resizer.upperBound) } "backoff" in within(10 seconds) { @@ -203,7 +203,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with } val z = routeeSize(router) - z must be > (2) + z should be > (2) Thread.sleep((300 millis).dilated.toMillis) diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoundRobinSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoundRobinSpec.scala index 087bd1d95a..f04ebc3d17 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoundRobinSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoundRobinSpec.scala @@ -68,12 +68,12 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { replies = replies + (id -> (replies(id) + 1)) } - counter.get must be(connectionCount) + counter.get should be(connectionCount) actor ! akka.routing.Broadcast("end") Await.ready(doneLatch, 5 seconds) - replies.values foreach { _ must be(iterationCount) } + replies.values foreach { _ should be(iterationCount) } } "deliver a broadcast message using the !" in { @@ -102,17 +102,17 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { def receive = Actor.emptyBehavior })), "round-robin-managed") - routeeSize(actor) must be(3) + routeeSize(actor) should be(3) actor ! AdjustPoolSize(+4) - routeeSize(actor) must be(7) + routeeSize(actor) should be(7) actor ! AdjustPoolSize(-2) - routeeSize(actor) must be(5) + routeeSize(actor) should be(5) val other = ActorSelectionRoutee(system.actorSelection("/user/other")) actor ! AddRoutee(other) - routeeSize(actor) must be(6) + routeeSize(actor) should be(6) actor ! RemoveRoutee(other) - routeeSize(actor) must be(5) + routeeSize(actor) should be(5) } } @@ -145,7 +145,7 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { actor ! akka.routing.Broadcast("end") Await.ready(doneLatch, 5 seconds) - replies.values foreach { _ must be(iterationCount) } + replies.values foreach { _ should be(iterationCount) } } } @@ -192,7 +192,7 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { actor ! akka.routing.Broadcast("end") expectTerminated(actor) - replies.values foreach { _ must be(iterationCount) } + replies.values foreach { _ should be(iterationCount) } } } diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala index dab7fd90c7..78b6c0c2ce 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala @@ -70,7 +70,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with watch(router) watch(c2) system.stop(c2) - expectTerminated(c2).existenceConfirmed must be === true + expectTerminated(c2).existenceConfirmed should equal(true) // it might take a while until the Router has actually processed the Terminated message awaitCond { router ! "" @@ -81,7 +81,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with res == Seq(c1, c1) } system.stop(c1) - expectTerminated(router).existenceConfirmed must be === true + expectTerminated(router).existenceConfirmed should equal(true) } "not terminate when resizer is used" in { @@ -99,7 +99,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with Await.ready(latch, remaining) router ! GetRoutees val routees = expectMsgType[Routees].routees - routees.size must be(2) + routees.size should be(2) routees foreach { _.send(PoisonPill, testActor) } // expect no Terminated expectNoMsg(2.seconds) @@ -108,7 +108,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "use configured nr-of-instances when FromConfig" in { val router = system.actorOf(FromConfig.props(routeeProps = Props[TestActor]), "router1") router ! GetRoutees - expectMsgType[Routees].routees.size must be(3) + expectMsgType[Routees].routees.size should be(3) watch(router) system.stop(router) expectTerminated(router) @@ -117,7 +117,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with "use configured nr-of-instances when router is specified" in { val router = system.actorOf(RoundRobinPool(nrOfInstances = 2).props(routeeProps = Props[TestActor]), "router2") router ! GetRoutees - expectMsgType[Routees].routees.size must be(3) + expectMsgType[Routees].routees.size should be(3) system.stop(router) } @@ -134,7 +134,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with routeeProps = Props[TestActor]), "router3") Await.ready(latch, remaining) router ! GetRoutees - expectMsgType[Routees].routees.size must be(3) + expectMsgType[Routees].routees.size should be(3) system.stop(router) } @@ -191,7 +191,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with EventFilter[Exception]("die", occurrences = 1) intercept { router ! "die" } - expectMsgType[Exception].getMessage must be("die") + expectMsgType[Exception].getMessage should be("die") expectMsg("restarted") expectMsg("restarted") expectMsg("restarted") @@ -234,7 +234,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with val e = intercept[ConfigurationException] { system.actorOf(FromConfig.props(routeeProps = Props[TestActor]), "routerNotDefined") } - e.getMessage must include("routerNotDefined") + e.getMessage should include("routerNotDefined") } "allow external configuration" in { diff --git a/akka-actor-tests/src/test/scala/akka/routing/ScatterGatherFirstCompletedSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/ScatterGatherFirstCompletedSpec.scala index 1e0a0dcd28..60275726f0 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/ScatterGatherFirstCompletedSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/ScatterGatherFirstCompletedSpec.scala @@ -68,8 +68,8 @@ class ScatterGatherFirstCompletedSpec extends AkkaSpec with DefaultTimeout with Await.ready(doneLatch, TestLatch.DefaultTimeout) - counter1.get must be(1) - counter2.get must be(1) + counter1.get should be(1) + counter2.get should be(1) } "return response, even if one of the actors has stopped" in { @@ -81,7 +81,7 @@ class ScatterGatherFirstCompletedSpec extends AkkaSpec with DefaultTimeout with routedActor ! Broadcast(Stop(Some(1))) Await.ready(shutdownLatch, TestLatch.DefaultTimeout) - Await.result(routedActor ? Broadcast(0), timeout.duration) must be(14) + Await.result(routedActor ? Broadcast(0), timeout.duration) should be(14) } } diff --git a/akka-actor-tests/src/test/scala/akka/routing/SmallestMailboxSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/SmallestMailboxSpec.scala index c1a18ca116..ab6227ce9f 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/SmallestMailboxSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/SmallestMailboxSpec.scala @@ -51,15 +51,15 @@ class SmallestMailboxSpec extends AkkaSpec("akka.actor.serialize-messages = off" busy.countDown() val busyPath = usedActors.get(0) - busyPath must not be (null) + busyPath should not be (null) val path1 = usedActors.get(1) val path2 = usedActors.get(2) val path3 = usedActors.get(3) - path1 must not be (busyPath) - path2 must not be (busyPath) - path3 must not be (busyPath) + path1 should not be (busyPath) + path2 should not be (busyPath) + path3 should not be (busyPath) } } diff --git a/akka-actor-tests/src/test/scala/akka/serialization/SerializeSpec.scala b/akka-actor-tests/src/test/scala/akka/serialization/SerializeSpec.scala index fdaa7b6b49..065585b3b4 100644 --- a/akka-actor-tests/src/test/scala/akka/serialization/SerializeSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/serialization/SerializeSpec.scala @@ -143,8 +143,8 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) { "Serialization" must { "have correct bindings" in { - ser.bindings.collectFirst { case (c, s) if c == addr.getClass ⇒ s.getClass } must be(Some(classOf[JavaSerializer])) - ser.bindings.collectFirst { case (c, s) if c == classOf[PlainMessage] ⇒ s.getClass } must be(Some(classOf[TestSerializer])) + ser.bindings.collectFirst { case (c, s) if c == addr.getClass ⇒ s.getClass } should be(Some(classOf[JavaSerializer])) + ser.bindings.collectFirst { case (c, s) if c == classOf[PlainMessage] ⇒ s.getClass } should be(Some(classOf[TestSerializer])) } "serialize Address" in { @@ -184,7 +184,7 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) { val in = new ObjectInputStream(new ByteArrayInputStream(outbuf.toByteArray)) JavaSerializer.currentSystem.withValue(a.asInstanceOf[ActorSystemImpl]) { val deadLetters = in.readObject().asInstanceOf[DeadLetterActorRef] - (deadLetters eq a.deadLetters) must be(true) + (deadLetters eq a.deadLetters) should be(true) } } finally { shutdown(a) @@ -192,47 +192,47 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) { } "resolve serializer by direct interface" in { - ser.serializerFor(classOf[SimpleMessage]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[SimpleMessage]).getClass should be(classOf[TestSerializer]) } "resolve serializer by interface implemented by super class" in { - ser.serializerFor(classOf[ExtendedSimpleMessage]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[ExtendedSimpleMessage]).getClass should be(classOf[TestSerializer]) } "resolve serializer by indirect interface" in { - ser.serializerFor(classOf[AnotherMessage]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[AnotherMessage]).getClass should be(classOf[TestSerializer]) } "resolve serializer by indirect interface implemented by super class" in { - ser.serializerFor(classOf[ExtendedAnotherMessage]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[ExtendedAnotherMessage]).getClass should be(classOf[TestSerializer]) } "resolve serializer for message with binding" in { - ser.serializerFor(classOf[PlainMessage]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[PlainMessage]).getClass should be(classOf[TestSerializer]) } "resolve serializer for message extending class with with binding" in { - ser.serializerFor(classOf[ExtendedPlainMessage]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[ExtendedPlainMessage]).getClass should be(classOf[TestSerializer]) } "give warning for message with several bindings" in { EventFilter.warning(start = "Multiple serializers found", occurrences = 1) intercept { - ser.serializerFor(classOf[Both]).getClass must (be(classOf[TestSerializer]) or be(classOf[JavaSerializer])) + ser.serializerFor(classOf[Both]).getClass should (be(classOf[TestSerializer]) or be(classOf[JavaSerializer])) } } "resolve serializer in the order of the bindings" in { - ser.serializerFor(classOf[A]).getClass must be(classOf[JavaSerializer]) - ser.serializerFor(classOf[B]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[A]).getClass should be(classOf[JavaSerializer]) + ser.serializerFor(classOf[B]).getClass should be(classOf[TestSerializer]) EventFilter.warning(start = "Multiple serializers found", occurrences = 1) intercept { - ser.serializerFor(classOf[C]).getClass must (be(classOf[TestSerializer]) or be(classOf[JavaSerializer])) + ser.serializerFor(classOf[C]).getClass should (be(classOf[TestSerializer]) or be(classOf[JavaSerializer])) } } "resolve serializer in the order of most specific binding first" in { - ser.serializerFor(classOf[A]).getClass must be(classOf[JavaSerializer]) - ser.serializerFor(classOf[D]).getClass must be(classOf[TestSerializer]) - ser.serializerFor(classOf[E]).getClass must be(classOf[TestSerializer]) + ser.serializerFor(classOf[A]).getClass should be(classOf[JavaSerializer]) + ser.serializerFor(classOf[D]).getClass should be(classOf[TestSerializer]) + ser.serializerFor(classOf[E]).getClass should be(classOf[TestSerializer]) } "throw java.io.NotSerializableException when no binding" in { @@ -243,14 +243,14 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) { "use ByteArraySerializer for byte arrays" in { val byteSerializer = ser.serializerFor(classOf[Array[Byte]]) - byteSerializer.getClass must be theSameInstanceAs classOf[ByteArraySerializer] + byteSerializer.getClass should be theSameInstanceAs classOf[ByteArraySerializer] for (a ← Seq("foo".getBytes("UTF-8"), null: Array[Byte], Array[Byte]())) - byteSerializer.fromBinary(byteSerializer.toBinary(a)) must be theSameInstanceAs a + byteSerializer.fromBinary(byteSerializer.toBinary(a)) should be theSameInstanceAs a intercept[IllegalArgumentException] { byteSerializer.toBinary("pigdog") - }.getMessage must be === "ByteArraySerializer only serializes byte arrays, not [pigdog]" + }.getMessage should equal("ByteArraySerializer only serializes byte arrays, not [pigdog]") } } } @@ -261,8 +261,8 @@ class VerifySerializabilitySpec extends AkkaSpec(SerializationTests.verifySerial implicit val timeout = Timeout(5 seconds) "verify config" in { - system.settings.SerializeAllCreators must be(true) - system.settings.SerializeAllMessages must be(true) + system.settings.SerializeAllCreators should be(true) + system.settings.SerializeAllMessages should be(true) } "verify creators" in { @@ -285,7 +285,7 @@ class VerifySerializabilitySpec extends AkkaSpec(SerializationTests.verifySerial "verify messages" in { val a = system.actorOf(Props[FooActor]) - Await.result(a ? "pigdog", timeout.duration) must be("pigdog") + Await.result(a ? "pigdog", timeout.duration) should be("pigdog") EventFilter[NotSerializableException](occurrences = 1) intercept { a ! (new AnyRef) @@ -300,7 +300,7 @@ class ReferenceSerializationSpec extends AkkaSpec(SerializationTests.mostlyRefer val ser = SerializationExtension(system) def serializerMustBe(toSerialize: Class[_], expectedSerializer: Class[_]) = - ser.serializerFor(toSerialize).getClass must be(expectedSerializer) + ser.serializerFor(toSerialize).getClass should be(expectedSerializer) "Serialization settings from reference.conf" must { @@ -331,7 +331,7 @@ class SerializationCompatibilitySpec extends AkkaSpec(SerializationTests.mostlyR "Cross-version serialization compatibility" must { def verify(obj: SystemMessage, asExpected: String): Unit = - String.valueOf(ser.serialize(obj).map(encodeHex).get) must be === asExpected + String.valueOf(ser.serialize(obj).map(encodeHex).get) should equal(asExpected) "be preserved for the Create SystemMessage" in { // Using null as the cause to avoid a large serialized message and JDK differences @@ -408,7 +408,7 @@ class OverriddenSystemMessageSerializationSpec extends AkkaSpec(SerializationTes "resolve to a single serializer" in { EventFilter.warning(start = "Multiple serializers found", occurrences = 0) intercept { for (smc ← systemMessageClasses) { - ser.serializerFor(smc).getClass must be(classOf[TestSerializer]) + ser.serializerFor(smc).getClass should be(classOf[TestSerializer]) } } } diff --git a/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala b/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala index 3dad271e1a..b669124fa2 100644 --- a/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala @@ -1,7 +1,7 @@ package akka.util import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.BeforeAndAfterAll import org.scalatest.prop.Checkers import org.scalacheck._ @@ -16,7 +16,7 @@ import java.nio.ByteOrder, ByteOrder.{ BIG_ENDIAN, LITTLE_ENDIAN } import java.lang.Float.floatToRawIntBits import java.lang.Double.doubleToRawLongBits -class ByteStringSpec extends WordSpec with MustMatchers with Checkers { +class ByteStringSpec extends WordSpec with Matchers with Checkers { def genSimpleByteString(min: Int, max: Int) = for { n ← choose(min, max) diff --git a/akka-actor-tests/src/test/scala/akka/util/DurationSpec.scala b/akka-actor-tests/src/test/scala/akka/util/DurationSpec.scala index 71c3baedb9..cbaf0ad918 100644 --- a/akka-actor-tests/src/test/scala/akka/util/DurationSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/util/DurationSpec.scala @@ -18,13 +18,13 @@ class DurationSpec extends AkkaSpec { val one = 1 second val two = one + one val three = 3 * one - (0 * one) must be(zero) - (2 * one) must be(two) - (three - two) must be(one) - (three / 3) must be(one) - (two / one) must be(2) - (one + zero) must be(one) - (one / 1000000) must be(1.micro) + (0 * one) should be(zero) + (2 * one) should be(two) + (three - two) should be(one) + (three / 3) should be(one) + (two / one) should be(2) + (one + zero) should be(one) + (one / 1000000) should be(1.micro) } "respect correct treatment of infinities" in { @@ -32,21 +32,21 @@ class DurationSpec extends AkkaSpec { val inf = Duration.Inf val minf = Duration.MinusInf val undefined = Duration.Undefined - (-inf) must be(minf) - (minf + inf) must be(undefined) - (inf - inf) must be(undefined) - (inf + minf) must be(undefined) - (minf - minf) must be(undefined) - (inf + inf) must be(inf) - (inf - minf) must be(inf) - (minf - inf) must be(minf) - (minf + minf) must be(minf) + (-inf) should be(minf) + (minf + inf) should be(undefined) + (inf - inf) should be(undefined) + (inf + minf) should be(undefined) + (minf - minf) should be(undefined) + (inf + inf) should be(inf) + (inf - minf) should be(inf) + (minf - inf) should be(minf) + (minf + minf) should be(minf) assert(inf == inf) assert(minf == minf) - inf.compareTo(inf) must be(0) - inf.compareTo(one) must be(1) - minf.compareTo(minf) must be(0) - minf.compareTo(one) must be(-1) + inf.compareTo(inf) should be(0) + inf.compareTo(one) should be(1) + minf.compareTo(minf) should be(0) + minf.compareTo(one) should be(-1) assert(inf != minf) assert(minf != inf) assert(one != inf) @@ -58,7 +58,7 @@ class DurationSpec extends AkkaSpec { val x = unit.convert(Long.MaxValue, NANOSECONDS) val dur = Duration(x, unit) val mdur = Duration(-x, unit) - -mdur must be(dur) + -mdur should be(dur) intercept[IllegalArgumentException] { Duration(x + 10000000d, unit) } intercept[IllegalArgumentException] { Duration(-x - 10000000d, unit) } if (unit != NANOSECONDS) { @@ -86,11 +86,11 @@ class DurationSpec extends AkkaSpec { val dead = 2.seconds.fromNow val dead2 = 2 seconds fromNow // view bounds vs. very local type inference vs. operator precedence: sigh - dead.timeLeft must be > (1 second: Duration) - dead2.timeLeft must be > (1 second: Duration) + dead.timeLeft should be > (1 second: Duration) + dead2.timeLeft should be > (1 second: Duration) Thread.sleep(1.second.toMillis) - dead.timeLeft must be < (1 second: Duration) - dead2.timeLeft must be < (1 second: Duration) + dead.timeLeft should be < (1 second: Duration) + dead2.timeLeft should be < (1 second: Duration) } } diff --git a/akka-actor-tests/src/test/scala/akka/util/IndexSpec.scala b/akka-actor-tests/src/test/scala/akka/util/IndexSpec.scala index 16374b9c10..5a2b148860 100644 --- a/akka-actor-tests/src/test/scala/akka/util/IndexSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/util/IndexSpec.scala @@ -3,14 +3,14 @@ */ package akka.util -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.Future import akka.testkit.AkkaSpec import scala.concurrent.Await import scala.util.Random import akka.testkit.DefaultTimeout -class IndexSpec extends AkkaSpec with MustMatchers with DefaultTimeout { +class IndexSpec extends AkkaSpec with Matchers with DefaultTimeout { implicit val ec = system.dispatcher private def emptyIndex = new Index[String, Int](100, _ compareTo _) @@ -31,17 +31,17 @@ class IndexSpec extends AkkaSpec with MustMatchers with DefaultTimeout { "take and return a value" in { val index = emptyIndex index.put("s1", 1) - index.valueIterator("s1").toSet must be === Set(1) + index.valueIterator("s1").toSet should equal(Set(1)) } "take and return several values" in { val index = emptyIndex - index.put("s1", 1) must be === true - index.put("s1", 1) must be === false + index.put("s1", 1) should equal(true) + index.put("s1", 1) should equal(false) index.put("s1", 2) index.put("s1", 3) index.put("s2", 4) - index.valueIterator("s1").toSet must be === Set(1, 2, 3) - index.valueIterator("s2").toSet must be === Set(4) + index.valueIterator("s1").toSet should equal(Set(1, 2, 3)) + index.valueIterator("s2").toSet should equal(Set(4)) } "remove values" in { val index = emptyIndex @@ -50,16 +50,16 @@ class IndexSpec extends AkkaSpec with MustMatchers with DefaultTimeout { index.put("s2", 1) index.put("s2", 2) //Remove value - index.remove("s1", 1) must be === true - index.remove("s1", 1) must be === false - index.valueIterator("s1").toSet must be === Set(2) + index.remove("s1", 1) should equal(true) + index.remove("s1", 1) should equal(false) + index.valueIterator("s1").toSet should equal(Set(2)) //Remove key index.remove("s2") match { - case Some(iter) ⇒ iter.toSet must be === Set(1, 2) + case Some(iter) ⇒ iter.toSet should equal(Set(1, 2)) case None ⇒ fail() } - index.remove("s2") must be === None - index.valueIterator("s2").toSet must be === Set() + index.remove("s2") should equal(None) + index.valueIterator("s2").toSet should equal(Set()) } "remove the specified value" in { val index = emptyIndex @@ -71,9 +71,9 @@ class IndexSpec extends AkkaSpec with MustMatchers with DefaultTimeout { index.put("s3", 2) index.removeValue(1) - index.valueIterator("s1").toSet must be === Set(2, 3) - index.valueIterator("s2").toSet must be === Set(2) - index.valueIterator("s3").toSet must be === Set(2) + index.valueIterator("s1").toSet should equal(Set(2, 3)) + index.valueIterator("s2").toSet should equal(Set(2)) + index.valueIterator("s3").toSet should equal(Set(2)) } "apply a function for all key-value pairs and find every value" in { val index = indexWithValues @@ -81,15 +81,15 @@ class IndexSpec extends AkkaSpec with MustMatchers with DefaultTimeout { var valueCount = 0 index.foreach((key, value) ⇒ { valueCount = valueCount + 1 - index.findValue(key)(_ == value) must be === Some(value) + index.findValue(key)(_ == value) should equal(Some(value)) }) - valueCount must be === 6 + valueCount should equal(6) } "be cleared" in { val index = indexWithValues - index.isEmpty must be === false + index.isEmpty should equal(false) index.clear() - index.isEmpty must be === true + index.isEmpty should equal(true) } "be able to be accessed in parallel" in { val index = new Index[Int, Int](100, _ compareTo _) @@ -113,7 +113,7 @@ class IndexSpec extends AkkaSpec with MustMatchers with DefaultTimeout { val key = Random.nextInt(nrOfKeys) val values = index.valueIterator(key) if (key >= nrOfKeys / 2) { - values.isEmpty must be === false + values.isEmpty should equal(false) } } diff --git a/akka-actor-tests/src/test/scala/akka/util/SwitchSpec.scala b/akka-actor-tests/src/test/scala/akka/util/SwitchSpec.scala index 9e7db5da30..9e8c22ec10 100644 --- a/akka-actor-tests/src/test/scala/akka/util/SwitchSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/util/SwitchSpec.scala @@ -4,32 +4,32 @@ package akka.util import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit -class SwitchSpec extends WordSpec with MustMatchers { +class SwitchSpec extends WordSpec with Matchers { "Switch" must { "on and off" in { val s = new Switch(false) - s.isOff must be(true) - s.isOn must be(false) + s.isOff should be(true) + s.isOn should be(false) - s.switchOn(()) must be(true) - s.isOn must be(true) - s.isOff must be(false) - s.switchOn(()) must be(false) - s.isOn must be(true) - s.isOff must be(false) + s.switchOn(()) should be(true) + s.isOn should be(true) + s.isOff should be(false) + s.switchOn(()) should be(false) + s.isOn should be(true) + s.isOff should be(false) - s.switchOff(()) must be(true) - s.isOff must be(true) - s.isOn must be(false) - s.switchOff(()) must be(false) - s.isOff must be(true) - s.isOn must be(false) + s.switchOff(()) should be(true) + s.isOff should be(true) + s.isOn should be(false) + s.switchOff(()) should be(false) + s.isOff should be(true) + s.isOn should be(false) } "revert when exception" in { @@ -37,42 +37,42 @@ class SwitchSpec extends WordSpec with MustMatchers { intercept[RuntimeException] { s.switchOn(throw new RuntimeException) } - s.isOff must be(true) + s.isOff should be(true) } "run action without locking" in { val s = new Switch(false) - s.ifOffYield("yes") must be(Some("yes")) - s.ifOnYield("no") must be(None) - s.ifOff(()) must be(true) - s.ifOn(()) must be(false) + s.ifOffYield("yes") should be(Some("yes")) + s.ifOnYield("no") should be(None) + s.ifOff(()) should be(true) + s.ifOn(()) should be(false) s.switchOn(()) - s.ifOnYield("yes") must be(Some("yes")) - s.ifOffYield("no") must be(None) - s.ifOn(()) must be(true) - s.ifOff(()) must be(false) + s.ifOnYield("yes") should be(Some("yes")) + s.ifOffYield("no") should be(None) + s.ifOn(()) should be(true) + s.ifOff(()) should be(false) } "run action with locking" in { val s = new Switch(false) - s.whileOffYield("yes") must be(Some("yes")) - s.whileOnYield("no") must be(None) - s.whileOff(()) must be(true) - s.whileOn(()) must be(false) + s.whileOffYield("yes") should be(Some("yes")) + s.whileOnYield("no") should be(None) + s.whileOff(()) should be(true) + s.whileOn(()) should be(false) s.switchOn(()) - s.whileOnYield("yes") must be(Some("yes")) - s.whileOffYield("no") must be(None) - s.whileOn(()) must be(true) - s.whileOff(()) must be(false) + s.whileOnYield("yes") should be(Some("yes")) + s.whileOffYield("no") should be(None) + s.whileOn(()) should be(true) + s.whileOff(()) should be(false) } "run first or second action depending on state" in { val s = new Switch(false) - s.fold("on")("off") must be("off") + s.fold("on")("off") should be("off") s.switchOn(()) - s.fold("on")("off") must be("on") + s.fold("on")("off") should be("on") } "do proper locking" in { @@ -81,7 +81,7 @@ class SwitchSpec extends WordSpec with MustMatchers { s.locked { Thread.sleep(500) s.switchOn(()) - s.isOn must be(true) + s.isOn should be(true) } val latch = new CountDownLatch(1) @@ -93,7 +93,7 @@ class SwitchSpec extends WordSpec with MustMatchers { }.start() latch.await(5, TimeUnit.SECONDS) - s.isOff must be(true) + s.isOff should be(true) } } } diff --git a/akka-agent/src/test/scala/akka/agent/AgentSpec.scala b/akka-agent/src/test/scala/akka/agent/AgentSpec.scala index a10d375327..3a5ce236e0 100644 --- a/akka-agent/src/test/scala/akka/agent/AgentSpec.scala +++ b/akka-agent/src/test/scala/akka/agent/AgentSpec.scala @@ -31,7 +31,7 @@ class AgentSpec extends AkkaSpec { agent send countDown countDown.await(5 seconds) - agent() must be("abcd") + agent() should be("abcd") } "maintain order between send and sendOff" in { @@ -45,7 +45,7 @@ class AgentSpec extends AkkaSpec { agent send countDown l2.countDown countDown.await(5 seconds) - agent() must be("abcd") + agent() should be("abcd") } "maintain order between alter and alterOff" in { @@ -59,9 +59,9 @@ class AgentSpec extends AkkaSpec { val result = Future.sequence(Seq(r1, r2, r3)).map(_.mkString(":")) l2.countDown - Await.result(result, 5 seconds) must be === "ab:abc:abcd" + Await.result(result, 5 seconds) should equal("ab:abc:abcd") - agent() must be("abcd") + agent() should be("abcd") } "be immediately readable" in { @@ -80,14 +80,14 @@ class AgentSpec extends AkkaSpec { agent send countDown countDown.await(5 seconds) - read must be(5) - agent() must be(10) + read should be(5) + agent() should be(10) } "be readable within a transaction" in { val agent = Agent(5) val value = atomic { t ⇒ agent() } - value must be(5) + value should be(5) } "dispatch sends in successful transactions" in { @@ -100,7 +100,7 @@ class AgentSpec extends AkkaSpec { agent send countDown countDown.await(5 seconds) - agent() must be(10) + agent() should be(10) } "not dispatch sends in aborted transactions" in { @@ -118,7 +118,7 @@ class AgentSpec extends AkkaSpec { agent send countDown countDown.await(5 seconds) - agent() must be(5) + agent() should be(5) } "be able to return a 'queued' future" in { @@ -126,7 +126,7 @@ class AgentSpec extends AkkaSpec { agent send (_ + "b") agent send (_ + "c") - Await.result(agent.future, timeout.duration) must be("abc") + Await.result(agent.future, timeout.duration) should be("abc") } "be able to await the value after updates have completed" in { @@ -134,15 +134,15 @@ class AgentSpec extends AkkaSpec { agent send (_ + "b") agent send (_ + "c") - Await.result(agent.future, timeout.duration) must be("abc") + Await.result(agent.future, timeout.duration) should be("abc") } "be able to be mapped" in { val agent1 = Agent(5) val agent2 = agent1 map (_ * 2) - agent1() must be(5) - agent2() must be(10) + agent1() should be(5) + agent2() should be(10) } "be able to be used in a 'foreach' for comprehension" in { @@ -153,15 +153,15 @@ class AgentSpec extends AkkaSpec { result += value } - result must be(3) + result should be(3) } "be able to be used in a 'map' for comprehension" in { val agent1 = Agent(5) val agent2 = for (value ← agent1) yield value * 2 - agent1() must be(5) - agent2() must be(10) + agent1() should be(5) + agent2() should be(10) } "be able to be used in a 'flatMap' for comprehension" in { @@ -173,9 +173,9 @@ class AgentSpec extends AkkaSpec { value2 ← agent2 } yield value1 + value2 - agent1() must be(1) - agent2() must be(2) - agent3() must be(3) + agent1() should be(1) + agent2() should be(2) + agent3() should be(3) } } } diff --git a/akka-camel/src/test/scala/akka/camel/ActivationIntegrationTest.scala b/akka-camel/src/test/scala/akka/camel/ActivationIntegrationTest.scala index 408139fc18..7639a6754e 100644 --- a/akka-camel/src/test/scala/akka/camel/ActivationIntegrationTest.scala +++ b/akka-camel/src/test/scala/akka/camel/ActivationIntegrationTest.scala @@ -6,7 +6,7 @@ package akka.camel import language.postfixOps -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.duration._ import org.apache.camel.ProducerTemplate import akka.actor._ @@ -17,21 +17,21 @@ import scala.concurrent.Await import java.util.concurrent.TimeoutException import akka.util.Timeout -class ActivationIntegrationTest extends WordSpec with MustMatchers with SharedCamelSystem { +class ActivationIntegrationTest extends WordSpec with Matchers with SharedCamelSystem { val timeoutDuration = 10 seconds implicit val timeout = Timeout(timeoutDuration) def template: ProducerTemplate = camel.template import system.dispatcher - "ActivationAware must be notified when endpoint is activated" in { + "ActivationAware should be notified when endpoint is activated" in { val latch = new TestLatch(0) val actor = system.actorOf(Props(new TestConsumer("direct:actor-1", latch)), "act-direct-actor-1") - Await.result(camel.activationFutureFor(actor), 10 seconds) must be === actor + Await.result(camel.activationFutureFor(actor), 10 seconds) should equal(actor) - template.requestBody("direct:actor-1", "test") must be("received test") + template.requestBody("direct:actor-1", "test") should be("received test") } - "ActivationAware must be notified when endpoint is de-activated" in { + "ActivationAware should be notified when endpoint is de-activated" in { val latch = TestLatch(1) val actor = start(new Consumer { def endpointUri = "direct:a3" diff --git a/akka-camel/src/test/scala/akka/camel/CamelConfigSpec.scala b/akka-camel/src/test/scala/akka/camel/CamelConfigSpec.scala index 0c90230fb0..fd13fa0335 100644 --- a/akka-camel/src/test/scala/akka/camel/CamelConfigSpec.scala +++ b/akka-camel/src/test/scala/akka/camel/CamelConfigSpec.scala @@ -3,14 +3,14 @@ */ package akka.camel -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.WordSpec import akka.actor.ActorSystem import scala.concurrent.duration.Duration import java.util.concurrent.TimeUnit._ import akka.testkit.TestKit -class CamelConfigSpec extends WordSpec with MustMatchers { +class CamelConfigSpec extends WordSpec with Matchers { val (settings, config) = { val system = ActorSystem("CamelConfigSpec") @@ -20,30 +20,30 @@ class CamelConfigSpec extends WordSpec with MustMatchers { } "CamelConfigSpec" must { "have correct activationTimeout config" in { - settings.ActivationTimeout must be === Duration(config.getMilliseconds("akka.camel.consumer.activation-timeout"), MILLISECONDS) + settings.ActivationTimeout should equal(Duration(config.getMilliseconds("akka.camel.consumer.activation-timeout"), MILLISECONDS)) } "have correct autoAck config" in { - settings.AutoAck must be === config.getBoolean("akka.camel.consumer.auto-ack") + settings.AutoAck should equal(config.getBoolean("akka.camel.consumer.auto-ack")) } "have correct replyTimeout config" in { - settings.ReplyTimeout must be === Duration(config.getMilliseconds("akka.camel.consumer.reply-timeout"), MILLISECONDS) + settings.ReplyTimeout should equal(Duration(config.getMilliseconds("akka.camel.consumer.reply-timeout"), MILLISECONDS)) } "have correct streamingCache config" in { - settings.StreamingCache must be === config.getBoolean("akka.camel.streamingCache") + settings.StreamingCache should equal(config.getBoolean("akka.camel.streamingCache")) } "have correct jmxStatistics config" in { - settings.JmxStatistics must be === config.getBoolean("akka.camel.jmx") + settings.JmxStatistics should equal(config.getBoolean("akka.camel.jmx")) } "have correct body conversions config" in { val conversions = config.getConfig("akka.camel.conversions") - conversions.getString("file") must be === "java.io.InputStream" - conversions.entrySet.size must be === 1 + conversions.getString("file") should equal("java.io.InputStream") + conversions.entrySet.size should equal(1) } } } diff --git a/akka-camel/src/test/scala/akka/camel/CamelMessageTest.scala b/akka-camel/src/test/scala/akka/camel/CamelMessageTest.scala index e97caa4995..9e62938b9d 100644 --- a/akka-camel/src/test/scala/akka/camel/CamelMessageTest.scala +++ b/akka-camel/src/test/scala/akka/camel/CamelMessageTest.scala @@ -6,11 +6,11 @@ package akka.camel import org.apache.camel.impl.{ DefaultExchange, DefaultMessage } import akka.camel.TestSupport.SharedCamelSystem -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.WordSpecLike //TODO merge it with MessageScalaTest -class CamelMessageTest extends MustMatchers with WordSpecLike with SharedCamelSystem { +class CamelMessageTest extends Matchers with WordSpecLike with SharedCamelSystem { "CamelMessage" must { diff --git a/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala b/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala index 59634d07d5..e9a21874b9 100644 --- a/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala +++ b/akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala @@ -5,7 +5,7 @@ package akka.camel import language.postfixOps import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.{ Promise, Await, Future } import scala.collection.immutable import akka.camel.TestSupport.NonSharedCamelSystem @@ -21,7 +21,7 @@ import akka.actor.ActorLogging /** * A test to concurrently register and de-register consumer and producer endpoints */ -class ConcurrentActivationTest extends WordSpec with MustMatchers with NonSharedCamelSystem { +class ConcurrentActivationTest extends WordSpec with Matchers with NonSharedCamelSystem { "Activation" must { "support concurrent registrations and de-registrations" in { @@ -57,14 +57,14 @@ class ConcurrentActivationTest extends WordSpec with MustMatchers with NonShared } } val (activations, deactivations) = Await.result(allRefsFuture, 10.seconds.dilated) - // must be the size of the activated activated producers and consumers - activations.size must be(2 * number * number) - // must be the size of the activated activated producers and consumers - deactivations.size must be(2 * number * number) + // should be the size of the activated activated producers and consumers + activations.size should be(2 * number * number) + // should be the size of the activated activated producers and consumers + deactivations.size should be(2 * number * number) def partitionNames(refs: immutable.Seq[ActorRef]) = refs.map(_.path.name).partition(_.startsWith("concurrent-test-echo-consumer")) def assertContainsSameElements(lists: (Seq[_], Seq[_])) { val (a, b) = lists - a.intersect(b).size must be(a.size) + a.intersect(b).size should be(a.size) } val (activatedConsumerNames, activatedProducerNames) = partitionNames(activations) val (deactivatedConsumerNames, deactivatedProducerNames) = partitionNames(deactivations) diff --git a/akka-camel/src/test/scala/akka/camel/ConsumerIntegrationTest.scala b/akka-camel/src/test/scala/akka/camel/ConsumerIntegrationTest.scala index 2900c9a342..aa9d252a55 100644 --- a/akka-camel/src/test/scala/akka/camel/ConsumerIntegrationTest.scala +++ b/akka-camel/src/test/scala/akka/camel/ConsumerIntegrationTest.scala @@ -9,7 +9,7 @@ import language.postfixOps import language.existentials import akka.actor._ -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.WordSpec import akka.camel.TestSupport._ import org.apache.camel.model.{ ProcessorDefinition, RouteDefinition } @@ -22,7 +22,7 @@ import scala.concurrent.{ ExecutionContext, Await } import akka.testkit._ import akka.util.Timeout -class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedCamelSystem { +class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamelSystem { "ConsumerIntegrationTest" must { val defaultTimeoutDuration = 10 seconds implicit val defaultTimeout = Timeout(defaultTimeoutDuration) @@ -44,7 +44,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC case m: CamelMessage ⇒ sender ! "received " + m.bodyAs[String] } }, name = "direct-a1") - camel.sendTo("direct:a1", msg = "some message") must be("received some message") + camel.sendTo("direct:a1", msg = "some message") should be("received some message") } "Consumer must time-out if consumer is slow" taggedAs TimingTest in { @@ -59,7 +59,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC intercept[CamelExecutionException] { camel.sendTo("direct:a3", msg = "some msg 3") - }.getCause.getClass must be(classOf[TimeoutException]) + }.getCause.getClass should be(classOf[TimeoutException]) stop(ref) } @@ -82,7 +82,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC consumer ! "throw" Await.ready(restarted, defaultTimeoutDuration) - camel.sendTo("direct:a2", msg = "xyz") must be("received xyz") + camel.sendTo("direct:a2", msg = "xyz") should be("received xyz") } stop(consumer) } @@ -91,23 +91,23 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC val consumer = start(new TestActor(), name = "test-actor-unregister") Await.result(camel.activationFutureFor(consumer), defaultTimeoutDuration) - camel.routeCount must be > (0) + camel.routeCount should be > (0) system.stop(consumer) Await.result(camel.deactivationFutureFor(consumer), defaultTimeoutDuration) - camel.routeCount must be(0) + camel.routeCount should be(0) } "Consumer must register on uri passed in through constructor" in { val consumer = start(new TestActor("direct://test"), name = "direct-test") Await.result(camel.activationFutureFor(consumer), defaultTimeoutDuration) - camel.routeCount must be > (0) - camel.routes.get(0).getEndpoint.getEndpointUri must be("direct://test") + camel.routeCount should be > (0) + camel.routes.get(0).getEndpoint.getEndpointUri should be("direct://test") system.stop(consumer) Await.result(camel.deactivationFutureFor(consumer), defaultTimeoutDuration) - camel.routeCount must be(0) + camel.routeCount should be(0) stop(consumer) } @@ -118,7 +118,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC } }, name = "direct-error-handler-test") filterEvents(EventFilter[TestException](occurrences = 1)) { - camel.sendTo("direct:error-handler-test", msg = "hello") must be("error: hello") + camel.sendTo("direct:error-handler-test", msg = "hello") should be("error: hello") } stop(ref) } @@ -130,7 +130,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC } }, name = "direct-failing-once-consumer") filterEvents(EventFilter[TestException](occurrences = 1)) { - camel.sendTo("direct:failing-once-concumer", msg = "hello") must be("accepted: hello") + camel.sendTo("direct:failing-once-concumer", msg = "hello") should be("accepted: hello") } stop(ref) } @@ -140,7 +140,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC def endpointUri = "direct:manual-ack" def receive = { case _ ⇒ sender ! Ack } }, name = "direct-manual-ack-1") - camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS) must be(null) //should not timeout + camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS) should be(null) //should not timeout stop(ref) } @@ -153,7 +153,7 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC intercept[ExecutionException] { camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS) - }.getCause.getCause must be(someException) + }.getCause.getCause should be(someException) stop(ref) } @@ -166,14 +166,14 @@ class ConsumerIntegrationTest extends WordSpec with MustMatchers with NonSharedC intercept[ExecutionException] { camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS) - }.getCause.getCause.getMessage must include("Failed to get Ack") + }.getCause.getCause.getMessage should include("Failed to get Ack") stop(ref) } "respond to onRouteDefinition" in { val ref = start(new ErrorRespondingConsumer("direct:error-responding-consumer-1"), "error-responding-consumer") filterEvents(EventFilter[TestException](occurrences = 1)) { val response = camel.sendTo("direct:error-responding-consumer-1", "some body") - response must be("some body has an error") + response should be("some body has an error") } stop(ref) } diff --git a/akka-camel/src/test/scala/akka/camel/DefaultCamelTest.scala b/akka-camel/src/test/scala/akka/camel/DefaultCamelTest.scala index 95f4a434a8..898d6a8a55 100644 --- a/akka-camel/src/test/scala/akka/camel/DefaultCamelTest.scala +++ b/akka-camel/src/test/scala/akka/camel/DefaultCamelTest.scala @@ -6,7 +6,7 @@ package akka.camel import akka.camel.TestSupport.SharedCamelSystem import internal.DefaultCamel -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.mock.MockitoSugar import org.apache.camel.{ CamelContext, ProducerTemplate } import org.scalatest.WordSpec @@ -17,7 +17,7 @@ import org.apache.camel.impl.DefaultCamelContext import org.apache.camel.spi.Registry import akka.actor.{ ExtendedActorSystem, ActorSystem } -class DefaultCamelTest extends WordSpec with SharedCamelSystem with MustMatchers with MockitoSugar { +class DefaultCamelTest extends WordSpec with SharedCamelSystem with Matchers with MockitoSugar { import org.mockito.Mockito.{ when, verify } val sys = mock[ExtendedActorSystem] @@ -43,7 +43,7 @@ class DefaultCamelTest extends WordSpec with SharedCamelSystem with MustMatchers } "throws exception thrown by context.stop()" in { - exception.getMessage() must be("context"); + exception.getMessage() should be("context"); } "tries to stop both template and context" in { diff --git a/akka-camel/src/test/scala/akka/camel/MessageScalaTest.scala b/akka-camel/src/test/scala/akka/camel/MessageScalaTest.scala index 9e2a901ec5..374049d589 100644 --- a/akka-camel/src/test/scala/akka/camel/MessageScalaTest.scala +++ b/akka-camel/src/test/scala/akka/camel/MessageScalaTest.scala @@ -8,13 +8,13 @@ import java.io.InputStream import org.apache.camel.NoTypeConversionAvailableException import akka.camel.TestSupport.{ SharedCamelSystem } import org.scalatest.FunSuite -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.apache.camel.converter.stream.InputStreamCache -class MessageScalaTest extends FunSuite with MustMatchers with SharedCamelSystem { +class MessageScalaTest extends FunSuite with Matchers with SharedCamelSystem { implicit def camelContext = camel.context test("mustConvertDoubleBodyToString") { - CamelMessage(1.4, Map.empty).bodyAs[String] must be("1.4") + CamelMessage(1.4, Map.empty).bodyAs[String] should be("1.4") } test("mustThrowExceptionWhenConvertingDoubleBodyToInputStream") { @@ -25,36 +25,36 @@ class MessageScalaTest extends FunSuite with MustMatchers with SharedCamelSystem test("mustConvertDoubleHeaderToString") { val message = CamelMessage("test", Map("test" -> 1.4)) - message.headerAs[String]("test").get must be("1.4") + message.headerAs[String]("test").get should be("1.4") } test("mustReturnSubsetOfHeaders") { val message = CamelMessage("test", Map("A" -> "1", "B" -> "2")) - message.headers(Set("B")) must be(Map("B" -> "2")) + message.headers(Set("B")) should be(Map("B" -> "2")) } test("mustTransformBodyAndPreserveHeaders") { - CamelMessage("a", Map("A" -> "1")).mapBody((body: String) ⇒ body + "b") must be(CamelMessage("ab", Map("A" -> "1"))) + CamelMessage("a", Map("A" -> "1")).mapBody((body: String) ⇒ body + "b") should be(CamelMessage("ab", Map("A" -> "1"))) } test("mustConvertBodyAndPreserveHeaders") { - CamelMessage(1.4, Map("A" -> "1")).withBodyAs[String] must be(CamelMessage("1.4", Map("A" -> "1"))) + CamelMessage(1.4, Map("A" -> "1")).withBodyAs[String] should be(CamelMessage("1.4", Map("A" -> "1"))) } test("mustSetBodyAndPreserveHeaders") { - CamelMessage("test1", Map("A" -> "1")).copy(body = "test2") must be( + CamelMessage("test1", Map("A" -> "1")).copy(body = "test2") should be( CamelMessage("test2", Map("A" -> "1"))) } test("mustSetHeadersAndPreserveBody") { - CamelMessage("test1", Map("A" -> "1")).copy(headers = Map("C" -> "3")) must be( + CamelMessage("test1", Map("A" -> "1")).copy(headers = Map("C" -> "3")) should be( CamelMessage("test1", Map("C" -> "3"))) } test("mustBeAbleToReReadStreamCacheBody") { val msg = CamelMessage(new InputStreamCache("test1".getBytes("utf-8")), Map.empty) - msg.bodyAs[String] must be("test1") + msg.bodyAs[String] should be("test1") // re-read - msg.bodyAs[String] must be("test1") + msg.bodyAs[String] should be("test1") } } diff --git a/akka-camel/src/test/scala/akka/camel/ProducerFeatureTest.scala b/akka-camel/src/test/scala/akka/camel/ProducerFeatureTest.scala index bdd4bcd182..57177404d8 100644 --- a/akka-camel/src/test/scala/akka/camel/ProducerFeatureTest.scala +++ b/akka-camel/src/test/scala/akka/camel/ProducerFeatureTest.scala @@ -17,14 +17,14 @@ import akka.actor._ import akka.pattern._ import scala.concurrent.duration._ import akka.util.Timeout -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit._ import akka.actor.Status.Failure /** * Tests the features of the Camel Producer. */ -class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf)) with WordSpecLike with BeforeAndAfterAll with BeforeAndAfterEach with MustMatchers { +class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf)) with WordSpecLike with BeforeAndAfterAll with BeforeAndAfterEach with Matchers { import ProducerFeatureTest._ implicit def camel = CamelExtension(system) @@ -79,12 +79,12 @@ class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf) producer.tell(message, testActor) expectMsgPF(timeoutDuration) { case Failure(e: AkkaCamelException) ⇒ - e.getMessage must be("failure") - e.headers must be(Map(CamelMessage.MessageExchangeId -> "123")) + e.getMessage should be("failure") + e.headers should be(Map(CamelMessage.MessageExchangeId -> "123")) } } Await.ready(latch, timeoutDuration) - deadActor must be(Some(producer)) + deadActor should be(Some(producer)) } "03 produce a message oneway" in { @@ -121,8 +121,8 @@ class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf) producer.tell(message, testActor) expectMsgPF(timeoutDuration) { case Failure(e: AkkaCamelException) ⇒ - e.getMessage must be("failure") - e.headers must be(Map(CamelMessage.MessageExchangeId -> "123")) + e.getMessage should be("failure") + e.headers should be(Map(CamelMessage.MessageExchangeId -> "123")) } } } @@ -144,8 +144,8 @@ class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf) producer.tell(message, testActor) expectMsgPF(timeoutDuration) { case Failure(e: AkkaCamelException) ⇒ - e.getMessage must be("failure") - e.headers must be(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure")) + e.getMessage should be("failure") + e.headers should be(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure")) } } } @@ -187,8 +187,8 @@ class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf) producer.tell(message, testActor) expectMsgPF(timeoutDuration) { case Failure(e: AkkaCamelException) ⇒ - e.getMessage must be("failure") - e.headers must be(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure")) + e.getMessage should be("failure") + e.headers should be(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure")) } } } @@ -220,7 +220,7 @@ class ProducerFeatureTest extends TestKit(ActorSystem("test", AkkaSpec.testConf) val futureFailed = producer.tell("fail", testActor) expectMsgPF(timeoutDuration) { case Failure(e) ⇒ - e.getMessage must be("fail") + e.getMessage should be("fail") } producer.tell("OK", testActor) expectMsg("OK") diff --git a/akka-camel/src/test/scala/akka/camel/UntypedProducerTest.scala b/akka-camel/src/test/scala/akka/camel/UntypedProducerTest.scala index 7964d78b71..75fb40798f 100644 --- a/akka-camel/src/test/scala/akka/camel/UntypedProducerTest.scala +++ b/akka-camel/src/test/scala/akka/camel/UntypedProducerTest.scala @@ -19,7 +19,7 @@ import org.scalatest._ import akka.testkit._ import matchers.MustMatchers -class UntypedProducerTest extends WordSpec with MustMatchers with BeforeAndAfterAll with BeforeAndAfterEach with SharedCamelSystem with GivenWhenThen { +class UntypedProducerTest extends WordSpec with Matchers with BeforeAndAfterAll with BeforeAndAfterEach with SharedCamelSystem with GivenWhenThen { import UntypedProducerTest._ val timeout = 1 second override protected def beforeAll = { @@ -40,7 +40,7 @@ class UntypedProducerTest extends WordSpec with MustMatchers with BeforeAndAfter val expected = CamelMessage("received test", Map(CamelMessage.MessageExchangeId -> "123")) Await.result(future, timeout) match { - case result: CamelMessage ⇒ result must be(expected) + case result: CamelMessage ⇒ result should be(expected) case unexpected ⇒ fail("Actor responded with unexpected message:" + unexpected) } @@ -55,8 +55,8 @@ class UntypedProducerTest extends WordSpec with MustMatchers with BeforeAndAfter Await.result(future, timeout) match { case e: AkkaCamelException ⇒ - e.getMessage must be("failure") - e.headers must be(Map(CamelMessage.MessageExchangeId -> "123")) + e.getMessage should be("failure") + e.headers should be(Map(CamelMessage.MessageExchangeId -> "123")) case unexpected ⇒ fail("Actor responded with unexpected message:" + unexpected) } } diff --git a/akka-camel/src/test/scala/akka/camel/internal/ActivationTrackerTest.scala b/akka-camel/src/test/scala/akka/camel/internal/ActivationTrackerTest.scala index dc426fc809..c9196e7789 100644 --- a/akka-camel/src/test/scala/akka/camel/internal/ActivationTrackerTest.scala +++ b/akka-camel/src/test/scala/akka/camel/internal/ActivationTrackerTest.scala @@ -1,7 +1,7 @@ package akka.camel.internal import language.postfixOps -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.duration._ import org.scalatest.{ GivenWhenThen, BeforeAndAfterEach, BeforeAndAfterAll, WordSpecLike } import akka.actor.{ Props, ActorSystem } @@ -9,7 +9,7 @@ import akka.camel._ import akka.testkit.{ TimingTest, TestProbe, TestKit } import akka.camel.internal.ActivationProtocol._ -class ActivationTrackerTest extends TestKit(ActorSystem("test")) with WordSpecLike with MustMatchers with BeforeAndAfterAll with BeforeAndAfterEach with GivenWhenThen { +class ActivationTrackerTest extends TestKit(ActorSystem("test")) with WordSpecLike with Matchers with BeforeAndAfterAll with BeforeAndAfterEach with GivenWhenThen { override protected def afterAll() { shutdown(system) } diff --git a/akka-camel/src/test/scala/akka/camel/internal/component/ActorComponentConfigurationTest.scala b/akka-camel/src/test/scala/akka/camel/internal/component/ActorComponentConfigurationTest.scala index 3f5a8f33cf..9465a93870 100644 --- a/akka-camel/src/test/scala/akka/camel/internal/component/ActorComponentConfigurationTest.scala +++ b/akka-camel/src/test/scala/akka/camel/internal/component/ActorComponentConfigurationTest.scala @@ -6,20 +6,20 @@ package akka.camel.internal.component import language.postfixOps -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.duration._ import akka.camel.TestSupport.SharedCamelSystem import org.apache.camel.Component import org.scalatest.WordSpec -class ActorComponentConfigurationTest extends WordSpec with MustMatchers with SharedCamelSystem { +class ActorComponentConfigurationTest extends WordSpec with Matchers with SharedCamelSystem { val component: Component = camel.context.getComponent("akka") - "Endpoint url config must be correctly parsed" in { + "Endpoint url config should be correctly parsed" in { val actorEndpointConfig = component.createEndpoint("akka://test/user/$a?autoAck=false&replyTimeout=987000000+nanos").asInstanceOf[ActorEndpointConfig] - actorEndpointConfig must have( + actorEndpointConfig should have( 'endpointUri("akka://test/user/$a?autoAck=false&replyTimeout=987000000+nanos"), 'path(ActorEndpointPath.fromCamelPath("akka://test/user/$a")), 'autoAck(false), diff --git a/akka-camel/src/test/scala/akka/camel/internal/component/ActorEndpointPathTest.scala b/akka-camel/src/test/scala/akka/camel/internal/component/ActorEndpointPathTest.scala index a98ffc9fd0..592354742e 100644 --- a/akka-camel/src/test/scala/akka/camel/internal/component/ActorEndpointPathTest.scala +++ b/akka-camel/src/test/scala/akka/camel/internal/component/ActorEndpointPathTest.scala @@ -5,22 +5,22 @@ package akka.camel.internal.component import org.scalatest.mock.MockitoSugar -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.camel.TestSupport.SharedCamelSystem import org.scalatest.WordSpec import akka.actor.{ Actor, Props } -class ActorEndpointPathTest extends WordSpec with SharedCamelSystem with MustMatchers with MockitoSugar { +class ActorEndpointPathTest extends WordSpec with SharedCamelSystem with Matchers with MockitoSugar { def find(path: String) = ActorEndpointPath.fromCamelPath(path).findActorIn(system) "findActorIn returns Some(actor ref) if actor exists" in { val path = system.actorOf(Props(new Actor { def receive = { case _ ⇒ } }), "knownactor").path - find(path.toString) must be('defined) + find(path.toString) should be('defined) } "findActorIn returns None" when { - "non existing valid path" in { find("akka://system/user/unknownactor") must be(None) } + "non existing valid path" in { find("akka://system/user/unknownactor") should be(None) } } "fromCamelPath throws IllegalArgumentException" when { "invalid path" in { diff --git a/akka-camel/src/test/scala/akka/camel/internal/component/ActorProducerTest.scala b/akka-camel/src/test/scala/akka/camel/internal/component/ActorProducerTest.scala index baab9c54a8..b4b4bd9f49 100644 --- a/akka-camel/src/test/scala/akka/camel/internal/component/ActorProducerTest.scala +++ b/akka-camel/src/test/scala/akka/camel/internal/component/ActorProducerTest.scala @@ -17,8 +17,8 @@ import internal.{ DefaultCamel, CamelExchangeAdapter } import org.scalatest.{ Suite, WordSpecLike, BeforeAndAfterAll, BeforeAndAfterEach } import akka.camel.TestSupport._ import java.util.concurrent.{ TimeoutException, CountDownLatch, TimeUnit } -import org.mockito.{ ArgumentMatcher, Matchers, Mockito } -import org.scalatest.matchers.MustMatchers +import org.mockito.{ ArgumentMatcher, Matchers ⇒ MMatchers, Mockito } +import org.scalatest.Matchers import akka.actor.Status.{ Success, Failure } import com.typesafe.config.ConfigFactory import akka.actor.ActorSystem.Settings @@ -30,7 +30,7 @@ import akka.util.Timeout import akka.actor._ import akka.testkit._ -class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike with MustMatchers with ActorProducerFixture { +class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike with Matchers with ActorProducerFixture { implicit val timeout = Timeout(10 seconds) "ActorProducer" when { @@ -55,7 +55,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w } "not expect response and not block" taggedAs TimingTest in { - time(producer.processExchangeAdapter(exchange)) must be < (200 millis) + time(producer.processExchangeAdapter(exchange)) should be < (200 millis) } } @@ -128,7 +128,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w "timeout after replyTimeout" taggedAs TimingTest in { val duration = process() - duration must (be >= (100 millis) and be < (300 millis)) + duration should (be >= (100 millis) and be < (300 millis)) } "never set the response on exchange" in { @@ -175,7 +175,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w probe.expectMsgType[CamelMessage] probe.sender ! "some message" } - doneSync must be(false) + doneSync should be(false) info("done async") asyncCallback.expectDoneAsyncWithin(1 second) @@ -209,9 +209,9 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w producer = given(outCapable = true, replyTimeout = 10 millis) producer.processExchangeAdapter(exchange, asyncCallback) asyncCallback.awaitCalled(100 millis) - verify(exchange).setFailure(Matchers.argThat(new ArgumentMatcher[FailureResult] { + verify(exchange).setFailure(MMatchers.argThat(new ArgumentMatcher[FailureResult] { def matches(failure: AnyRef) = { - failure.asInstanceOf[FailureResult].cause must be(anInstanceOf[TimeoutException]) + failure.asInstanceOf[FailureResult].cause should be(anInstanceOf[TimeoutException]) true } @@ -237,7 +237,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w producer = given(outCapable = false, autoAck = true) val doneSync = producer.processExchangeAdapter(exchange, asyncCallback) - doneSync must be(true) + doneSync should be(true) info("done sync") asyncCallback.expectDoneSyncWithin(1 second) info("async callback called") @@ -255,7 +255,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w val doneSync = producer.processExchangeAdapter(exchange, asyncCallback) - doneSync must be(false) + doneSync should be(false) within(1 second) { probe.expectMsgType[CamelMessage] info("message sent to consumer") @@ -306,7 +306,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w val doneSync = producer.processExchangeAdapter(exchange, asyncCallback) - doneSync must be(false) + doneSync should be(false) within(1 second) { probe.expectMsgType[CamelMessage] info("message sent to consumer") @@ -325,7 +325,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w } } -private[camel] trait ActorProducerFixture extends MockitoSugar with BeforeAndAfterAll with BeforeAndAfterEach { self: TestKit with MustMatchers with Suite ⇒ +private[camel] trait ActorProducerFixture extends MockitoSugar with BeforeAndAfterAll with BeforeAndAfterEach { self: TestKit with Matchers with Suite ⇒ var camel: Camel = _ var exchange: CamelExchangeAdapter = _ var callback: AsyncCallback = _ diff --git a/akka-camel/src/test/scala/akka/camel/internal/component/DurationConverterTest.scala b/akka-camel/src/test/scala/akka/camel/internal/component/DurationConverterTest.scala index 83bf137af3..24a102b0f6 100644 --- a/akka-camel/src/test/scala/akka/camel/internal/component/DurationConverterTest.scala +++ b/akka-camel/src/test/scala/akka/camel/internal/component/DurationConverterTest.scala @@ -6,36 +6,36 @@ package akka.camel.internal.component import language.postfixOps -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.duration._ import org.scalatest.WordSpec import org.apache.camel.TypeConversionException -class DurationConverterSpec extends WordSpec with MustMatchers { +class DurationConverterSpec extends WordSpec with Matchers { import DurationTypeConverter._ "DurationTypeConverter must convert '10 nanos'" in { - convertTo(classOf[Duration], "10 nanos") must be(10 nanos) + convertTo(classOf[Duration], "10 nanos") should be(10 nanos) } "DurationTypeConverter must do the roundtrip" in { - convertTo(classOf[Duration], (10 seconds).toString()) must be(10 seconds) + convertTo(classOf[Duration], (10 seconds).toString()) should be(10 seconds) } "DurationTypeConverter must throw if invalid format" in { - tryConvertTo(classOf[Duration], "abc nanos") must be === null + tryConvertTo(classOf[Duration], "abc nanos") should equal(null) intercept[TypeConversionException] { - mandatoryConvertTo(classOf[Duration], "abc nanos") must be(10 nanos) - }.getValue must be === "abc nanos" + mandatoryConvertTo(classOf[Duration], "abc nanos") should be(10 nanos) + }.getValue should equal("abc nanos") } "DurationTypeConverter must throw if doesn't end with time unit" in { - tryConvertTo(classOf[Duration], "10233") must be === null + tryConvertTo(classOf[Duration], "10233") should equal(null) intercept[TypeConversionException] { - mandatoryConvertTo(classOf[Duration], "10233") must be(10 nanos) - }.getValue must be === "10233" + mandatoryConvertTo(classOf[Duration], "10233") should be(10 nanos) + }.getValue should equal("10233") } } diff --git a/akka-channels-tests/src/test/scala/akka/channels/ChannelSpec.scala b/akka-channels-tests/src/test/scala/akka/channels/ChannelSpec.scala index 50c46781c6..8b5f79a613 100644 --- a/akka-channels-tests/src/test/scala/akka/channels/ChannelSpec.scala +++ b/akka-channels-tests/src/test/scala/akka/channels/ChannelSpec.scala @@ -129,10 +129,10 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, val ref = ChannelExt(system).actorOf(new Tester, "t1") ref <-!- A expectMsg(C) - lastSender must be(ref.actorRef) + lastSender should be(ref.actorRef) ref <-!- B expectMsg(D) - lastSender must be(ref.actorRef) + lastSender should be(ref.actorRef) } "select return channels" in { @@ -140,7 +140,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, implicit val selfChannel = ChannelExt(system).actorOf(new RecvC(testActor), "t3") ref <-!- A expectMsg(C) - lastSender must be(selfChannel.actorRef) + lastSender should be(selfChannel.actorRef) } "correctly dispatch to subchannels" in { @@ -148,7 +148,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, implicit val selfChannel = ChannelExt(system).actorOf(new RecvC(testActor), "t5") ref <-!- A2 expectMsg(C1) - lastSender must be(selfChannel.actorRef) + lastSender should be(selfChannel.actorRef) } "not permit wrong message type" in { @@ -159,7 +159,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val c = new ChannelRef[TNil](null) |new ChannelRef[(A, C) :+: TNil](null) <-!- B """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B.type") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B.type") } "not permit wrong message type in complex channel" in { @@ -170,7 +170,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val c = new ChannelRef[TNil](null) |new ChannelRef[(A, C) :+: (B, D) :+: TNil](null) <-!- C """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.C.type") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.C.type") } "not permit unfit sender ref" in { @@ -181,7 +181,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[(C, D) :+: TNil](null) |new ChannelRef[(A, B) :+: TNil](null) <-!- A """.stripMargin) - }.message must include("implicit sender `s` does not support messages of the reply types akka.channels.ChannelSpec.B") + }.message should include("implicit sender `s` does not support messages of the reply types akka.channels.ChannelSpec.B") } "permit any sender for Nothing replies" in { @@ -198,7 +198,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[TNil](null) |new ChannelRef[(A, B) :+: (A, C) :+: TNil](null) <-!- A """.stripMargin) - }.message must include("implicit sender `s` does not support messages of the reply types akka.channels.ChannelSpec.B, akka.channels.ChannelSpec.C") + }.message should include("implicit sender `s` does not support messages of the reply types akka.channels.ChannelSpec.B, akka.channels.ChannelSpec.C") } "verify ping-pong chains" in { @@ -209,7 +209,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[(B, B) :+: TNil](null) |new ChannelRef[(A, B) :+: (B, C) :+: TNil](null) <-!- A """.stripMargin) - }.message must include("implicit sender `s` does not support messages of the reply types akka.channels.ChannelSpec.C") + }.message should include("implicit sender `s` does not support messages of the reply types akka.channels.ChannelSpec.C") } "tolerate infinite ping-pong" in { @@ -223,7 +223,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, } def cause(ex: Throwable): Throwable = if (ex.getCause == null) ex else cause(ex.getCause) - cause(ex).getClass must be(classOf[NullPointerException]) + cause(ex).getClass should be(classOf[NullPointerException]) } "not permit nonsensical channel declarations" in { @@ -237,7 +237,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, | } |} """.stripMargin) - }.message must include("no channel defined for types akka.channels.ChannelSpec.B") + }.message should include("no channel defined for types akka.channels.ChannelSpec.B") } "not permit subchannel replies" in { @@ -251,7 +251,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, | } |} """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.C.type") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.C.type") } "not permit Nothing children" in { @@ -264,7 +264,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, | createChild(new Actor with Channels[Nothing, Nothing] {}) |} """.stripMargin) - }.message must include("Parent argument must not be Nothing") + }.message should include("Parent argument must not be Nothing") } "not permit too demanding children" in { @@ -277,7 +277,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, | createChild(new Actor with Channels[(B, Nothing) :+: TNil, TNil] {}) |} """.stripMargin) - }.message must include("This actor cannot support a child requiring channels akka.channels.ChannelSpec.B") + }.message should include("This actor cannot support a child requiring channels akka.channels.ChannelSpec.B") } "have a working selfChannel" in { @@ -303,7 +303,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |import ChannelSpec._ |null.asInstanceOf[ChannelExtension].actorOf(new Actor with Channels[(A, A) :+: TNil, (A, Nothing) :+: TNil] {}, "") """.stripMargin) - }.message must include("type mismatch") + }.message should include("type mismatch") } "not permit sending wrong things to parents" in { @@ -317,7 +317,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, | }) |} """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B.type") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B.type") } "support narrowing of references" in { @@ -332,7 +332,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |import ChannelSpec._ |new ChannelRef[(A, C) :+: TNil](null).narrow[(A, C) :+: (B, C) :+: TNil] """.stripMargin) - }.message must include("original ChannelRef does not support input type akka.channels.ChannelSpec.B") + }.message should include("original ChannelRef does not support input type akka.channels.ChannelSpec.B") } "not allow narrowed refs to widen channels" in { @@ -342,7 +342,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |import ChannelSpec._ |new ChannelRef[(A1.type, C) :+: TNil](null).narrow[(A, C) :+: TNil] """.stripMargin) - }.message must include("original ChannelRef does not support input type akka.channels.ChannelSpec.A") + }.message should include("original ChannelRef does not support input type akka.channels.ChannelSpec.A") } "not allow narrowed refs to miss reply channels" in { @@ -352,7 +352,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |import ChannelSpec._ |new ChannelRef[(A, C) :+: (A, D) :+: TNil](null).narrow[(A, C) :+: TNil] """.stripMargin) - }.message must include("reply types akka.channels.ChannelSpec.D not covered for channel akka.channels.ChannelSpec.A") + }.message should include("reply types akka.channels.ChannelSpec.D not covered for channel akka.channels.ChannelSpec.A") } "not allow narrowed refs to narrow reply channels" in { @@ -362,7 +362,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |import ChannelSpec._ |new ChannelRef[(A, C) :+: (B, D) :+: TNil](null).narrow[(A, C) :+: (A, Nothing) :+: TNil] """.stripMargin) - }.message must include("reply types Nothing are superfluous for channel akka.channels.ChannelSpec.A") + }.message should include("reply types Nothing are superfluous for channel akka.channels.ChannelSpec.A") } "support narrowing ActorRefs" in { @@ -383,12 +383,12 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, import system.dispatcher val f = ref.narrow[(D, Nothing) :+: TNil] Await.ready(f, t.duration) - f.value.get must be(Failure(NarrowingException("original ChannelRef does not support input type akka.channels.ChannelSpec.D"))) + f.value.get should be(Failure(NarrowingException("original ChannelRef does not support input type akka.channels.ChannelSpec.D"))) } "be equal according to its actor" in { val c1, c2 = new ChannelRef[TNil](testActor) - c1 must be === c2 + c1 should equal(c2) } "allow wrapping of ChannelRefs with pass-through" in { @@ -396,10 +396,10 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, val wrap = ChannelExt(system).actorOf(new WriteOnly[C, Nothing](target), "t18") wrap <-!- C expectMsg(C) - lastSender must be(target.actorRef) + lastSender should be(target.actorRef) wrap <-!- D expectMsg(D) - lastSender must be(wrap.actorRef) + lastSender should be(wrap.actorRef) } "allow wrapping of Actor with ChannelsRefs with replies" in { @@ -416,14 +416,14 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, val t = ChannelExt(system).actorOf(new Tester, "t21") implicit val timeout = Timeout(1.second) val r: Future[C] = t <-?- A - Await.result(r, 1.second) must be(C) + Await.result(r, 1.second) should be(C) } "support typed ask with multiple reply channels" in { val t = ChannelExt(system).actorOf(new SubChannels, "t22") implicit val timeout = Timeout(1.second) val r: Future[Msg] = (t <-?- A1).lub - Await.result(r, 1.second) must be(B) + Await.result(r, 1.second) should be(B) } "check that channels do not erase to the same types" in { @@ -437,8 +437,8 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |} """.stripMargin) }.message - m must include("erasure List[Any] overlaps with declared channels List[akka.channels.ChannelSpec.A]") - m must include("erasure List[Any] overlaps with declared channels List[akka.channels.ChannelSpec.B]") + m should include("erasure List[Any] overlaps with declared channels List[akka.channels.ChannelSpec.A]") + m should include("erasure List[Any] overlaps with declared channels List[akka.channels.ChannelSpec.B]") } "check that all channels were declared" in { @@ -454,9 +454,9 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, })) } val m = expectMsgType[ActorInitializationException].getMessage - m must include("missing declarations for channels") - m must include("akka.channels.ChannelSpec.A") - m must include("akka.channels.ChannelSpec.B") + m should include("missing declarations for channels") + m should include("akka.channels.ChannelSpec.A") + m should include("akka.channels.ChannelSpec.B") } "be able to forward fully generic channels" in { @@ -468,7 +468,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, expectMsg(A) t <-!- C expectMsg(D) - lastSender must be === t.actorRef + lastSender should equal(t.actorRef) } "not wrap Futures unnecessarily" in { @@ -531,7 +531,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[(Any, Nothing) :+: TNil](null) |new ChannelRef[(A, Nothing) :+: TNil](null) <-!- new WrappedMessage[(B, Nothing) :+: (A, Nothing) :+: TNil, Msg](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } "sending wrong first indirectly" in { intercept[ToolBoxError] { @@ -541,7 +541,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[(Any, Nothing) :+: TNil](null) |new WrappedMessage[(B, Nothing) :+: (A, Nothing) :+: TNil, Msg](null) -!-> new ChannelRef[(A, Nothing) :+: TNil](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } "sending wrong second directly" in { intercept[ToolBoxError] { @@ -551,7 +551,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[(Any, Nothing) :+: TNil](null) |new ChannelRef[(A, Nothing) :+: TNil](null) <-!- new WrappedMessage[(A, Nothing) :+: (B, Nothing) :+: TNil, Msg](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } "sending wrong second indirectly" in { intercept[ToolBoxError] { @@ -561,7 +561,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val s = new ChannelRef[(Any, Nothing) :+: TNil](null) |new WrappedMessage[(A, Nothing) :+: (B, Nothing) :+: TNil, Msg](null) -!-> new ChannelRef[(A, Nothing) :+: TNil](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } } @@ -572,14 +572,14 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, val fa = Future successful a val b = new WrappedMessage[(A, Nothing) :+:(B, Nothing) :+: TNil, Msg](B) val fb = Future successful b - (Await.result(t <-?- a, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(C) - (Await.result(a -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(C) - (Await.result(t <-?- b, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(D) - (Await.result(b -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(D) - (Await.result(t <-?- fa, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(C) - (Await.result(fa -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(C) - (Await.result(t <-?- fb, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(D) - (Await.result(fb -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value must be(D) + (Await.result(t <-?- a, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(C) + (Await.result(a -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(C) + (Await.result(t <-?- b, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(D) + (Await.result(b -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(D) + (Await.result(t <-?- fa, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(C) + (Await.result(fa -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(C) + (Await.result(t <-?- fb, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(D) + (Await.result(fb -?-> t, timeout.duration): WrappedMessage[(C, Nothing) :+: (D, Nothing) :+: TNil, Msg]).value should be(D) } "not be askable with wrong channels" when { @@ -591,7 +591,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val t = akka.util.Timeout(null) |new ChannelRef[(A, Nothing) :+: TNil](null) <-?- new WrappedMessage[(B, Nothing) :+: (A, Nothing) :+: TNil, Msg](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } "sending wrong first indirectly" in { intercept[ToolBoxError] { @@ -601,7 +601,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val t = akka.util.Timeout(null) |new WrappedMessage[(B, Nothing) :+: (A, Nothing) :+: TNil, Msg](null) -?-> new ChannelRef[(A, Nothing) :+: TNil](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } "sending wrong second directly" in { intercept[ToolBoxError] { @@ -611,7 +611,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val t = akka.util.Timeout(null) |new ChannelRef[(A, Nothing) :+: TNil](null) <-?- new WrappedMessage[(A, Nothing) :+: (B, Nothing) :+: TNil, Msg](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } "sending wrong second indirectly" in { intercept[ToolBoxError] { @@ -621,7 +621,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |implicit val t = akka.util.Timeout(null) |new WrappedMessage[(A, Nothing) :+: (B, Nothing) :+: TNil, Msg](null) -?-> new ChannelRef[(A, Nothing) :+: TNil](null) """.stripMargin) - }.message must include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") + }.message should include("target ChannelRef does not support messages of types akka.channels.ChannelSpec.B (at depth 1)") } } @@ -629,7 +629,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, implicit val timeout = Timeout(1.second) val t = ChannelExt(system).actorOf(new Tester, "t31") val a = new WrappedMessage[(A, Nothing) :+:(B, Nothing) :+: TNil, Msg](A) - (Await.result((a -?-> t).lub, timeout.duration): Msg) must be(C) + (Await.result((a -?-> t).lub, timeout.duration): Msg) should be(C) } "not be LUBbable if not wrapped" in { @@ -640,7 +640,7 @@ class ChannelSpec extends AkkaSpec(ActorSystem("ChannelSpec", AkkaSpec.testConf, |import scala.concurrent.Future |null.asInstanceOf[Future[Int]].lub """.stripMargin) - }.message must include("Cannot prove that Int <:< akka.channels.WrappedMessage") + }.message should include("Cannot prove that Int <:< akka.channels.WrappedMessage") } } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUnreachableSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUnreachableSpec.scala index 8988953d3a..27e1555b16 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUnreachableSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUnreachableSpec.scala @@ -53,7 +53,7 @@ abstract class ClientDowningNodeThatIsUnreachableSpec(multiNodeConfig: ClientDow enterBarrier("down-third-node") awaitMembersUp(numberOfMembers = 3, canNotBePartOfMemberRing = Set(thirdAddress)) - clusterView.members.exists(_.address == thirdAddress) must be(false) + clusterView.members.exists(_.address == thirdAddress) should be(false) } runOn(third) { diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUpSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUpSpec.scala index e11d0da743..1fb157d29c 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUpSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUpSpec.scala @@ -52,7 +52,7 @@ abstract class ClientDowningNodeThatIsUpSpec(multiNodeConfig: ClientDowningNodeT markNodeAsUnavailable(thirdAddress) awaitMembersUp(numberOfMembers = 3, canNotBePartOfMemberRing = Set(thirdAddress)) - clusterView.members.exists(_.address == thirdAddress) must be(false) + clusterView.members.exists(_.address == thirdAddress) should be(false) } runOn(third) { diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterAccrualFailureDetectorSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterAccrualFailureDetectorSpec.scala index 4e0e12a743..fac4019e6f 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterAccrualFailureDetectorSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterAccrualFailureDetectorSpec.scala @@ -40,9 +40,9 @@ abstract class ClusterAccrualFailureDetectorSpec awaitClusterUp(first, second, third) Thread.sleep(5.seconds.dilated.toMillis) // let them heartbeat - cluster.failureDetector.isAvailable(first) must be(true) - cluster.failureDetector.isAvailable(second) must be(true) - cluster.failureDetector.isAvailable(third) must be(true) + cluster.failureDetector.isAvailable(first) should be(true) + cluster.failureDetector.isAvailable(second) should be(true) + cluster.failureDetector.isAvailable(third) should be(true) enterBarrier("after-1") } @@ -59,14 +59,14 @@ abstract class ClusterAccrualFailureDetectorSpec // detect failure... awaitCond(!cluster.failureDetector.isAvailable(second), 15.seconds) // other connections still ok - cluster.failureDetector.isAvailable(third) must be(true) + cluster.failureDetector.isAvailable(third) should be(true) } runOn(second) { // detect failure... awaitCond(!cluster.failureDetector.isAvailable(first), 15.seconds) // other connections still ok - cluster.failureDetector.isAvailable(third) must be(true) + cluster.failureDetector.isAvailable(third) should be(true) } enterBarrier("partitioned") @@ -99,8 +99,8 @@ abstract class ClusterAccrualFailureDetectorSpec // remaning nodes should detect failure... awaitCond(!cluster.failureDetector.isAvailable(third), 15.seconds) // other connections still ok - cluster.failureDetector.isAvailable(first) must be(true) - cluster.failureDetector.isAvailable(second) must be(true) + cluster.failureDetector.isAvailable(first) should be(true) + cluster.failureDetector.isAvailable(second) should be(true) } enterBarrier("after-3") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterDeathWatchSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterDeathWatchSpec.scala index 06ec9dfc74..3b51dfe3b1 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterDeathWatchSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterDeathWatchSpec.scala @@ -103,11 +103,11 @@ abstract class ClusterDeathWatchSpec enterBarrier("second-terminated") markNodeAsUnavailable(third) - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(third))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(third))) cluster.down(third) // removed - awaitAssert(clusterView.members.map(_.address) must not contain (address(third))) - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (address(third))) + awaitAssert(clusterView.members.map(_.address) should not contain (address(third))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (address(third))) expectMsg(path3) enterBarrier("third-terminated") @@ -119,11 +119,11 @@ abstract class ClusterDeathWatchSpec enterBarrier("watch-established") runOn(third) { markNodeAsUnavailable(second) - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(second))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(second))) cluster.down(second) // removed - awaitAssert(clusterView.members.map(_.address) must not contain (address(second))) - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (address(second))) + awaitAssert(clusterView.members.map(_.address) should not contain (address(second))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (address(second))) } enterBarrier("second-terminated") enterBarrier("third-terminated") @@ -171,7 +171,7 @@ abstract class ClusterDeathWatchSpec // fifth is not cluster member, so the watch is handled by the RemoteWatcher awaitAssert { remoteWatcher ! RemoteWatcher.Stats - expectMsgType[RemoteWatcher.Stats].watchingRefs must contain((subject5, testActor)) + expectMsgType[RemoteWatcher.Stats].watchingRefs should contain((subject5, testActor)) } } enterBarrier("remote-watch") @@ -186,7 +186,7 @@ abstract class ClusterDeathWatchSpec remoteWatcher ! RemoteWatcher.Stats expectMsgType[RemoteWatcher.Stats].watchingRefs.map { case (watchee, watcher) ⇒ watchee.path.name - } must not contain ("subject5") + } should not contain ("subject5") } } @@ -194,16 +194,16 @@ abstract class ClusterDeathWatchSpec runOn(fourth) { markNodeAsUnavailable(fifth) - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(fifth))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(fifth))) cluster.down(fifth) // removed - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (address(fifth))) - awaitAssert(clusterView.members.map(_.address) must not contain (address(fifth))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (address(fifth))) + awaitAssert(clusterView.members.map(_.address) should not contain (address(fifth))) } enterBarrier("fifth-terminated") runOn(first) { - expectMsgType[Terminated].actor.path.name must be("subject5") + expectMsgType[Terminated].actor.path.name should be("subject5") } enterBarrier("after-3") @@ -220,17 +220,17 @@ abstract class ClusterDeathWatchSpec runOn(fourth) { val hello = system.actorOf(Props[Hello], "hello") - hello.isInstanceOf[RemoteActorRef] must be(true) - hello.path.address must be(address(first)) + hello.isInstanceOf[RemoteActorRef] should be(true) + hello.path.address should be(address(first)) watch(hello) enterBarrier("hello-deployed") markNodeAsUnavailable(first) - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(first))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(first))) cluster.down(first) // removed - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (address(first))) - awaitAssert(clusterView.members.map(_.address) must not contain (address(first))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (address(first))) + awaitAssert(clusterView.members.map(_.address) should not contain (address(first))) expectTerminated(hello) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsDisabledSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsDisabledSpec.scala index 0bfc0a5975..e7affad044 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsDisabledSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsDisabledSpec.scala @@ -23,11 +23,11 @@ abstract class ClusterMetricsDisabledSpec extends MultiNodeSpec(ClusterMetricsDi "Cluster metrics" must { "not collect metrics, not publish ClusterMetricsChanged, and not gossip metrics" taggedAs LongRunningTest in { awaitClusterUp(roles: _*) - clusterView.clusterMetrics.size must be(0) + clusterView.clusterMetrics.size should be(0) cluster.subscribe(testActor, classOf[ClusterMetricsChanged]) expectMsgType[CurrentClusterState] expectNoMsg - clusterView.clusterMetrics.size must be(0) + clusterView.clusterMetrics.size should be(0) enterBarrier("after") } } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsSpec.scala index fa7b8fe89c..04f6900183 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ClusterMetricsSpec.scala @@ -38,10 +38,10 @@ abstract class ClusterMetricsSpec extends MultiNodeSpec(ClusterMetricsMultiJvmSp "and gossip metrics around the node ring" taggedAs LongRunningTest in within(60 seconds) { awaitClusterUp(roles: _*) enterBarrier("cluster-started") - awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) must be(roles.size)) - awaitAssert(clusterView.clusterMetrics.size must be(roles.size)) + awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) should be(roles.size)) + awaitAssert(clusterView.clusterMetrics.size should be(roles.size)) val collector = MetricsCollector(cluster.system, cluster.settings) - collector.sample.metrics.size must be > (3) + collector.sample.metrics.size should be > (3) enterBarrier("after") } "reflect the correct number of node metrics in cluster view" taggedAs LongRunningTest in within(30 seconds) { @@ -51,7 +51,7 @@ abstract class ClusterMetricsSpec extends MultiNodeSpec(ClusterMetricsMultiJvmSp enterBarrier("first-left") runOn(second, third, fourth, fifth) { markNodeAsUnavailable(first) - awaitAssert(clusterView.clusterMetrics.size must be(roles.size - 1)) + awaitAssert(clusterView.clusterMetrics.size should be(roles.size - 1)) } enterBarrier("finished") } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/ConvergenceSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/ConvergenceSpec.scala index 1b932b9a31..d88cad5e8c 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/ConvergenceSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/ConvergenceSpec.scala @@ -69,12 +69,12 @@ abstract class ConvergenceSpec(multiNodeConfig: ConvergenceMultiNodeConfig) within(28 seconds) { // third becomes unreachable - awaitAssert(clusterView.unreachableMembers.size must be(1)) + awaitAssert(clusterView.unreachableMembers.size should be(1)) awaitSeenSameState(first, second) // still one unreachable - clusterView.unreachableMembers.size must be(1) - clusterView.unreachableMembers.head.address must be(thirdAddress) - clusterView.members.size must be(3) + clusterView.unreachableMembers.size should be(1) + clusterView.unreachableMembers.head.address should be(thirdAddress) + clusterView.members.size should be(3) } } @@ -95,11 +95,11 @@ abstract class ConvergenceSpec(multiNodeConfig: ConvergenceMultiNodeConfig) runOn(first, second, fourth) { for (n ← 1 to 5) { - awaitAssert(clusterView.members.size must be(3)) + awaitAssert(clusterView.members.size should be(3)) awaitSeenSameState(first, second, fourth) - memberStatus(first) must be(Some(MemberStatus.Up)) - memberStatus(second) must be(Some(MemberStatus.Up)) - memberStatus(fourth) must be(None) + memberStatus(first) should be(Some(MemberStatus.Up)) + memberStatus(second) should be(Some(MemberStatus.Up)) + memberStatus(fourth) should be(None) // wait and then check again Thread.sleep(1.second.dilated.toMillis) } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/DisallowJoinOfTwoClustersSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/DisallowJoinOfTwoClustersSpec.scala index a729de52d6..28d3abd477 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/DisallowJoinOfTwoClustersSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/DisallowJoinOfTwoClustersSpec.scala @@ -67,7 +67,7 @@ abstract class DisallowJoinOfTwoClustersSpec // no change expected 1 to 5 foreach { _ ⇒ - clusterView.members.size must be(expectedSize) + clusterView.members.size should be(expectedSize) Thread.sleep(1000) } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/InitialHeartbeatSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/InitialHeartbeatSpec.scala index fa7379e18d..4c2801195e 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/InitialHeartbeatSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/InitialHeartbeatSpec.scala @@ -50,7 +50,7 @@ abstract class InitialHeartbeatSpec within(10 seconds) { awaitAssert({ cluster.sendCurrentClusterState(testActor) - expectMsgType[CurrentClusterState].members.map(_.address) must contain(secondAddress) + expectMsgType[CurrentClusterState].members.map(_.address) should contain(secondAddress) }, interval = 50.millis) } } @@ -59,7 +59,7 @@ abstract class InitialHeartbeatSpec within(10 seconds) { awaitAssert({ cluster.sendCurrentClusterState(testActor) - expectMsgType[CurrentClusterState].members.map(_.address) must contain(firstAddress) + expectMsgType[CurrentClusterState].members.map(_.address) should contain(firstAddress) }, interval = 50.millis) } } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/JoinInProgressSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/JoinInProgressSpec.scala index ed0a667a8b..e862aef65b 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/JoinInProgressSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/JoinInProgressSpec.scala @@ -54,7 +54,7 @@ abstract class JoinInProgressSpec val until = Deadline.now + 5.seconds while (!until.isOverdue) { Thread.sleep(200) - cluster.failureDetector.isAvailable(second) must be(true) + cluster.failureDetector.isAvailable(second) should be(true) } } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderElectionSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderElectionSpec.scala index 4f0f2fea3f..ffff88ac8d 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderElectionSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderElectionSpec.scala @@ -51,7 +51,7 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig awaitClusterUp(first, second, third, fourth) if (myself != controller) { - clusterView.isLeader must be(myself == sortedRoles.head) + clusterView.isLeader should be(myself == sortedRoles.head) assertLeaderIn(sortedRoles) } @@ -60,7 +60,7 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig def shutdownLeaderAndVerifyNewLeader(alreadyShutdown: Int): Unit = { val currentRoles = sortedRoles.drop(alreadyShutdown) - currentRoles.size must be >= (2) + currentRoles.size should be >= (2) val leader = currentRoles.head val aUser = currentRoles.last val remainingRoles = currentRoles.tail @@ -84,13 +84,13 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig // detect failure markNodeAsUnavailable(leaderAddress) - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(leaderAddress)) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(leaderAddress)) enterBarrier("after-unavailable" + n) // user marks the shutdown leader as DOWN cluster.down(leaderAddress) // removed - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (leaderAddress)) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (leaderAddress)) enterBarrier("after-down" + n, "completed" + n) case _ if remainingRoles.contains(myself) ⇒ @@ -98,13 +98,13 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig val leaderAddress = address(leader) enterBarrier("before-shutdown" + n, "after-shutdown" + n) - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(leaderAddress)) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(leaderAddress)) enterBarrier("after-unavailable" + n) enterBarrier("after-down" + n) awaitMembersUp(currentRoles.size - 1) val nextExpectedLeader = remainingRoles.head - clusterView.isLeader must be(myself == nextExpectedLeader) + clusterView.isLeader should be(myself == nextExpectedLeader) assertLeaderIn(remainingRoles) enterBarrier("completed" + n) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderLeavingSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderLeavingSpec.scala index 78848273b8..a8672cb1ac 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderLeavingSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderLeavingSpec.scala @@ -80,13 +80,13 @@ abstract class LeaderLeavingSpec markNodeAsUnavailable(oldLeaderAddress) // verify that the LEADER is no longer part of the 'members' set - awaitAssert(clusterView.members.map(_.address) must not contain (oldLeaderAddress)) + awaitAssert(clusterView.members.map(_.address) should not contain (oldLeaderAddress)) // verify that the LEADER is not part of the 'unreachable' set - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (oldLeaderAddress)) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (oldLeaderAddress)) // verify that we have a new LEADER - awaitAssert(clusterView.leader must not be (oldLeaderAddress)) + awaitAssert(clusterView.leader should not be (oldLeaderAddress)) } enterBarrier("finished") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/MBeanSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/MBeanSpec.scala index 504fd3af36..ad6dfe7cf3 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/MBeanSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/MBeanSpec.scala @@ -44,35 +44,35 @@ abstract class MBeanSpec "Cluster MBean" must { "expose attributes" taggedAs LongRunningTest in { val info = mbeanServer.getMBeanInfo(mbeanName) - info.getAttributes.map(_.getName).toSet must be(Set( + info.getAttributes.map(_.getName).toSet should be(Set( "ClusterStatus", "Members", "Unreachable", "MemberStatus", "Leader", "Singleton", "Available")) enterBarrier("after-1") } "expose operations" taggedAs LongRunningTest in { val info = mbeanServer.getMBeanInfo(mbeanName) - info.getOperations.map(_.getName).toSet must be(Set( + info.getOperations.map(_.getName).toSet should be(Set( "join", "leave", "down")) enterBarrier("after-2") } "change attributes after startup" taggedAs LongRunningTest in { runOn(first) { - mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] must be(false) - mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] must be(false) - mbeanServer.getAttribute(mbeanName, "Leader") must be("") - mbeanServer.getAttribute(mbeanName, "Members") must be("") - mbeanServer.getAttribute(mbeanName, "Unreachable") must be("") - mbeanServer.getAttribute(mbeanName, "MemberStatus") must be("Removed") + mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] should be(false) + mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should be(false) + mbeanServer.getAttribute(mbeanName, "Leader") should be("") + mbeanServer.getAttribute(mbeanName, "Members") should be("") + mbeanServer.getAttribute(mbeanName, "Unreachable") should be("") + mbeanServer.getAttribute(mbeanName, "MemberStatus") should be("Removed") } awaitClusterUp(first) runOn(first) { - awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") must be("Up")) - awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") must be(address(first).toString)) - mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] must be(true) - mbeanServer.getAttribute(mbeanName, "Members") must be(address(first).toString) - mbeanServer.getAttribute(mbeanName, "Unreachable") must be("") - mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] must be(true) + awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") should be("Up")) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") should be(address(first).toString)) + mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should be(true) + mbeanServer.getAttribute(mbeanName, "Members") should be(address(first).toString) + mbeanServer.getAttribute(mbeanName, "Unreachable") should be("") + mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] should be(true) } enterBarrier("after-3") } @@ -85,12 +85,12 @@ abstract class MBeanSpec awaitMembersUp(4) assertMembers(clusterView.members, roles.map(address(_)): _*) - awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") must be("Up")) + awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") should be("Up")) val expectedMembers = roles.sorted.map(address(_)).mkString(",") - awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") must be(expectedMembers)) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should be(expectedMembers)) val expectedLeader = address(roleOfLeader()) - awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") must be(expectedLeader.toString)) - mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] must be(false) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") should be(expectedLeader.toString)) + mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should be(false) enterBarrier("after-4") } @@ -104,9 +104,9 @@ abstract class MBeanSpec enterBarrier("fourth-shutdown") runOn(first, second, third) { - awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") must be(fourthAddress.toString)) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") should be(fourthAddress.toString)) val expectedMembers = Seq(first, second, third, fourth).sorted.map(address(_)).mkString(",") - awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") must be(expectedMembers)) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should be(expectedMembers)) } enterBarrier("fourth-unreachable") @@ -149,7 +149,7 @@ abstract class MBeanSpec // awaitAssert to make sure that all nodes detects unreachable within(15.seconds) { - awaitAssert(mbeanServer.getAttribute(mbeanName, "ClusterStatus") must be(expectedJson)) + awaitAssert(mbeanServer.getAttribute(mbeanName, "ClusterStatus") should be(expectedJson)) } } @@ -169,7 +169,7 @@ abstract class MBeanSpec runOn(first, second, third) { awaitMembersUp(3, canNotBePartOfMemberRing = Set(fourthAddress)) assertMembers(clusterView.members, first, second, third) - awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") must be("")) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") should be("")) } enterBarrier("after-6") @@ -184,7 +184,7 @@ abstract class MBeanSpec awaitMembersUp(2) assertMembers(clusterView.members, first, second) val expectedMembers = Seq(first, second).sorted.map(address(_)).mkString(",") - awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") must be(expectedMembers)) + awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should be(expectedMembers)) } runOn(third) { awaitCond(cluster.isTerminated) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/MinMembersBeforeUpSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/MinMembersBeforeUpSpec.scala index 84ef5624b7..24f0d62635 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/MinMembersBeforeUpSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/MinMembersBeforeUpSpec.scala @@ -94,12 +94,12 @@ abstract class MinMembersBeforeUpBase(multiNodeConfig: MultiNodeConfig) cluster join myself awaitAssert { clusterView.refreshCurrentState() - clusterView.status must be(Joining) + clusterView.status should be(Joining) } } enterBarrier("first-started") - onUpLatch.isOpen must be(false) + onUpLatch.isOpen should be(false) runOn(second) { cluster.join(first) @@ -108,14 +108,14 @@ abstract class MinMembersBeforeUpBase(multiNodeConfig: MultiNodeConfig) val expectedAddresses = Set(first, second) map address awaitAssert { clusterView.refreshCurrentState() - clusterView.members.map(_.address) must be(expectedAddresses) + clusterView.members.map(_.address) should be(expectedAddresses) } - clusterView.members.map(_.status) must be(Set(Joining)) + clusterView.members.map(_.status) should be(Set(Joining)) // and it should not change 1 to 5 foreach { _ ⇒ Thread.sleep(1000) - clusterView.members.map(_.address) must be(expectedAddresses) - clusterView.members.map(_.status) must be(Set(Joining)) + clusterView.members.map(_.address) should be(expectedAddresses) + clusterView.members.map(_.status) should be(Set(Joining)) } } enterBarrier("second-joined") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala index f1265cb481..4c6253d001 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala @@ -185,7 +185,7 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro def startClusterNode(): Unit = { if (clusterView.members.isEmpty) { cluster join myself - awaitAssert(clusterView.members.map(_.address) must contain(address(myself))) + awaitAssert(clusterView.members.map(_.address) should contain(address(myself))) } else clusterView.self } @@ -239,8 +239,8 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro def assertMembers(gotMembers: Iterable[Member], expectedAddresses: Address*): Unit = { import Member.addressOrdering val members = gotMembers.toIndexedSeq - members.size must be(expectedAddresses.length) - expectedAddresses.sorted.zipWithIndex.foreach { case (a, i) ⇒ members(i).address must be(a) } + members.size should be(expectedAddresses.length) + expectedAddresses.sorted.zipWithIndex.foreach { case (a, i) ⇒ members(i).address should be(a) } } /** @@ -266,13 +266,13 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro */ def assertLeaderIn(nodesInCluster: immutable.Seq[RoleName]): Unit = if (nodesInCluster.contains(myself)) { - nodesInCluster.length must not be (0) + nodesInCluster.length should not be (0) val expectedLeader = roleOfLeader(nodesInCluster) val leader = clusterView.leader val isLeader = leader == Some(clusterView.selfAddress) assert(isLeader == isNode(expectedLeader), "expectedLeader [%s], got leader [%s], members [%s]".format(expectedLeader, leader, clusterView.members)) - clusterView.status must (be(MemberStatus.Up) or be(MemberStatus.Leaving)) + clusterView.status should (be(MemberStatus.Up) or be(MemberStatus.Leaving)) } /** @@ -285,23 +285,23 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro timeout: FiniteDuration = 25.seconds): Unit = { within(timeout) { if (!canNotBePartOfMemberRing.isEmpty) // don't run this on an empty set - awaitAssert(canNotBePartOfMemberRing foreach (a ⇒ clusterView.members.map(_.address) must not contain (a))) - awaitAssert(clusterView.members.size must be(numberOfMembers)) - awaitAssert(clusterView.members.map(_.status) must be(Set(MemberStatus.Up))) + awaitAssert(canNotBePartOfMemberRing foreach (a ⇒ clusterView.members.map(_.address) should not contain (a))) + awaitAssert(clusterView.members.size should be(numberOfMembers)) + awaitAssert(clusterView.members.map(_.status) should be(Set(MemberStatus.Up))) // clusterView.leader is updated by LeaderChanged, await that to be updated also val expectedLeader = clusterView.members.headOption.map(_.address) - awaitAssert(clusterView.leader must be(expectedLeader)) + awaitAssert(clusterView.leader should be(expectedLeader)) } } def awaitAllReachable(): Unit = - awaitAssert(clusterView.unreachableMembers must be(Set.empty)) + awaitAssert(clusterView.unreachableMembers should be(Set.empty)) /** * Wait until the specified nodes have seen the same gossip overview. */ def awaitSeenSameState(addresses: Address*): Unit = - awaitAssert((addresses.toSet -- clusterView.seenBy) must be(Set.empty)) + awaitAssert((addresses.toSet -- clusterView.seenBy) should be(Set.empty)) /** * Leader according to the address ordering of the roles. @@ -312,7 +312,7 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro * be determined from the `RoleName`. */ def roleOfLeader(nodesInCluster: immutable.Seq[RoleName] = roles): RoleName = { - nodesInCluster.length must not be (0) + nodesInCluster.length should not be (0) nodesInCluster.sorted.head } @@ -341,7 +341,7 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro */ def markNodeAsUnavailable(address: Address): Unit = { if (isFailureDetectorPuppet) { - // before marking it as unavailble there must be at least one heartbeat + // before marking it as unavailble there should be at least one heartbeat // to create the FailureDetectorPuppet in the FailureDetectorRegistry cluster.failureDetector.heartbeat(address) failureDetectorPuppet(address) foreach (_.markNodeAsUnavailable()) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeLeavingAndExitingAndBeingRemovedSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeLeavingAndExitingAndBeingRemovedSpec.scala index 61973f979f..6fa507143a 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeLeavingAndExitingAndBeingRemovedSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeLeavingAndExitingAndBeingRemovedSpec.scala @@ -47,10 +47,10 @@ abstract class NodeLeavingAndExitingAndBeingRemovedSpec markNodeAsUnavailable(second) // verify that the 'second' node is no longer part of the 'members'/'unreachable' set awaitAssert { - clusterView.members.map(_.address) must not contain (address(second)) + clusterView.members.map(_.address) should not contain (address(second)) } awaitAssert { - clusterView.unreachableMembers.map(_.address) must not contain (address(second)) + clusterView.unreachableMembers.map(_.address) should not contain (address(second)) } } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeMembershipSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeMembershipSpec.scala index 383c3d9caf..f857355b30 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeMembershipSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeMembershipSpec.scala @@ -38,9 +38,9 @@ abstract class NodeMembershipSpec runOn(first, second) { cluster.join(first) - awaitAssert(clusterView.members.size must be(2)) + awaitAssert(clusterView.members.size should be(2)) assertMembers(clusterView.members, first, second) - awaitAssert(clusterView.members.map(_.status) must be(Set(MemberStatus.Up))) + awaitAssert(clusterView.members.map(_.status) should be(Set(MemberStatus.Up))) } enterBarrier("after-1") @@ -52,9 +52,9 @@ abstract class NodeMembershipSpec cluster.join(first) } - awaitAssert(clusterView.members.size must be(3)) + awaitAssert(clusterView.members.size should be(3)) assertMembers(clusterView.members, first, second, third) - awaitAssert(clusterView.members.map(_.status) must be(Set(MemberStatus.Up))) + awaitAssert(clusterView.members.map(_.status) should be(Set(MemberStatus.Up))) enterBarrier("after-2") } @@ -63,10 +63,10 @@ abstract class NodeMembershipSpec val firstMember = clusterView.members.find(_.address == address(first)).get val secondMember = clusterView.members.find(_.address == address(second)).get val thirdMember = clusterView.members.find(_.address == address(third)).get - firstMember.isOlderThan(thirdMember) must be(true) - thirdMember.isOlderThan(firstMember) must be(false) - secondMember.isOlderThan(thirdMember) must be(true) - thirdMember.isOlderThan(secondMember) must be(false) + firstMember.isOlderThan(thirdMember) should be(true) + thirdMember.isOlderThan(firstMember) should be(false) + secondMember.isOlderThan(thirdMember) should be(true) + thirdMember.isOlderThan(secondMember) should be(false) enterBarrier("after-3") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeUpSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeUpSpec.scala index 676eb6ae8b..b815f108bb 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeUpSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/NodeUpSpec.scala @@ -40,7 +40,7 @@ abstract class NodeUpSpec enterBarrier("first-join-attempt") Thread.sleep(2000) - clusterView.members must be(Set.empty) + clusterView.members should be(Set.empty) enterBarrier("after-0") } @@ -70,8 +70,8 @@ abstract class NodeUpSpec // let it run for a while to make sure that nothing bad happens for (n ← 1 to 20) { Thread.sleep(100.millis.dilated.toMillis) - unexpected.get must be(SortedSet.empty) - clusterView.members.forall(_.status == MemberStatus.Up) must be(true) + unexpected.get should be(SortedSet.empty) + clusterView.members.forall(_.status == MemberStatus.Up) should be(true) } enterBarrier("after-2") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/RestartFirstSeedNodeSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/RestartFirstSeedNodeSpec.scala index 1af9a1aea2..64c79af394 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/RestartFirstSeedNodeSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/RestartFirstSeedNodeSpec.scala @@ -89,8 +89,8 @@ abstract class RestartFirstSeedNodeSpec // now we can join seed1System, seed2, seed3 together runOn(seed1) { Cluster(seed1System).joinSeedNodes(seedNodes) - awaitAssert(Cluster(seed1System).readView.members.size must be(3)) - awaitAssert(Cluster(seed1System).readView.members.map(_.status) must be(Set(Up))) + awaitAssert(Cluster(seed1System).readView.members.size should be(3)) + awaitAssert(Cluster(seed1System).readView.members.map(_.status) should be(Set(Up))) } runOn(seed2, seed3) { cluster.joinSeedNodes(seedNodes) @@ -104,15 +104,15 @@ abstract class RestartFirstSeedNodeSpec } runOn(seed2, seed3) { awaitMembersUp(2, canNotBePartOfMemberRing = Set(seedNodes.head)) - awaitAssert(clusterView.unreachableMembers.map(_.address) must not contain (seedNodes.head)) + awaitAssert(clusterView.unreachableMembers.map(_.address) should not contain (seedNodes.head)) } enterBarrier("seed1-shutdown") // then start restartedSeed1System, which has the same address as seed1System runOn(seed1) { Cluster(restartedSeed1System).joinSeedNodes(seedNodes) - awaitAssert(Cluster(restartedSeed1System).readView.members.size must be(3)) - awaitAssert(Cluster(restartedSeed1System).readView.members.map(_.status) must be(Set(Up))) + awaitAssert(Cluster(restartedSeed1System).readView.members.size should be(3)) + awaitAssert(Cluster(restartedSeed1System).readView.members.map(_.status) should be(Set(Up))) } runOn(seed2, seed3) { awaitMembersUp(3) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/SingletonClusterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/SingletonClusterSpec.scala index 183baf8f9b..60a2c5cce1 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/SingletonClusterSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/SingletonClusterSpec.scala @@ -47,7 +47,7 @@ abstract class SingletonClusterSpec(multiNodeConfig: SingletonClusterMultiNodeCo runOn(first) { cluster.joinSeedNodes(Vector(first)) awaitMembersUp(1) - clusterView.isSingletonCluster must be(true) + clusterView.isSingletonCluster should be(true) } enterBarrier("after-1") @@ -55,7 +55,7 @@ abstract class SingletonClusterSpec(multiNodeConfig: SingletonClusterMultiNodeCo "not be singleton cluster when joined with other node" taggedAs LongRunningTest in { awaitClusterUp(first, second) - clusterView.isSingletonCluster must be(false) + clusterView.isSingletonCluster should be(false) assertLeader(first, second) enterBarrier("after-2") @@ -69,7 +69,7 @@ abstract class SingletonClusterSpec(multiNodeConfig: SingletonClusterMultiNodeCo markNodeAsUnavailable(secondAddress) awaitMembersUp(numberOfMembers = 1, canNotBePartOfMemberRing = Set(secondAddress), 30.seconds) - clusterView.isSingletonCluster must be(true) + clusterView.isSingletonCluster should be(true) awaitCond(clusterView.isLeader) } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala index bb79c241f5..8fb3ed3c2f 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/StressSpec.scala @@ -67,7 +67,7 @@ private[cluster] object StressMultiJvmSpec extends MultiNodeConfig { val totalNumberOfNodes = System.getProperty("MultiJvm.akka.cluster.Stress.nrOfNodes") match { case null ⇒ 13 - case value ⇒ value.toInt requiring (_ >= 10, "nrOfNodes must be >= 10") + case value ⇒ value.toInt requiring (_ >= 10, "nrOfNodes should be >= 10") } for (n ← 1 to totalNumberOfNodes) role("node-" + n) @@ -182,7 +182,7 @@ private[cluster] object StressMultiJvmSpec extends MultiNodeConfig { val numberOfNodesJoiningToSeedNodes = (totalNumberOfNodes - numberOfSeedNodes - numberOfNodesJoiningToSeedNodesInitially - numberOfNodesJoiningOneByOneSmall - numberOfNodesJoiningOneByOneLarge - numberOfNodesJoiningToOneNode) requiring (_ >= 0, - s"too many configured nr-of-nodes-joining-*, total must be <= ${totalNumberOfNodes}") + s"too many configured nr-of-nodes-joining-*, total should be <= ${totalNumberOfNodes}") val numberOfNodesLeavingOneByOneSmall = getInt("nr-of-nodes-leaving-one-by-one-small") * nFactor val numberOfNodesLeavingOneByOneLarge = getInt("nr-of-nodes-leaving-one-by-one-large") * nFactor val numberOfNodesLeaving = getInt("nr-of-nodes-leaving") * nFactor @@ -217,7 +217,7 @@ private[cluster] object StressMultiJvmSpec extends MultiNodeConfig { numberOfNodesShutdownOneByOneSmall + numberOfNodesShutdownOneByOneLarge + numberOfNodesShutdown <= totalNumberOfNodes - 3, s"specified number of leaving/shutdown nodes <= ${totalNumberOfNodes - 3}") - require(numberOfNodesJoinRemove <= totalNumberOfNodes, s"nr-of-nodes-join-remove must be <= ${totalNumberOfNodes}") + require(numberOfNodesJoinRemove <= totalNumberOfNodes, s"nr-of-nodes-join-remove should be <= ${totalNumberOfNodes}") override def toString: String = { testConfig.withFallback(ConfigFactory.parseString(s"nrOfNodes=${totalNumberOfNodes}")).root.render @@ -984,7 +984,7 @@ abstract class StressSpec } val nextAddresses = clusterView.members.map(_.address) -- usedAddresses runOn(usedRoles: _*) { - nextAddresses.size must be(numberOfNodesJoinRemove) + nextAddresses.size should be(numberOfNodesJoinRemove) } enterBarrier("join-remove-" + step) @@ -1021,7 +1021,7 @@ abstract class StressSpec def exerciseRouters(title: String, duration: FiniteDuration, batchInterval: FiniteDuration, expectDroppedMessages: Boolean, tree: Boolean): Unit = within(duration + 10.seconds) { - nbrUsedRoles must be(totalNumberOfNodes) + nbrUsedRoles should be(totalNumberOfNodes) createResultAggregator(title, expectedResults = nbrUsedRoles, includeInHistory = false) val (masterRoles, otherRoles) = roles.take(nbrUsedRoles).splitAt(3) @@ -1035,10 +1035,10 @@ abstract class StressSpec m.tell(End, testActor) } val workResult = awaitWorkResult - workResult.sendCount must be > (0L) - workResult.ackCount must be > (0L) + workResult.sendCount should be > (0L) + workResult.ackCount should be > (0L) if (!expectDroppedMessages) - workResult.retryCount must be(0) + workResult.retryCount should be(0) enterBarrier("routers-done-" + step) } @@ -1081,13 +1081,13 @@ abstract class StressSpec supervisor ! Props[RemoteChild].withDeploy(Deploy(scope = RemoteScope(address(r)))) } supervisor ! GetChildrenCount - expectMsgType[ChildrenCount] must be(ChildrenCount(nbrUsedRoles, 0)) + expectMsgType[ChildrenCount] should be(ChildrenCount(nbrUsedRoles, 0)) 1 to 5 foreach { _ ⇒ supervisor ! new RuntimeException("Simulated exception") } awaitAssert { supervisor ! GetChildrenCount val c = expectMsgType[ChildrenCount] - c must be(ChildrenCount(nbrUsedRoles, 5 * nbrUsedRoles)) + c should be(ChildrenCount(nbrUsedRoles, 5 * nbrUsedRoles)) } // after 5 restart attempts the children should be stopped @@ -1096,7 +1096,7 @@ abstract class StressSpec supervisor ! GetChildrenCount val c = expectMsgType[ChildrenCount] // zero children - c must be(ChildrenCount(0, 6 * nbrUsedRoles)) + c should be(ChildrenCount(0, 6 * nbrUsedRoles)) } supervisor ! Reset @@ -1118,9 +1118,9 @@ abstract class StressSpec def idleGossip(title: String): Unit = { createResultAggregator(title, expectedResults = nbrUsedRoles, includeInHistory = true) reportResult { - clusterView.members.size must be(nbrUsedRoles) + clusterView.members.size should be(nbrUsedRoles) Thread.sleep(idleGossipDuration.toMillis) - clusterView.members.size must be(nbrUsedRoles) + clusterView.members.size should be(nbrUsedRoles) } awaitClusterResult() } @@ -1192,12 +1192,12 @@ abstract class StressSpec if (exerciseActors) { runOn(roles.take(3): _*) { val m = master - m must not be (None) + m should not be (None) m.get.tell(End, testActor) val workResult = awaitWorkResult - workResult.retryCount must be(0) - workResult.sendCount must be > (0L) - workResult.ackCount must be > (0L) + workResult.retryCount should be(0) + workResult.sendCount should be > (0L) + workResult.ackCount should be > (0L) } } enterBarrier("after-" + step) @@ -1298,11 +1298,11 @@ abstract class StressSpec if (exerciseActors) { runOn(roles.take(3): _*) { val m = master - m must not be (None) + m should not be (None) m.get.tell(End, testActor) val workResult = awaitWorkResult - workResult.sendCount must be > (0L) - workResult.ackCount must be > (0L) + workResult.sendCount should be > (0L) + workResult.ackCount should be > (0L) } } enterBarrier("after-" + step) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/SunnyWeatherSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/SunnyWeatherSpec.scala index f6523c0be3..9562031c4c 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/SunnyWeatherSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/SunnyWeatherSpec.scala @@ -70,7 +70,7 @@ abstract class SunnyWeatherSpec for (n ← 1 to 30) { enterBarrier("period-" + n) - unexpected.get must be(SortedSet.empty) + unexpected.get should be(SortedSet.empty) awaitMembersUp(roles.size) assertLeaderIn(roles) if (n % 5 == 0) log.debug("Passed period [{}]", n) diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/SurviveNetworkInstabilitySpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/SurviveNetworkInstabilitySpec.scala index f551e595f1..09f9e1f338 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/SurviveNetworkInstabilitySpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/SurviveNetworkInstabilitySpec.scala @@ -82,7 +82,7 @@ abstract class SurviveNetworkInstabilitySpec def assertUnreachable(subjects: RoleName*): Unit = { val expected = subjects.toSet map address - awaitAssert(clusterView.unreachableMembers.map(_.address) must be(expected)) + awaitAssert(clusterView.unreachableMembers.map(_.address) should be(expected)) } "A network partition tolerant cluster" must { @@ -236,7 +236,7 @@ abstract class SurviveNetworkInstabilitySpec val child = expectMsgType[ActorRef] child ! "hello" expectMsg("hello") - lastSender.path.address must be(address(third)) + lastSender.path.address should be(address(third)) } } runOn(third) { @@ -257,7 +257,7 @@ abstract class SurviveNetworkInstabilitySpec runOn(third) { // undelivered system messages in RemoteChild on third should trigger QuarantinedEvent within(10.seconds) { - expectMsgType[QuarantinedEvent].address must be(address(second)) + expectMsgType[QuarantinedEvent].address should be(address(second)) } system.eventStream.unsubscribe(testActor, classOf[QuarantinedEvent]) } @@ -265,7 +265,7 @@ abstract class SurviveNetworkInstabilitySpec runOn(others: _*) { // second should be removed because of quarantine - awaitAssert(clusterView.members.map(_.address) must not contain (address(second))) + awaitAssert(clusterView.members.map(_.address) should not contain (address(second))) } enterBarrier("after-6") @@ -302,8 +302,8 @@ abstract class SurviveNetworkInstabilitySpec runOn(side1AfterJoin: _*) { // side2 removed val expected = (side1AfterJoin map address).toSet - awaitAssert(clusterView.members.map(_.address) must be(expected)) - awaitAssert(clusterView.members.collectFirst { case m if m.address == address(eighth) ⇒ m.status } must be( + awaitAssert(clusterView.members.map(_.address) should be(expected)) + awaitAssert(clusterView.members.collectFirst { case m if m.address == address(eighth) ⇒ m.status } should be( Some(MemberStatus.Up))) } @@ -321,12 +321,12 @@ abstract class SurviveNetworkInstabilitySpec runOn(side1AfterJoin: _*) { val expected = (side1AfterJoin map address).toSet - clusterView.members.map(_.address) must be(expected) + clusterView.members.map(_.address) should be(expected) } runOn(side2: _*) { val expected = ((side2 ++ side1) map address).toSet - clusterView.members.map(_.address) must be(expected) + clusterView.members.map(_.address) should be(expected) assertUnreachable(side1: _*) } diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/TransitionSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/TransitionSpec.scala index a3a3d8a9f7..1ca1ba0b3d 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/TransitionSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/TransitionSpec.scala @@ -59,17 +59,17 @@ abstract class TransitionSpec def seenLatestGossip: Set[RoleName] = clusterView.seenBy flatMap roleName def awaitSeen(addresses: Address*): Unit = awaitAssert { - (seenLatestGossip map address) must be(addresses.toSet) + (seenLatestGossip map address) should be(addresses.toSet) } def awaitMembers(addresses: Address*): Unit = awaitAssert { clusterView.refreshCurrentState() - memberAddresses must be(addresses.toSet) + memberAddresses should be(addresses.toSet) } def awaitMemberStatus(address: Address, status: MemberStatus): Unit = awaitAssert { clusterView.refreshCurrentState() - memberStatus(address) must be(status) + memberStatus(address) should be(status) } def leaderActions(): Unit = @@ -134,7 +134,7 @@ abstract class TransitionSpec awaitMembers(first, second) awaitMemberStatus(first, Up) awaitMemberStatus(second, Joining) - awaitAssert(seenLatestGossip must be(Set(first, second))) + awaitAssert(seenLatestGossip should be(Set(first, second))) } enterBarrier("convergence-joining-2") @@ -149,7 +149,7 @@ abstract class TransitionSpec runOn(first, second) { // gossip chat will synchronize the views awaitMemberStatus(second, Up) - awaitAssert(seenLatestGossip must be(Set(first, second))) + awaitAssert(seenLatestGossip should be(Set(first, second))) awaitMemberStatus(first, Up) } @@ -163,7 +163,7 @@ abstract class TransitionSpec } runOn(second, third) { // gossip chat from the join will synchronize the views - awaitAssert(seenLatestGossip must be(Set(second, third))) + awaitAssert(seenLatestGossip should be(Set(second, third))) } enterBarrier("third-joined-second") @@ -173,7 +173,7 @@ abstract class TransitionSpec awaitMembers(first, second, third) awaitMemberStatus(third, Joining) awaitMemberStatus(second, Up) - awaitAssert(seenLatestGossip must be(Set(first, second, third))) + awaitAssert(seenLatestGossip should be(Set(first, second, third))) } first gossipTo third @@ -182,7 +182,7 @@ abstract class TransitionSpec awaitMemberStatus(first, Up) awaitMemberStatus(second, Up) awaitMemberStatus(third, Joining) - awaitAssert(seenLatestGossip must be(Set(first, second, third))) + awaitAssert(seenLatestGossip should be(Set(first, second, third))) } enterBarrier("convergence-joining-3") @@ -201,7 +201,7 @@ abstract class TransitionSpec leader12 gossipTo other1 runOn(other1) { awaitMemberStatus(third, Up) - awaitAssert(seenLatestGossip must be(Set(leader12, myself))) + awaitAssert(seenLatestGossip should be(Set(leader12, myself))) } // first non-leader gossipTo the other non-leader @@ -212,7 +212,7 @@ abstract class TransitionSpec } runOn(other2) { awaitMemberStatus(third, Up) - awaitAssert(seenLatestGossip must be(Set(first, second, third))) + awaitAssert(seenLatestGossip should be(Set(first, second, third))) } // first non-leader gossipTo the leader @@ -221,7 +221,7 @@ abstract class TransitionSpec awaitMemberStatus(first, Up) awaitMemberStatus(second, Up) awaitMemberStatus(third, Up) - awaitAssert(seenLatestGossip must be(Set(first, second, third))) + awaitAssert(seenLatestGossip should be(Set(first, second, third))) } enterBarrier("after-3") @@ -231,8 +231,8 @@ abstract class TransitionSpec runOn(third) { markNodeAsUnavailable(second) reapUnreachable() - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(second))) - awaitAssert(seenLatestGossip must be(Set(third))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(second))) + awaitAssert(seenLatestGossip should be(Set(third))) } enterBarrier("after-second-unavailble") @@ -240,7 +240,7 @@ abstract class TransitionSpec third gossipTo first runOn(first, third) { - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(second))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(second))) } runOn(first) { @@ -252,9 +252,9 @@ abstract class TransitionSpec first gossipTo third runOn(first, third) { - awaitAssert(clusterView.unreachableMembers.map(_.address) must contain(address(second))) + awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(second))) awaitMemberStatus(second, Down) - awaitAssert(seenLatestGossip must be(Set(first, third))) + awaitAssert(seenLatestGossip should be(Set(first, third))) } enterBarrier("after-6") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/UnreachableNodeJoinsAgainSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/UnreachableNodeJoinsAgainSpec.scala index 73d1e34030..a680b2eea6 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/UnreachableNodeJoinsAgainSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/UnreachableNodeJoinsAgainSpec.scala @@ -90,9 +90,9 @@ abstract class UnreachableNodeJoinsAgainSpec // victim becomes all alone awaitAssert { val members = clusterView.members - clusterView.unreachableMembers.size must be(roles.size - 1) + clusterView.unreachableMembers.size should be(roles.size - 1) } - clusterView.unreachableMembers.map(_.address) must be((allButVictim map address).toSet) + clusterView.unreachableMembers.map(_.address) should be((allButVictim map address).toSet) } } @@ -102,13 +102,13 @@ abstract class UnreachableNodeJoinsAgainSpec // victim becomes unreachable awaitAssert { val members = clusterView.members - clusterView.unreachableMembers.size must be(1) + clusterView.unreachableMembers.size should be(1) } awaitSeenSameState(allButVictim map address: _*) // still one unreachable - clusterView.unreachableMembers.size must be(1) - clusterView.unreachableMembers.head.address must be(node(victim).address) - clusterView.unreachableMembers.head.status must be(MemberStatus.Up) + clusterView.unreachableMembers.size should be(1) + clusterView.unreachableMembers.head.address should be(node(victim).address) + clusterView.unreachableMembers.head.status should be(MemberStatus.Up) } } @@ -124,8 +124,8 @@ abstract class UnreachableNodeJoinsAgainSpec runOn(allButVictim: _*) { // eventually removed awaitMembersUp(roles.size - 1, Set(victim)) - awaitAssert(clusterView.unreachableMembers must be(Set.empty), 15 seconds) - awaitAssert(clusterView.members.map(_.address) must be((allButVictim map address).toSet)) + awaitAssert(clusterView.unreachableMembers should be(Set.empty), 15 seconds) + awaitAssert(clusterView.members.map(_.address) should be((allButVictim map address).toSet)) } @@ -171,9 +171,9 @@ abstract class UnreachableNodeJoinsAgainSpec try { Cluster(freshSystem).join(masterAddress) within(15 seconds) { - awaitAssert(Cluster(freshSystem).readView.members.map(_.address) must contain(victimAddress)) - awaitAssert(Cluster(freshSystem).readView.members.size must be(expectedNumberOfMembers)) - awaitAssert(Cluster(freshSystem).readView.members.map(_.status) must be(Set(MemberStatus.Up))) + awaitAssert(Cluster(freshSystem).readView.members.map(_.address) should contain(victimAddress)) + awaitAssert(Cluster(freshSystem).readView.members.size should be(expectedNumberOfMembers)) + awaitAssert(Cluster(freshSystem).readView.members.map(_.status) should be(Set(MemberStatus.Up))) } // signal to master node that victim is done diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/AdaptiveLoadBalancingRouterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/AdaptiveLoadBalancingRouterSpec.scala index 0914f6d03c..d279d56906 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/AdaptiveLoadBalancingRouterSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/AdaptiveLoadBalancingRouterSpec.scala @@ -118,8 +118,8 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa local = AdaptiveLoadBalancingRouter(HeapMetricsSelector), settings = ClusterRouterSettings(totalInstances = 10, maxInstancesPerNode = 1, useRole = None))), name) // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router).size must be(roles.size) } - currentRoutees(router).map(fullAddress).toSet must be(roles.map(address).toSet) + awaitAssert { currentRoutees(router).size should be(roles.size) } + currentRoutees(router).map(fullAddress).toSet should be(roles.map(address).toSet) router } @@ -145,10 +145,10 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa val replies = receiveReplies(iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be > (0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be > (0) + replies.values.sum should be(iterationCount) } @@ -180,8 +180,8 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa val replies = receiveReplies(iterationCount) - replies(third) must be > (replies(second)) - replies.values.sum must be(iterationCount) + replies(third) should be > (replies(second)) + replies.values.sum should be(iterationCount) } @@ -192,8 +192,8 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa runOn(first) { val router3 = system.actorOf(Props[Memory].withRouter(FromConfig()), "router3") // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router3).size must be(9) } - currentRoutees(router3).map(fullAddress).toSet must be(Set(address(first))) + awaitAssert { currentRoutees(router3).size should be(9) } + currentRoutees(router3).map(fullAddress).toSet should be(Set(address(first))) } enterBarrier("after-4") } @@ -202,8 +202,8 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa runOn(first) { val router4 = system.actorOf(Props[Memory].withRouter(FromConfig()), "router4") // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router4).size must be(6) } - currentRoutees(router4).map(fullAddress).toSet must be(Set( + awaitAssert { currentRoutees(router4).size should be(6) } + currentRoutees(router4).map(fullAddress).toSet should be(Set( address(first), address(second), address(third))) } enterBarrier("after-5") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterConsistentHashingRouterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterConsistentHashingRouterSpec.scala index c771396c88..4dd2300b4c 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterConsistentHashingRouterSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterConsistentHashingRouterSpec.scala @@ -89,8 +89,8 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC "create routees from configuration" in { runOn(first) { // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router1).size must be(4) } - currentRoutees(router1).map(fullAddress).toSet must be(Set(address(first), address(second))) + awaitAssert { currentRoutees(router1).size should be(4) } + currentRoutees(router1).map(fullAddress).toSet should be(Set(address(first), address(second))) } enterBarrier("after-2") } @@ -111,8 +111,8 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC runOn(first) { // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router1).size must be(6) } - currentRoutees(router1).map(fullAddress).toSet must be(roles.map(address).toSet) + awaitAssert { currentRoutees(router1).size should be(6) } + currentRoutees(router1).map(fullAddress).toSet should be(roles.map(address).toSet) } enterBarrier("after-3") @@ -123,8 +123,8 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC val router2 = system.actorOf(Props[Echo].withRouter(ClusterRouterConfig(local = ConsistentHashingRouter(), settings = ClusterRouterSettings(totalInstances = 10, maxInstancesPerNode = 2, useRole = None))), "router2") // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router2).size must be(6) } - currentRoutees(router2).map(fullAddress).toSet must be(roles.map(address).toSet) + awaitAssert { currentRoutees(router2).size should be(6) } + currentRoutees(router2).map(fullAddress).toSet should be(roles.map(address).toSet) } enterBarrier("after-4") @@ -162,8 +162,8 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC def assertHashMapping(router: ActorRef): Unit = { // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router).size must be(6) } - currentRoutees(router).map(fullAddress).toSet must be(roles.map(address).toSet) + awaitAssert { currentRoutees(router).size should be(6) } + currentRoutees(router).map(fullAddress).toSet should be(roles.map(address).toSet) router ! "a" val destinationA = expectMsgType[ActorRef] diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterRoundRobinRoutedActorSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterRoundRobinRoutedActorSpec.scala index fc6fee8cae..3eb9f2885a 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterRoundRobinRoutedActorSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/oldrouting/ClusterRoundRobinRoutedActorSpec.scala @@ -138,10 +138,10 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou "deploy routees to the member nodes in the cluster" taggedAs LongRunningTest in { runOn(first) { - router1.isInstanceOf[RoutedActorRef] must be(true) + router1.isInstanceOf[RoutedActorRef] should be(true) // max-nr-of-instances-per-node=2 times 2 nodes - awaitAssert(currentRoutees(router1).size must be(4)) + awaitAssert(currentRoutees(router1).size should be(4)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -150,11 +150,11 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(DeployRoutee, iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be(0) - replies(fourth) must be(0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be(0) + replies(fourth) should be(0) + replies.values.sum should be(iterationCount) } enterBarrier("after-2") @@ -169,7 +169,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou runOn(first) { // 2 nodes, 1 routee on each node - awaitAssert(currentRoutees(router4).size must be(2)) + awaitAssert(currentRoutees(router4).size should be(2)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -178,11 +178,11 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(LookupRoutee, iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be(0) - replies(fourth) must be(0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be(0) + replies(fourth) should be(0) + replies.values.sum should be(iterationCount) } enterBarrier("after-3") @@ -195,7 +195,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou runOn(first) { // max-nr-of-instances-per-node=2 times 4 nodes - awaitAssert(currentRoutees(router1).size must be(8)) + awaitAssert(currentRoutees(router1).size should be(8)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -204,8 +204,8 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(DeployRoutee, iterationCount) - replies.values.foreach { _ must be > (0) } - replies.values.sum must be(iterationCount) + replies.values.foreach { _ should be > (0) } + replies.values.sum should be(iterationCount) } enterBarrier("after-4") @@ -217,7 +217,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou runOn(first) { // 4 nodes, 1 routee on each node - awaitAssert(currentRoutees(router4).size must be(4)) + awaitAssert(currentRoutees(router4).size should be(4)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -226,8 +226,8 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(LookupRoutee, iterationCount) - replies.values.foreach { _ must be > (0) } - replies.values.sum must be(iterationCount) + replies.values.foreach { _ should be > (0) } + replies.values.sum should be(iterationCount) } enterBarrier("after-5") @@ -237,7 +237,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou runOn(first) { // max-nr-of-instances-per-node=1 times 3 nodes - awaitAssert(currentRoutees(router3).size must be(3)) + awaitAssert(currentRoutees(router3).size should be(3)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -246,11 +246,11 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(DeployRoutee, iterationCount) - replies(first) must be(0) - replies(second) must be > (0) - replies(third) must be > (0) - replies(fourth) must be > (0) - replies.values.sum must be(iterationCount) + replies(first) should be(0) + replies(second) should be > (0) + replies(third) should be > (0) + replies(fourth) should be > (0) + replies.values.sum should be(iterationCount) } enterBarrier("after-6") @@ -259,7 +259,7 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou "deploy routees to specified node role" taggedAs LongRunningTest in { runOn(first) { - awaitAssert(currentRoutees(router5).size must be(2)) + awaitAssert(currentRoutees(router5).size should be(2)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -268,11 +268,11 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(DeployRoutee, iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be(0) - replies(fourth) must be(0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be(0) + replies(fourth) should be(0) + replies.values.sum should be(iterationCount) } enterBarrier("after-7") @@ -281,10 +281,10 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou "deploy programatically defined routees to the member nodes in the cluster" taggedAs LongRunningTest in { runOn(first) { - router2.isInstanceOf[RoutedActorRef] must be(true) + router2.isInstanceOf[RoutedActorRef] should be(true) // totalInstances = 3, maxInstancesPerNode = 1 - awaitAssert(currentRoutees(router2).size must be(3)) + awaitAssert(currentRoutees(router2).size should be(3)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -297,8 +297,8 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val routees = currentRoutees(router2) val routeeAddresses = routees map fullAddress - routeeAddresses.size must be(3) - replies.values.sum must be(iterationCount) + routeeAddresses.size should be(3) + replies.values.sum should be(iterationCount) } enterBarrier("after-8") @@ -313,16 +313,16 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou runOn(first) { // 4 nodes, 1 routee on each node - awaitAssert(currentRoutees(router4).size must be(4)) + awaitAssert(currentRoutees(router4).size should be(4)) testConductor.blackhole(first, second, Direction.Both).await - awaitAssert(routees.size must be(3)) - routeeAddresses must not contain (address(second)) + awaitAssert(routees.size should be(3)) + routeeAddresses should not contain (address(second)) testConductor.passThrough(first, second, Direction.Both).await - awaitAssert(routees.size must be(4)) - routeeAddresses must contain(address(second)) + awaitAssert(routees.size should be(4)) + routeeAddresses should contain(address(second)) } @@ -342,10 +342,10 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val downRoutee = routees.find(_.path.address == downAddress).get cluster.down(downAddress) - expectMsgType[Terminated](15.seconds).actor must be(downRoutee) + expectMsgType[Terminated](15.seconds).actor should be(downRoutee) awaitAssert { - routeeAddresses must contain(notUsedAddress) - routeeAddresses must not contain (downAddress) + routeeAddresses should contain(notUsedAddress) + routeeAddresses should not contain (downAddress) } val iterationCount = 10 @@ -355,8 +355,8 @@ abstract class ClusterRoundRobinRoutedActorSpec extends MultiNodeSpec(ClusterRou val replies = receiveReplies(DeployRoutee, iterationCount) - routeeAddresses.size must be(3) - replies.values.sum must be(iterationCount) + routeeAddresses.size should be(3) + replies.values.sum should be(iterationCount) } enterBarrier("after-10") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/AdaptiveLoadBalancingRouterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/AdaptiveLoadBalancingRouterSpec.scala index 5f5e6a4896..53a68688bb 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/AdaptiveLoadBalancingRouterSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/AdaptiveLoadBalancingRouterSpec.scala @@ -120,9 +120,9 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa props(Props[Echo]), name) // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router).size must be(roles.size) } + awaitAssert { currentRoutees(router).size should be(roles.size) } val routees = currentRoutees(router) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(roles.map(address).toSet) + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(roles.map(address).toSet) router } @@ -148,10 +148,10 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa val replies = receiveReplies(iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be > (0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be > (0) + replies.values.sum should be(iterationCount) } @@ -183,8 +183,8 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa val replies = receiveReplies(iterationCount) - replies(third) must be > (replies(second)) - replies.values.sum must be(iterationCount) + replies(third) should be > (replies(second)) + replies.values.sum should be(iterationCount) } @@ -195,9 +195,9 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa runOn(first) { val router3 = system.actorOf(FromConfig.props(Props[Memory]), "router3") // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router3).size must be(9) } + awaitAssert { currentRoutees(router3).size should be(9) } val routees = currentRoutees(router3) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(Set(address(first))) + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(Set(address(first))) } enterBarrier("after-4") } @@ -206,9 +206,9 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa runOn(first) { val router4 = system.actorOf(FromConfig.props(Props[Memory]), "router4") // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router4).size must be(6) } + awaitAssert { currentRoutees(router4).size should be(6) } val routees = currentRoutees(router4) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(Set( + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(Set( address(first), address(second), address(third))) } enterBarrier("after-5") diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterConsistentHashingRouterSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterConsistentHashingRouterSpec.scala index f23d14c34e..5ced977b1b 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterConsistentHashingRouterSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterConsistentHashingRouterSpec.scala @@ -89,9 +89,9 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC "create routees from configuration" in { runOn(first) { // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router1).size must be(4) } + awaitAssert { currentRoutees(router1).size should be(4) } val routees = currentRoutees(router1) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(Set(address(first), address(second))) + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(Set(address(first), address(second))) } enterBarrier("after-2") } @@ -112,9 +112,9 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC runOn(first) { // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router1).size must be(6) } + awaitAssert { currentRoutees(router1).size should be(6) } val routees = currentRoutees(router1) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(roles.map(address).toSet) + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(roles.map(address).toSet) } enterBarrier("after-3") @@ -127,9 +127,9 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC props(Props[Echo]), "router2") // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router2).size must be(6) } + awaitAssert { currentRoutees(router2).size should be(6) } val routees = currentRoutees(router2) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(roles.map(address).toSet) + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(roles.map(address).toSet) } enterBarrier("after-4") @@ -169,9 +169,9 @@ abstract class ClusterConsistentHashingRouterSpec extends MultiNodeSpec(ClusterC def assertHashMapping(router: ActorRef): Unit = { // it may take some time until router receives cluster member events - awaitAssert { currentRoutees(router).size must be(6) } + awaitAssert { currentRoutees(router).size should be(6) } val routees = currentRoutees(router) - routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet must be(roles.map(address).toSet) + routees.map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) }.toSet should be(roles.map(address).toSet) router ! "a" val destinationA = expectMsgType[ActorRef] diff --git a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinSpec.scala b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinSpec.scala index 69dbf8191f..888f865357 100644 --- a/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinSpec.scala +++ b/akka-cluster/src/multi-jvm/scala/akka/cluster/routing/ClusterRoundRobinSpec.scala @@ -141,10 +141,10 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult "deploy routees to the member nodes in the cluster" taggedAs LongRunningTest in { runOn(first) { - router1.isInstanceOf[RoutedActorRef] must be(true) + router1.isInstanceOf[RoutedActorRef] should be(true) // max-nr-of-instances-per-node=2 times 2 nodes - awaitAssert(currentRoutees(router1).size must be(4)) + awaitAssert(currentRoutees(router1).size should be(4)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -153,11 +153,11 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(PoolRoutee, iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be(0) - replies(fourth) must be(0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be(0) + replies(fourth) should be(0) + replies.values.sum should be(iterationCount) } enterBarrier("after-2") @@ -173,7 +173,7 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult runOn(first) { // 2 nodes, 2 routees on each node - awaitAssert(currentRoutees(router4).size must be(4)) + awaitAssert(currentRoutees(router4).size should be(4)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -182,11 +182,11 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(GroupRoutee, iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be(0) - replies(fourth) must be(0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be(0) + replies(fourth) should be(0) + replies.values.sum should be(iterationCount) } enterBarrier("after-3") @@ -199,7 +199,7 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult runOn(first) { // max-nr-of-instances-per-node=2 times 4 nodes - awaitAssert(currentRoutees(router1).size must be(8)) + awaitAssert(currentRoutees(router1).size should be(8)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -208,8 +208,8 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(PoolRoutee, iterationCount) - replies.values.foreach { _ must be > (0) } - replies.values.sum must be(iterationCount) + replies.values.foreach { _ should be > (0) } + replies.values.sum should be(iterationCount) } enterBarrier("after-4") @@ -221,7 +221,7 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult runOn(first) { // 4 nodes, 2 routee on each node - awaitAssert(currentRoutees(router4).size must be(8)) + awaitAssert(currentRoutees(router4).size should be(8)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -230,8 +230,8 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(GroupRoutee, iterationCount) - replies.values.foreach { _ must be > (0) } - replies.values.sum must be(iterationCount) + replies.values.foreach { _ should be > (0) } + replies.values.sum should be(iterationCount) } enterBarrier("after-5") @@ -241,7 +241,7 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult runOn(first) { // max-nr-of-instances-per-node=1 times 3 nodes - awaitAssert(currentRoutees(router3).size must be(3)) + awaitAssert(currentRoutees(router3).size should be(3)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -250,11 +250,11 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(PoolRoutee, iterationCount) - replies(first) must be(0) - replies(second) must be > (0) - replies(third) must be > (0) - replies(fourth) must be > (0) - replies.values.sum must be(iterationCount) + replies(first) should be(0) + replies(second) should be > (0) + replies(third) should be > (0) + replies(fourth) should be > (0) + replies.values.sum should be(iterationCount) } enterBarrier("after-6") @@ -263,7 +263,7 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult "deploy routees to specified node role" taggedAs LongRunningTest in { runOn(first) { - awaitAssert(currentRoutees(router5).size must be(2)) + awaitAssert(currentRoutees(router5).size should be(2)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -272,11 +272,11 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(PoolRoutee, iterationCount) - replies(first) must be > (0) - replies(second) must be > (0) - replies(third) must be(0) - replies(fourth) must be(0) - replies.values.sum must be(iterationCount) + replies(first) should be > (0) + replies(second) should be > (0) + replies(third) should be(0) + replies(fourth) should be(0) + replies.values.sum should be(iterationCount) } enterBarrier("after-7") @@ -285,10 +285,10 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult "deploy programatically defined routees to the member nodes in the cluster" taggedAs LongRunningTest in { runOn(first) { - router2.isInstanceOf[RoutedActorRef] must be(true) + router2.isInstanceOf[RoutedActorRef] should be(true) // totalInstances = 3, maxInstancesPerNode = 1 - awaitAssert(currentRoutees(router2).size must be(3)) + awaitAssert(currentRoutees(router2).size should be(3)) val iterationCount = 10 for (i ← 0 until iterationCount) { @@ -301,8 +301,8 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val routees = currentRoutees(router2) val routeeAddresses = routees map { case ActorRefRoutee(ref) ⇒ fullAddress(ref) } - routeeAddresses.size must be(3) - replies.values.sum must be(iterationCount) + routeeAddresses.size should be(3) + replies.values.sum should be(iterationCount) } enterBarrier("after-8") @@ -317,16 +317,16 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult runOn(first) { // 4 nodes, 2 routees on each node - awaitAssert(currentRoutees(router4).size must be(8)) + awaitAssert(currentRoutees(router4).size should be(8)) testConductor.blackhole(first, second, Direction.Both).await - awaitAssert(routees.size must be(6)) - routeeAddresses must not contain (address(second)) + awaitAssert(routees.size should be(6)) + routeeAddresses should not contain (address(second)) testConductor.passThrough(first, second, Direction.Both).await - awaitAssert(routees.size must be(8)) - routeeAddresses must contain(address(second)) + awaitAssert(routees.size should be(8)) + routeeAddresses should contain(address(second)) } @@ -348,10 +348,10 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult }.get cluster.down(downAddress) - expectMsgType[Terminated](15.seconds).actor must be(downRouteeRef) + expectMsgType[Terminated](15.seconds).actor should be(downRouteeRef) awaitAssert { - routeeAddresses must contain(notUsedAddress) - routeeAddresses must not contain (downAddress) + routeeAddresses should contain(notUsedAddress) + routeeAddresses should not contain (downAddress) } val iterationCount = 10 @@ -361,8 +361,8 @@ abstract class ClusterRoundRobinSpec extends MultiNodeSpec(ClusterRoundRobinMult val replies = receiveReplies(PoolRoutee, iterationCount) - routeeAddresses.size must be(3) - replies.values.sum must be(iterationCount) + routeeAddresses.size should be(3) + replies.values.sum should be(iterationCount) } enterBarrier("after-10") diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterConfigSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterConfigSpec.scala index 4c356d5081..40acc04094 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterConfigSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterConfigSpec.scala @@ -18,39 +18,39 @@ class ClusterConfigSpec extends AkkaSpec { "be able to parse generic cluster config elements" in { val settings = new ClusterSettings(system.settings.config, system.name) import settings._ - LogInfo must be(true) - FailureDetectorConfig.getDouble("threshold") must be(8.0 plusOrMinus 0.0001) - FailureDetectorConfig.getInt("max-sample-size") must be(1000) - Duration(FailureDetectorConfig.getMilliseconds("min-std-deviation"), MILLISECONDS) must be(100 millis) - Duration(FailureDetectorConfig.getMilliseconds("acceptable-heartbeat-pause"), MILLISECONDS) must be(3 seconds) - FailureDetectorImplementationClass must be(classOf[PhiAccrualFailureDetector].getName) - SeedNodes must be(Seq.empty[String]) - SeedNodeTimeout must be(5 seconds) - RetryUnsuccessfulJoinAfter must be(10 seconds) - PeriodicTasksInitialDelay must be(1 seconds) - GossipInterval must be(1 second) - GossipTimeToLive must be(2 seconds) - HeartbeatInterval must be(1 second) - MonitoredByNrOfMembers must be(5) - HeartbeatExpectedResponseAfter must be(5 seconds) - LeaderActionsInterval must be(1 second) - UnreachableNodesReaperInterval must be(1 second) - PublishStatsInterval must be(Duration.Undefined) - AutoDownUnreachableAfter must be(Duration.Undefined) - MinNrOfMembers must be(1) - MinNrOfMembersOfRole must be === Map.empty - Roles must be === Set.empty - JmxEnabled must be(true) - UseDispatcher must be(Dispatchers.DefaultDispatcherId) - GossipDifferentViewProbability must be(0.8 plusOrMinus 0.0001) - ReduceGossipDifferentViewProbability must be(400) - SchedulerTickDuration must be(33 millis) - SchedulerTicksPerWheel must be(512) - MetricsEnabled must be(true) - MetricsCollectorClass must be(classOf[SigarMetricsCollector].getName) - MetricsInterval must be(3 seconds) - MetricsGossipInterval must be(3 seconds) - MetricsMovingAverageHalfLife must be(12 seconds) + LogInfo should be(true) + FailureDetectorConfig.getDouble("threshold") should be(8.0 +- 0.0001) + FailureDetectorConfig.getInt("max-sample-size") should be(1000) + Duration(FailureDetectorConfig.getMilliseconds("min-std-deviation"), MILLISECONDS) should be(100 millis) + Duration(FailureDetectorConfig.getMilliseconds("acceptable-heartbeat-pause"), MILLISECONDS) should be(3 seconds) + FailureDetectorImplementationClass should be(classOf[PhiAccrualFailureDetector].getName) + SeedNodes should be(Seq.empty[String]) + SeedNodeTimeout should be(5 seconds) + RetryUnsuccessfulJoinAfter should be(10 seconds) + PeriodicTasksInitialDelay should be(1 seconds) + GossipInterval should be(1 second) + GossipTimeToLive should be(2 seconds) + HeartbeatInterval should be(1 second) + MonitoredByNrOfMembers should be(5) + HeartbeatExpectedResponseAfter should be(5 seconds) + LeaderActionsInterval should be(1 second) + UnreachableNodesReaperInterval should be(1 second) + PublishStatsInterval should be(Duration.Undefined) + AutoDownUnreachableAfter should be(Duration.Undefined) + MinNrOfMembers should be(1) + MinNrOfMembersOfRole should equal(Map.empty) + Roles should equal(Set.empty) + JmxEnabled should be(true) + UseDispatcher should be(Dispatchers.DefaultDispatcherId) + GossipDifferentViewProbability should be(0.8 +- 0.0001) + ReduceGossipDifferentViewProbability should be(400) + SchedulerTickDuration should be(33 millis) + SchedulerTicksPerWheel should be(512) + MetricsEnabled should be(true) + MetricsCollectorClass should be(classOf[SigarMetricsCollector].getName) + MetricsInterval should be(3 seconds) + MetricsGossipInterval should be(3 seconds) + MetricsMovingAverageHalfLife should be(12 seconds) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterDeployerSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterDeployerSpec.scala index 847136e25c..61de9276c3 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterDeployerSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterDeployerSpec.scala @@ -60,9 +60,9 @@ class ClusterDeployerSpec extends AkkaSpec(ClusterDeployerSpec.deployerConf) { "be able to parse 'akka.actor.deployment._' with specified cluster pool" in { val service = "/user/service1" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must not be (None) + deployment should not be (None) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -76,9 +76,9 @@ class ClusterDeployerSpec extends AkkaSpec(ClusterDeployerSpec.deployerConf) { "be able to parse 'akka.actor.deployment._' with specified cluster group" in { val service = "/user/service2" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must not be (None) + deployment should not be (None) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -92,9 +92,9 @@ class ClusterDeployerSpec extends AkkaSpec(ClusterDeployerSpec.deployerConf) { "be able to parse 'akka.actor.deployment._' with deprecated 'cluster.routees-path'" in { val service = "/user/service3" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must not be (None) + deployment should not be (None) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -107,8 +107,8 @@ class ClusterDeployerSpec extends AkkaSpec(ClusterDeployerSpec.deployerConf) { "have correct router mappings" in { val mapping = system.asInstanceOf[ActorSystemImpl].provider.deployer.routerTypeMapping - mapping("adaptive-pool") must be(classOf[akka.cluster.routing.AdaptiveLoadBalancingPool].getName) - mapping("adaptive-group") must be(classOf[akka.cluster.routing.AdaptiveLoadBalancingGroup].getName) + mapping("adaptive-pool") should be(classOf[akka.cluster.routing.AdaptiveLoadBalancingPool].getName) + mapping("adaptive-group") should be(classOf[akka.cluster.routing.AdaptiveLoadBalancingGroup].getName) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventSpec.scala index be62d78e1a..e3c7ff6941 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterDomainEventSpec.scala @@ -5,12 +5,12 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address import scala.collection.immutable.SortedSet @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class ClusterDomainEventSpec extends WordSpec with MustMatchers { +class ClusterDomainEventSpec extends WordSpec with Matchers { import MemberStatus._ import ClusterEvent._ @@ -43,25 +43,25 @@ class ClusterDomainEventSpec extends WordSpec with MustMatchers { "be empty for the same gossip" in { val g1 = Gossip(members = SortedSet(aUp)) - diffUnreachable(g1, g1) must be(Seq.empty) + diffUnreachable(g1, g1) should be(Seq.empty) } "be produced for new members" in { val (g1, _) = converge(Gossip(members = SortedSet(aUp))) val (g2, s2) = converge(Gossip(members = SortedSet(aUp, bUp, eJoining))) - diffMemberEvents(g1, g2) must be(Seq(MemberUp(bUp))) - diffUnreachable(g1, g2) must be(Seq.empty) - diffSeen(g1, g2) must be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) + diffMemberEvents(g1, g2) should be(Seq(MemberUp(bUp))) + diffUnreachable(g1, g2) should be(Seq.empty) + diffSeen(g1, g2) should be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) } "be produced for changed status of members" in { val (g1, _) = converge(Gossip(members = SortedSet(aJoining, bUp, cUp))) val (g2, s2) = converge(Gossip(members = SortedSet(aUp, bUp, cLeaving, eJoining))) - diffMemberEvents(g1, g2) must be(Seq(MemberUp(aUp))) - diffUnreachable(g1, g2) must be(Seq.empty) - diffSeen(g1, g2) must be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) + diffMemberEvents(g1, g2) should be(Seq(MemberUp(aUp))) + diffUnreachable(g1, g2) should be(Seq.empty) + diffSeen(g1, g2) should be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) } "be produced for members in unreachable" in { @@ -73,8 +73,8 @@ class ClusterDomainEventSpec extends WordSpec with MustMatchers { unreachable(aUp.uniqueAddress, bDown.uniqueAddress) val g2 = Gossip(members = SortedSet(aUp, cUp, bDown, eDown), overview = GossipOverview(reachability = reachability2)) - diffUnreachable(g1, g2) must be(Seq(UnreachableMember(bDown))) - diffSeen(g1, g2) must be(Seq.empty) + diffUnreachable(g1, g2) should be(Seq(UnreachableMember(bDown))) + diffSeen(g1, g2) should be(Seq.empty) } "be produced for members becoming reachable after unreachable" in { @@ -88,53 +88,53 @@ class ClusterDomainEventSpec extends WordSpec with MustMatchers { reachable(aUp.uniqueAddress, bUp.uniqueAddress) val g2 = Gossip(members = SortedSet(aUp, cUp, bUp, eUp), overview = GossipOverview(reachability = reachability2)) - diffUnreachable(g1, g2) must be(Seq(UnreachableMember(cUp))) - diffReachable(g1, g2) must be(Seq(ReachableMember(bUp))) + diffUnreachable(g1, g2) should be(Seq(UnreachableMember(cUp))) + diffReachable(g1, g2) should be(Seq(ReachableMember(bUp))) } "be produced for removed members" in { val (g1, _) = converge(Gossip(members = SortedSet(aUp, dExiting))) val (g2, s2) = converge(Gossip(members = SortedSet(aUp))) - diffMemberEvents(g1, g2) must be(Seq(MemberRemoved(dRemoved, Exiting))) - diffUnreachable(g1, g2) must be(Seq.empty) - diffSeen(g1, g2) must be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) + diffMemberEvents(g1, g2) should be(Seq(MemberRemoved(dRemoved, Exiting))) + diffUnreachable(g1, g2) should be(Seq.empty) + diffSeen(g1, g2) should be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) } "be produced for convergence changes" in { val g1 = Gossip(members = SortedSet(aUp, bUp, eJoining)).seen(aUp.uniqueAddress).seen(bUp.uniqueAddress).seen(eJoining.uniqueAddress) val g2 = Gossip(members = SortedSet(aUp, bUp, eJoining)).seen(aUp.uniqueAddress).seen(bUp.uniqueAddress) - diffMemberEvents(g1, g2) must be(Seq.empty) - diffUnreachable(g1, g2) must be(Seq.empty) - diffSeen(g1, g2) must be(Seq(SeenChanged(convergence = true, seenBy = Set(aUp.address, bUp.address)))) - diffMemberEvents(g2, g1) must be(Seq.empty) - diffUnreachable(g2, g1) must be(Seq.empty) - diffSeen(g2, g1) must be(Seq(SeenChanged(convergence = true, seenBy = Set(aUp.address, bUp.address, eJoining.address)))) + diffMemberEvents(g1, g2) should be(Seq.empty) + diffUnreachable(g1, g2) should be(Seq.empty) + diffSeen(g1, g2) should be(Seq(SeenChanged(convergence = true, seenBy = Set(aUp.address, bUp.address)))) + diffMemberEvents(g2, g1) should be(Seq.empty) + diffUnreachable(g2, g1) should be(Seq.empty) + diffSeen(g2, g1) should be(Seq(SeenChanged(convergence = true, seenBy = Set(aUp.address, bUp.address, eJoining.address)))) } "be produced for leader changes" in { val (g1, _) = converge(Gossip(members = SortedSet(aUp, bUp, eJoining))) val (g2, s2) = converge(Gossip(members = SortedSet(bUp, eJoining))) - diffMemberEvents(g1, g2) must be(Seq(MemberRemoved(aRemoved, Up))) - diffUnreachable(g1, g2) must be(Seq.empty) - diffSeen(g1, g2) must be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) - diffLeader(g1, g2) must be(Seq(LeaderChanged(Some(bUp.address)))) + diffMemberEvents(g1, g2) should be(Seq(MemberRemoved(aRemoved, Up))) + diffUnreachable(g1, g2) should be(Seq.empty) + diffSeen(g1, g2) should be(Seq(SeenChanged(convergence = true, seenBy = s2.map(_.address)))) + diffLeader(g1, g2) should be(Seq(LeaderChanged(Some(bUp.address)))) } "be produced for role leader changes" in { val g0 = Gossip.empty val g1 = Gossip(members = SortedSet(aUp, bUp, cUp, dLeaving, eJoining)) val g2 = Gossip(members = SortedSet(bUp, cUp, dExiting, eJoining)) - diffRolesLeader(g0, g1) must be( + diffRolesLeader(g0, g1) should be( Set(RoleLeaderChanged("AA", Some(aUp.address)), RoleLeaderChanged("AB", Some(aUp.address)), RoleLeaderChanged("BB", Some(bUp.address)), RoleLeaderChanged("DD", Some(dLeaving.address)), RoleLeaderChanged("DE", Some(dLeaving.address)), RoleLeaderChanged("EE", Some(eUp.address)))) - diffRolesLeader(g1, g2) must be( + diffRolesLeader(g1, g2) should be( Set(RoleLeaderChanged("AA", None), RoleLeaderChanged("AB", Some(bUp.address)), RoleLeaderChanged("DE", Some(eJoining.address)))) diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterHeartbeatSenderStateSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterHeartbeatSenderStateSpec.scala index 652d49a85a..0d52b367c3 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterHeartbeatSenderStateSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterHeartbeatSenderStateSpec.scala @@ -5,7 +5,7 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address import scala.concurrent.duration._ import scala.collection.immutable @@ -40,7 +40,7 @@ object ClusterHeartbeatSenderStateSpec { } @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { +class ClusterHeartbeatSenderStateSpec extends WordSpec with Matchers { import ClusterHeartbeatSenderStateSpec._ val aa = UniqueAddress(Address("akka.tcp", "sys", "aa", 2552), 1) @@ -63,49 +63,49 @@ class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { "A ClusterHeartbeatSenderState" must { "return empty active set when no nodes" in { - emptyState.activeReceivers.isEmpty must be(true) + emptyState.activeReceivers.isEmpty should be(true) } "init with empty" in { - emptyState.init(Set.empty).activeReceivers must be(Set.empty) + emptyState.init(Set.empty).activeReceivers should be(Set.empty) } "init with self" in { - emptyState.init(Set(aa, bb, cc)).activeReceivers must be(Set(bb, cc)) + emptyState.init(Set(aa, bb, cc)).activeReceivers should be(Set(bb, cc)) } "init without self" in { - emptyState.init(Set(bb, cc)).activeReceivers must be(Set(bb, cc)) + emptyState.init(Set(bb, cc)).activeReceivers should be(Set(bb, cc)) } "use added members" in { - emptyState.addMember(bb).addMember(cc).activeReceivers must be(Set(bb, cc)) + emptyState.addMember(bb).addMember(cc).activeReceivers should be(Set(bb, cc)) } "not use removed members" in { - emptyState.addMember(bb).addMember(cc).removeMember(bb).activeReceivers must be(Set(cc)) + emptyState.addMember(bb).addMember(cc).removeMember(bb).activeReceivers should be(Set(cc)) } "use specified number of members" in { // they are sorted by the hash (uid) of the UniqueAddress - emptyState.addMember(cc).addMember(dd).addMember(bb).addMember(ee).activeReceivers must be(Set(bb, cc, dd)) + emptyState.addMember(cc).addMember(dd).addMember(bb).addMember(ee).activeReceivers should be(Set(bb, cc, dd)) } "update failure detector in active set" in { val s1 = emptyState.addMember(bb).addMember(cc).addMember(dd) val s2 = s1.heartbeatRsp(bb).heartbeatRsp(cc).heartbeatRsp(dd).heartbeatRsp(ee) - s2.failureDetector.isMonitoring(bb.address) must be(true) - s2.failureDetector.isMonitoring(cc.address) must be(true) - s2.failureDetector.isMonitoring(dd.address) must be(true) - s2.failureDetector.isMonitoring(ee.address) must be(false) + s2.failureDetector.isMonitoring(bb.address) should be(true) + s2.failureDetector.isMonitoring(cc.address) should be(true) + s2.failureDetector.isMonitoring(dd.address) should be(true) + s2.failureDetector.isMonitoring(ee.address) should be(false) } "continue to use unreachable" in { val s1 = emptyState.addMember(cc).addMember(dd).addMember(ee) val s2 = s1.heartbeatRsp(cc).heartbeatRsp(dd).heartbeatRsp(ee) fd(s2, ee).markNodeAsUnavailable() - s2.failureDetector.isAvailable(ee.address) must be(false) - s2.addMember(bb).activeReceivers must be(Set(bb, cc, dd, ee)) + s2.failureDetector.isAvailable(ee.address) should be(false) + s2.addMember(bb).activeReceivers should be(Set(bb, cc, dd, ee)) } "remove unreachable when coming back" in { @@ -114,10 +114,10 @@ class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { fd(s2, dd).markNodeAsUnavailable() fd(s2, ee).markNodeAsUnavailable() val s3 = s2.addMember(bb) - s3.activeReceivers must be(Set(bb, cc, dd, ee)) + s3.activeReceivers should be(Set(bb, cc, dd, ee)) val s4 = s3.heartbeatRsp(bb).heartbeatRsp(cc).heartbeatRsp(dd).heartbeatRsp(ee) - s4.activeReceivers must be(Set(bb, cc, dd)) - s4.failureDetector.isMonitoring(ee.address) must be(false) + s4.activeReceivers should be(Set(bb, cc, dd)) + s4.failureDetector.isMonitoring(ee.address) should be(false) } "remove unreachable when member removed" in { @@ -126,11 +126,11 @@ class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { fd(s2, cc).markNodeAsUnavailable() fd(s2, ee).markNodeAsUnavailable() val s3 = s2.addMember(bb).heartbeatRsp(bb) - s3.activeReceivers must be(Set(bb, cc, dd, ee)) + s3.activeReceivers should be(Set(bb, cc, dd, ee)) val s4 = s3.removeMember(cc).removeMember(ee) - s4.activeReceivers must be(Set(bb, dd)) - s4.failureDetector.isMonitoring(cc.address) must be(false) - s4.failureDetector.isMonitoring(ee.address) must be(false) + s4.activeReceivers should be(Set(bb, dd)) + s4.failureDetector.isMonitoring(cc.address) should be(false) + s4.failureDetector.isMonitoring(ee.address) should be(false) } "behave correctly for random operations" in { @@ -153,9 +153,9 @@ class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { val oldUnreachable = state.unreachable state = state.addMember(node) // keep unreachable - (oldUnreachable -- state.activeReceivers) must be(Set.empty) - state.failureDetector.isMonitoring(node.address) must be(false) - state.failureDetector.isAvailable(node.address) must be(true) + (oldUnreachable -- state.activeReceivers) should be(Set.empty) + state.failureDetector.isMonitoring(node.address) should be(false) + state.failureDetector.isAvailable(node.address) should be(true) } case Remove ⇒ @@ -164,21 +164,21 @@ class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { state = state.removeMember(node) // keep unreachable, unless it was the removed if (oldUnreachable(node)) - (oldUnreachable -- state.activeReceivers) must be(Set(node)) + (oldUnreachable -- state.activeReceivers) should be(Set(node)) else - (oldUnreachable -- state.activeReceivers) must be(Set.empty) + (oldUnreachable -- state.activeReceivers) should be(Set.empty) - state.failureDetector.isMonitoring(node.address) must be(false) - state.failureDetector.isAvailable(node.address) must be(true) - state.activeReceivers must not contain (node) + state.failureDetector.isMonitoring(node.address) should be(false) + state.failureDetector.isAvailable(node.address) should be(true) + state.activeReceivers should not contain (node) } case Unreachable ⇒ if (node != selfUniqueAddress && state.activeReceivers(node)) { state.failureDetector.heartbeat(node.address) // make sure the fd is created fd(state, node).markNodeAsUnavailable() - state.failureDetector.isMonitoring(node.address) must be(true) - state.failureDetector.isAvailable(node.address) must be(false) + state.failureDetector.isMonitoring(node.address) should be(true) + state.failureDetector.isAvailable(node.address) should be(false) } case HeartbeatRsp ⇒ @@ -189,16 +189,16 @@ class ClusterHeartbeatSenderStateSpec extends WordSpec with MustMatchers { state = state.heartbeatRsp(node) if (oldUnreachable(node)) - state.unreachable must not contain (node) + state.unreachable should not contain (node) if (oldUnreachable(node) && !oldRingReceivers(node)) - state.failureDetector.isMonitoring(node.address) must be(false) + state.failureDetector.isMonitoring(node.address) should be(false) if (oldRingReceivers(node)) - state.failureDetector.isMonitoring(node.address) must be(true) + state.failureDetector.isMonitoring(node.address) should be(true) - state.ring.myReceivers must be(oldRingReceivers) - state.failureDetector.isAvailable(node.address) must be(true) + state.ring.myReceivers should be(oldRingReceivers) + state.failureDetector.isAvailable(node.address) should be(true) } diff --git a/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala index 7e8375713f..8992d30663 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ClusterSpec.scala @@ -48,24 +48,24 @@ class ClusterSpec extends AkkaSpec(ClusterSpec.config) with ImplicitSender { "A Cluster" must { "use the address of the remote transport" in { - cluster.selfAddress must be(selfAddress) + cluster.selfAddress should be(selfAddress) } "register jmx mbean" in { val name = new ObjectName("akka:type=Cluster") val info = ManagementFactory.getPlatformMBeanServer.getMBeanInfo(name) - info.getAttributes.length must be > (0) - info.getOperations.length must be > (0) + info.getAttributes.length should be > (0) + info.getOperations.length should be > (0) } "initially become singleton cluster when joining itself and reach convergence" in { - clusterView.members.size must be(0) + clusterView.members.size should be(0) cluster.join(selfAddress) leaderActions() // Joining -> Up awaitCond(clusterView.isSingletonCluster) - clusterView.self.address must be(selfAddress) - clusterView.members.map(_.address) must be(Set(selfAddress)) - awaitAssert(clusterView.status must be(MemberStatus.Up)) + clusterView.self.address should be(selfAddress) + clusterView.members.map(_.address) should be(Set(selfAddress)) + awaitAssert(clusterView.status should be(MemberStatus.Up)) } "publish CurrentClusterState to subscribers when requested" in { @@ -86,14 +86,14 @@ class ClusterSpec extends AkkaSpec(ClusterSpec.config) with ImplicitSender { expectMsgClass(classOf[ClusterEvent.CurrentClusterState]) } - // this must be the last test step, since the cluster is shutdown + // this should be the last test step, since the cluster is shutdown "publish MemberRemoved when shutdown" in { cluster.subscribe(testActor, classOf[ClusterEvent.MemberRemoved]) // first, is in response to the subscription expectMsgClass(classOf[ClusterEvent.CurrentClusterState]) cluster.shutdown() - expectMsgType[ClusterEvent.MemberRemoved].member.address must be(selfAddress) + expectMsgType[ClusterEvent.MemberRemoved].member.address should be(selfAddress) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/EWMASpec.scala b/akka-cluster/src/test/scala/akka/cluster/EWMASpec.scala index 519c07bc20..21984cc209 100644 --- a/akka-cluster/src/test/scala/akka/cluster/EWMASpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/EWMASpec.scala @@ -20,34 +20,34 @@ class EWMASpec extends AkkaSpec(MetricsEnabledSpec.config) with MetricsCollector "calcualate same ewma for constant values" in { val ds = EWMA(value = 100.0, alpha = 0.18) :+ 100.0 :+ 100.0 :+ 100.0 - ds.value must be(100.0 plusOrMinus 0.001) + ds.value should be(100.0 +- 0.001) } "calcualate correct ewma for normal decay" in { val d0 = EWMA(value = 1000.0, alpha = 2.0 / (1 + 10)) - d0.value must be(1000.0 plusOrMinus 0.01) + d0.value should be(1000.0 +- 0.01) val d1 = d0 :+ 10.0 - d1.value must be(820.0 plusOrMinus 0.01) + d1.value should be(820.0 +- 0.01) val d2 = d1 :+ 10.0 - d2.value must be(672.73 plusOrMinus 0.01) + d2.value should be(672.73 +- 0.01) val d3 = d2 :+ 10.0 - d3.value must be(552.23 plusOrMinus 0.01) + d3.value should be(552.23 +- 0.01) val d4 = d3 :+ 10.0 - d4.value must be(453.64 plusOrMinus 0.01) + d4.value should be(453.64 +- 0.01) val dn = (1 to 100).foldLeft(d0)((d, _) ⇒ d :+ 10.0) - dn.value must be(10.0 plusOrMinus 0.1) + dn.value should be(10.0 +- 0.1) } "calculate ewma for alpha 1.0, max bias towards latest value" in { val d0 = EWMA(value = 100.0, alpha = 1.0) - d0.value must be(100.0 plusOrMinus 0.01) + d0.value should be(100.0 +- 0.01) val d1 = d0 :+ 1.0 - d1.value must be(1.0 plusOrMinus 0.01) + d1.value should be(1.0 +- 0.01) val d2 = d1 :+ 57.0 - d2.value must be(57.0 plusOrMinus 0.01) + d2.value should be(57.0 +- 0.01) val d3 = d2 :+ 10.0 - d3.value must be(10.0 plusOrMinus 0.01) + d3.value should be(10.0 +- 0.01) } "calculate alpha from half-life and collect interval" in { @@ -58,21 +58,21 @@ class EWMASpec extends AkkaSpec(MetricsEnabledSpec.config) with MetricsCollector val halfLife = n.toDouble / 2.8854 val collectInterval = 1.second val halfLifeDuration = (halfLife * 1000).millis - EWMA.alpha(halfLifeDuration, collectInterval) must be(expectedAlpha plusOrMinus 0.001) + EWMA.alpha(halfLifeDuration, collectInterval) should be(expectedAlpha +- 0.001) } "calculate sane alpha from short half-life" in { val alpha = EWMA.alpha(1.millis, 3.seconds) - alpha must be <= (1.0) - alpha must be >= (0.0) - alpha must be(1.0 plusOrMinus 0.001) + alpha should be <= (1.0) + alpha should be >= (0.0) + alpha should be(1.0 +- 0.001) } "calculate sane alpha from long half-life" in { val alpha = EWMA.alpha(1.day, 3.seconds) - alpha must be <= (1.0) - alpha must be >= (0.0) - alpha must be(0.0 plusOrMinus 0.001) + alpha should be <= (1.0) + alpha should be >= (0.0) + alpha should be(0.0 +- 0.001) } "calculate the ewma for multiple, variable, data streams" taggedAs LongRunningTest in { @@ -88,8 +88,8 @@ class EWMASpec extends AkkaSpec(MetricsEnabledSpec.config) with MetricsCollector case Some(previous) ⇒ if (latest.isSmooth && latest.value != previous.value) { val updated = previous :+ latest - updated.isSmooth must be(true) - updated.smoothValue must not be (previous.smoothValue) + updated.isSmooth should be(true) + updated.smoothValue should not be (previous.smoothValue) Some(updated) } else None } diff --git a/akka-cluster/src/test/scala/akka/cluster/GossipSpec.scala b/akka-cluster/src/test/scala/akka/cluster/GossipSpec.scala index c989b245e6..4a99eb5179 100644 --- a/akka-cluster/src/test/scala/akka/cluster/GossipSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/GossipSpec.scala @@ -5,12 +5,12 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address import scala.collection.immutable.SortedSet @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class GossipSpec extends WordSpec with MustMatchers { +class GossipSpec extends WordSpec with Matchers { import MemberStatus._ @@ -29,7 +29,7 @@ class GossipSpec extends WordSpec with MustMatchers { "A Gossip" must { "reach convergence when it's empty" in { - Gossip.empty.convergence must be(true) + Gossip.empty.convergence should be(true) } "merge members by status priority" in { @@ -37,12 +37,12 @@ class GossipSpec extends WordSpec with MustMatchers { val g2 = Gossip(members = SortedSet(a2, c2, e2)) val merged1 = g1 merge g2 - merged1.members must be(SortedSet(a2, c1, e1)) - merged1.members.toSeq.map(_.status) must be(Seq(Up, Leaving, Up)) + merged1.members should be(SortedSet(a2, c1, e1)) + merged1.members.toSeq.map(_.status) should be(Seq(Up, Leaving, Up)) val merged2 = g2 merge g1 - merged2.members must be(SortedSet(a2, c1, e1)) - merged2.members.toSeq.map(_.status) must be(Seq(Up, Leaving, Up)) + merged2.members should be(SortedSet(a2, c1, e1)) + merged2.members.toSeq.map(_.status) should be(Seq(Up, Leaving, Up)) } @@ -53,10 +53,10 @@ class GossipSpec extends WordSpec with MustMatchers { val g2 = Gossip(members = SortedSet(a1, b1, c1, d1), overview = GossipOverview(reachability = r2)) val merged1 = g1 merge g2 - merged1.overview.reachability.allUnreachable must be(Set(a1.uniqueAddress, c1.uniqueAddress, d1.uniqueAddress)) + merged1.overview.reachability.allUnreachable should be(Set(a1.uniqueAddress, c1.uniqueAddress, d1.uniqueAddress)) val merged2 = g2 merge g1 - merged2.overview.reachability.allUnreachable must be(merged1.overview.reachability.allUnreachable) + merged2.overview.reachability.allUnreachable should be(merged1.overview.reachability.allUnreachable) } "merge members by removing removed members" in { @@ -67,18 +67,18 @@ class GossipSpec extends WordSpec with MustMatchers { val g2 = Gossip(members = SortedSet(a1, b1, c3), overview = GossipOverview(reachability = r2)) val merged1 = g1 merge g2 - merged1.members must be(SortedSet(a1, b1)) - merged1.overview.reachability.allUnreachable must be(Set(a1.uniqueAddress)) + merged1.members should be(SortedSet(a1, b1)) + merged1.overview.reachability.allUnreachable should be(Set(a1.uniqueAddress)) val merged2 = g2 merge g1 - merged2.overview.reachability.allUnreachable must be(merged1.overview.reachability.allUnreachable) - merged2.members must be(merged1.members) + merged2.overview.reachability.allUnreachable should be(merged1.overview.reachability.allUnreachable) + merged2.members should be(merged1.members) } "have leader as first member based on ordering, except Exiting status" in { - Gossip(members = SortedSet(c2, e2)).leader must be(Some(c2.uniqueAddress)) - Gossip(members = SortedSet(c3, e2)).leader must be(Some(e2.uniqueAddress)) - Gossip(members = SortedSet(c3)).leader must be(Some(c3.uniqueAddress)) + Gossip(members = SortedSet(c2, e2)).leader should be(Some(c2.uniqueAddress)) + Gossip(members = SortedSet(c3, e2)).leader should be(Some(e2.uniqueAddress)) + Gossip(members = SortedSet(c3)).leader should be(Some(c3.uniqueAddress)) } "merge seen table correctly" in { @@ -89,13 +89,13 @@ class GossipSpec extends WordSpec with MustMatchers { def checkMerged(merged: Gossip) { val seen = merged.overview.seen.toSeq - seen.length must be(0) + seen.length should be(0) - merged seenByNode (a1.uniqueAddress) must be(false) - merged seenByNode (b1.uniqueAddress) must be(false) - merged seenByNode (c1.uniqueAddress) must be(false) - merged seenByNode (d1.uniqueAddress) must be(false) - merged seenByNode (e1.uniqueAddress) must be(false) + merged seenByNode (a1.uniqueAddress) should be(false) + merged seenByNode (b1.uniqueAddress) should be(false) + merged seenByNode (c1.uniqueAddress) should be(false) + merged seenByNode (d1.uniqueAddress) should be(false) + merged seenByNode (e1.uniqueAddress) should be(false) } checkMerged(g3 merge g2) @@ -106,12 +106,12 @@ class GossipSpec extends WordSpec with MustMatchers { // a2 and e1 is Joining val g1 = Gossip(members = SortedSet(a2, b1.copyUp(3), e1), overview = GossipOverview(reachability = Reachability.empty.unreachable(a2.uniqueAddress, e1.uniqueAddress))) - g1.youngestMember must be(b1) + g1.youngestMember should be(b1) val g2 = Gossip(members = SortedSet(a2, b1.copyUp(3), e1), overview = GossipOverview(reachability = Reachability.empty.unreachable(a2.uniqueAddress, b1.uniqueAddress).unreachable(a2.uniqueAddress, e1.uniqueAddress))) - g2.youngestMember must be(b1) + g2.youngestMember should be(b1) val g3 = Gossip(members = SortedSet(a2, b1.copyUp(3), e2.copyUp(4))) - g3.youngestMember must be(e2) + g3.youngestMember should be(e2) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingPerfSpec.scala b/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingPerfSpec.scala index 74c217d3fe..44862a304e 100644 --- a/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingPerfSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingPerfSpec.scala @@ -6,11 +6,11 @@ package akka.cluster import scala.collection.immutable.HashSet import scala.concurrent.duration.Deadline import org.scalatest.WordSpec -import org.scalatest.matchers.ShouldMatchers +import org.scalatest.Matchers import akka.actor.Address @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class HeartbeatNodeRingPerfSpec extends WordSpec with ShouldMatchers { +class HeartbeatNodeRingPerfSpec extends WordSpec with Matchers { val nodesSize = sys.props.get("akka.cluster.HeartbeatNodeRingPerfSpec.nodesSize").getOrElse("250").toInt val iterations = sys.props.get("akka.cluster.HeartbeatNodeRingPerfSpec.iterations").getOrElse("10000").toInt diff --git a/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingSpec.scala b/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingSpec.scala index a710fec57d..f75d88c730 100644 --- a/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/HeartbeatNodeRingSpec.scala @@ -5,14 +5,14 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address import akka.routing.ConsistentHash import scala.concurrent.duration._ import scala.collection.immutable @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class HeartbeatNodeRingSpec extends WordSpec with MustMatchers { +class HeartbeatNodeRingSpec extends WordSpec with Matchers { val aa = UniqueAddress(Address("akka.tcp", "sys", "aa", 2552), 1) val bb = UniqueAddress(Address("akka.tcp", "sys", "bb", 2552), 2) @@ -26,25 +26,25 @@ class HeartbeatNodeRingSpec extends WordSpec with MustMatchers { "pick specified number of nodes as receivers" in { val ring = HeartbeatNodeRing(cc, nodes, 3) - ring.myReceivers must be(ring.receivers(cc)) + ring.myReceivers should be(ring.receivers(cc)) nodes foreach { n ⇒ val receivers = ring.receivers(n) - receivers.size must be(3) - receivers must not contain (n) + receivers.size should be(3) + receivers should not contain (n) } } "pick all except own as receivers when less than total number of nodes" in { val expected = Set(aa, bb, dd, ee) - HeartbeatNodeRing(cc, nodes, 4).myReceivers must be(expected) - HeartbeatNodeRing(cc, nodes, 5).myReceivers must be(expected) - HeartbeatNodeRing(cc, nodes, 6).myReceivers must be(expected) + HeartbeatNodeRing(cc, nodes, 4).myReceivers should be(expected) + HeartbeatNodeRing(cc, nodes, 5).myReceivers should be(expected) + HeartbeatNodeRing(cc, nodes, 6).myReceivers should be(expected) } "pick none when alone" in { val ring = HeartbeatNodeRing(cc, Set(cc), 3) - ring.myReceivers must be(Set()) + ring.myReceivers should be(Set()) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/MemberOrderingSpec.scala b/akka-cluster/src/test/scala/akka/cluster/MemberOrderingSpec.scala index 17db59c43a..f1ee827a1c 100644 --- a/akka-cluster/src/test/scala/akka/cluster/MemberOrderingSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/MemberOrderingSpec.scala @@ -6,13 +6,13 @@ package akka.cluster import akka.actor.{ Address, AddressFromURIString } import java.net.InetSocketAddress -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.WordSpec import scala.collection.immutable.SortedSet import scala.util.Random @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class MemberOrderingSpec extends WordSpec with MustMatchers { +class MemberOrderingSpec extends WordSpec with Matchers { import Member.ordering import Member.addressOrdering import MemberStatus._ @@ -28,10 +28,10 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { m(AddressFromURIString("akka://sys@darkstar:1111"), Up) val seq = members.toSeq - seq.size must equal(3) - seq(0) must equal(m(AddressFromURIString("akka://sys@darkstar:1111"), Up)) - seq(1) must equal(m(AddressFromURIString("akka://sys@darkstar:1112"), Up)) - seq(2) must equal(m(AddressFromURIString("akka://sys@darkstar:1113"), Joining)) + seq.size should equal(3) + seq(0) should equal(m(AddressFromURIString("akka://sys@darkstar:1111"), Up)) + seq(1) should equal(m(AddressFromURIString("akka://sys@darkstar:1112"), Up)) + seq(2) should equal(m(AddressFromURIString("akka://sys@darkstar:1113"), Joining)) } "be sorted by address correctly" in { @@ -45,8 +45,8 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { val expected = IndexedSeq(m1, m2, m3, m4, m5) val shuffled = Random.shuffle(expected) - shuffled.sorted must be(expected) - (SortedSet.empty[Member] ++ shuffled).toIndexedSeq must be(expected) + shuffled.sorted should be(expected) + (SortedSet.empty[Member] ++ shuffled).toIndexedSeq should be(expected) } "have stable equals and hashCode" in { @@ -57,18 +57,18 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { val m22 = m11.copy(status = Up) val m3 = m(address.copy(port = Some(10000)), Up) - m1 must be(m2) - m1.hashCode must be(m2.hashCode) + m1 should be(m2) + m1.hashCode should be(m2.hashCode) - m3 must not be (m2) - m3 must not be (m1) + m3 should not be (m2) + m3 should not be (m1) - m11 must be(m22) - m11.hashCode must be(m22.hashCode) + m11 should be(m22) + m11.hashCode should be(m22.hashCode) // different uid - m1 must not be (m11) - m2 must not be (m22) + m1 should not be (m11) + m2 should not be (m22) } "have consistent ordering and equals" in { @@ -78,14 +78,14 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { val x = m(address1, Exiting) val y = m(address1, Removed) val z = m(address2, Up) - Member.ordering.compare(x, y) must be(0) - Member.ordering.compare(x, z) must be(Member.ordering.compare(y, z)) + Member.ordering.compare(x, y) should be(0) + Member.ordering.compare(x, z) should be(Member.ordering.compare(y, z)) // different uid val a = m(address1, Joining) val b = Member(UniqueAddress(address1, -3), Set.empty) - Member.ordering.compare(a, b) must be(1) - Member.ordering.compare(b, a) must be(-1) + Member.ordering.compare(a, b) should be(1) + Member.ordering.compare(b, a) should be(-1) } @@ -94,10 +94,10 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { val address2 = address1.copy(port = Some(9002)) val address3 = address1.copy(port = Some(9003)) - (SortedSet(m(address1, Joining)) - m(address1, Up)) must be(SortedSet.empty[Member]) - (SortedSet(m(address1, Exiting)) - m(address1, Removed)) must be(SortedSet.empty[Member]) - (SortedSet(m(address1, Up)) - m(address1, Exiting)) must be(SortedSet.empty[Member]) - (SortedSet(m(address2, Up), m(address3, Joining), m(address1, Exiting)) - m(address1, Removed)) must be( + (SortedSet(m(address1, Joining)) - m(address1, Up)) should be(SortedSet.empty[Member]) + (SortedSet(m(address1, Exiting)) - m(address1, Removed)) should be(SortedSet.empty[Member]) + (SortedSet(m(address1, Up)) - m(address1, Exiting)) should be(SortedSet.empty[Member]) + (SortedSet(m(address2, Up), m(address3, Joining), m(address1, Exiting)) - m(address1, Removed)) should be( SortedSet(m(address2, Up), m(address3, Joining))) } @@ -113,11 +113,11 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { AddressFromURIString("akka://sys@darkstar:1111") val seq = addresses.toSeq - seq.size must equal(4) - seq(0) must equal(AddressFromURIString("akka://sys@darkstar:1110")) - seq(1) must equal(AddressFromURIString("akka://sys@darkstar:1111")) - seq(2) must equal(AddressFromURIString("akka://sys@darkstar:1112")) - seq(3) must equal(AddressFromURIString("akka://sys@darkstar:1113")) + seq.size should equal(4) + seq(0) should equal(AddressFromURIString("akka://sys@darkstar:1110")) + seq(1) should equal(AddressFromURIString("akka://sys@darkstar:1111")) + seq(2) should equal(AddressFromURIString("akka://sys@darkstar:1112")) + seq(3) should equal(AddressFromURIString("akka://sys@darkstar:1113")) } "order addresses by hostname" in { @@ -128,11 +128,11 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { AddressFromURIString("akka://sys@darkstar0:1110") val seq = addresses.toSeq - seq.size must equal(4) - seq(0) must equal(AddressFromURIString("akka://sys@darkstar0:1110")) - seq(1) must equal(AddressFromURIString("akka://sys@darkstar1:1110")) - seq(2) must equal(AddressFromURIString("akka://sys@darkstar2:1110")) - seq(3) must equal(AddressFromURIString("akka://sys@darkstar3:1110")) + seq.size should equal(4) + seq(0) should equal(AddressFromURIString("akka://sys@darkstar0:1110")) + seq(1) should equal(AddressFromURIString("akka://sys@darkstar1:1110")) + seq(2) should equal(AddressFromURIString("akka://sys@darkstar2:1110")) + seq(3) should equal(AddressFromURIString("akka://sys@darkstar3:1110")) } "order addresses by hostname and port" in { @@ -143,11 +143,11 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { AddressFromURIString("akka://sys@darkstar0:1110") val seq = addresses.toSeq - seq.size must equal(4) - seq(0) must equal(AddressFromURIString("akka://sys@darkstar0:1110")) - seq(1) must equal(AddressFromURIString("akka://sys@darkstar0:1111")) - seq(2) must equal(AddressFromURIString("akka://sys@darkstar2:1110")) - seq(3) must equal(AddressFromURIString("akka://sys@darkstar2:1111")) + seq.size should equal(4) + seq(0) should equal(AddressFromURIString("akka://sys@darkstar0:1110")) + seq(1) should equal(AddressFromURIString("akka://sys@darkstar0:1111")) + seq(2) should equal(AddressFromURIString("akka://sys@darkstar2:1110")) + seq(3) should equal(AddressFromURIString("akka://sys@darkstar2:1111")) } } @@ -165,7 +165,7 @@ class MemberOrderingSpec extends WordSpec with MustMatchers { val m8 = m(address.copy(port = Some(9000)), Up) val expected = IndexedSeq(m7, m8, m1, m2, m3, m4, m5, m6) val shuffled = Random.shuffle(expected) - shuffled.sorted(Member.leaderStatusOrdering) must be(expected) + shuffled.sorted(Member.leaderStatusOrdering) should be(expected) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/MetricNumericConverterSpec.scala b/akka-cluster/src/test/scala/akka/cluster/MetricNumericConverterSpec.scala index 20ad0e62bd..e50717d691 100644 --- a/akka-cluster/src/test/scala/akka/cluster/MetricNumericConverterSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/MetricNumericConverterSpec.scala @@ -5,45 +5,45 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.cluster.StandardMetrics._ import scala.util.Failure @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class MetricNumericConverterSpec extends WordSpec with MustMatchers with MetricNumericConverter { +class MetricNumericConverterSpec extends WordSpec with Matchers with MetricNumericConverter { "MetricNumericConverter" must { "convert" in { - convertNumber(0).isLeft must be(true) - convertNumber(1).left.get must be(1) - convertNumber(1L).isLeft must be(true) - convertNumber(0.0).isRight must be(true) + convertNumber(0).isLeft should be(true) + convertNumber(1).left.get should be(1) + convertNumber(1L).isLeft should be(true) + convertNumber(0.0).isRight should be(true) } "define a new metric" in { val Some(metric) = Metric.create(HeapMemoryUsed, 256L, decayFactor = Some(0.18)) - metric.name must be(HeapMemoryUsed) - metric.value must be(256L) - metric.isSmooth must be(true) - metric.smoothValue must be(256.0 plusOrMinus 0.0001) + metric.name should be(HeapMemoryUsed) + metric.value should be(256L) + metric.isSmooth should be(true) + metric.smoothValue should be(256.0 +- 0.0001) } "define an undefined value with a None " in { - Metric.create("x", -1, None).isDefined must be(false) - Metric.create("x", java.lang.Double.NaN, None).isDefined must be(false) - Metric.create("x", Failure(new RuntimeException), None).isDefined must be(false) + Metric.create("x", -1, None).isDefined should be(false) + Metric.create("x", java.lang.Double.NaN, None).isDefined should be(false) + Metric.create("x", Failure(new RuntimeException), None).isDefined should be(false) } "recognize whether a metric value is defined" in { - defined(0) must be(true) - defined(0.0) must be(true) + defined(0) should be(true) + defined(0.0) should be(true) } "recognize whether a metric value is not defined" in { - defined(-1) must be(false) - defined(-1.0) must be(false) - defined(Double.NaN) must be(false) + defined(-1) should be(false) + defined(-1.0) should be(false) + defined(Double.NaN) should be(false) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/MetricValuesSpec.scala b/akka-cluster/src/test/scala/akka/cluster/MetricValuesSpec.scala index 9358ad0e91..7d4141486d 100644 --- a/akka-cluster/src/test/scala/akka/cluster/MetricValuesSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/MetricValuesSpec.scala @@ -31,33 +31,33 @@ class MetricValuesSpec extends AkkaSpec(MetricsEnabledSpec.config) with MetricsC "extract expected metrics for load balancing" in { val stream1 = node2.metric(HeapMemoryCommitted).get.value.longValue val stream2 = node1.metric(HeapMemoryUsed).get.value.longValue - stream1 must be >= (stream2) + stream1 should be >= (stream2) } "extract expected MetricValue types for load balancing" in { nodes foreach { node ⇒ node match { case HeapMemory(address, _, used, committed, _) ⇒ - used must be > (0L) - committed must be >= (used) + used should be > (0L) + committed should be >= (used) // Documentation java.lang.management.MemoryUsage says that committed <= max, // but in practice that is not always true (we have seen it happen). Therefore // we don't check the heap max value in this test. // extract is the java api - StandardMetrics.extractHeapMemory(node) must not be (null) + StandardMetrics.extractHeapMemory(node) should not be (null) } node match { case Cpu(address, _, systemLoadAverageOption, cpuCombinedOption, processors) ⇒ - processors must be > (0) + processors should be > (0) if (systemLoadAverageOption.isDefined) - systemLoadAverageOption.get must be >= (0.0) + systemLoadAverageOption.get should be >= (0.0) if (cpuCombinedOption.isDefined) { - cpuCombinedOption.get must be <= (1.0) - cpuCombinedOption.get must be >= (0.0) + cpuCombinedOption.get should be <= (1.0) + cpuCombinedOption.get should be >= (0.0) } // extract is the java api - StandardMetrics.extractCpu(node) must not be (null) + StandardMetrics.extractCpu(node) should not be (null) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/MetricsCollectorSpec.scala b/akka-cluster/src/test/scala/akka/cluster/MetricsCollectorSpec.scala index 8d6cce9c72..23a0b59259 100644 --- a/akka-cluster/src/test/scala/akka/cluster/MetricsCollectorSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/MetricsCollectorSpec.scala @@ -16,7 +16,7 @@ import akka.actor._ import akka.testkit._ import akka.cluster.StandardMetrics._ import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers object MetricsEnabledSpec { val config = """ @@ -42,8 +42,8 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsEnabledSpec.config) with Impl val merged12 = sample2 flatMap (latest ⇒ sample1 collect { case peer if latest sameAs peer ⇒ val m = peer :+ latest - m.value must be(latest.value) - m.isSmooth must be(peer.isSmooth || latest.isSmooth) + m.value should be(latest.value) + m.isSmooth should be(peer.isSmooth || latest.isSmooth) m }) @@ -52,8 +52,8 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsEnabledSpec.config) with Impl val merged34 = sample4 flatMap (latest ⇒ sample3 collect { case peer if latest sameAs peer ⇒ val m = peer :+ latest - m.value must be(latest.value) - m.isSmooth must be(peer.isSmooth || latest.isSmooth) + m.value should be(latest.value) + m.isSmooth should be(peer.isSmooth || latest.isSmooth) m }) } @@ -63,7 +63,7 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsEnabledSpec.config) with Impl "MetricsCollector" must { "not raise errors when attempting reflective code in apply" in { - Try(createMetricsCollector).get must not be null + Try(createMetricsCollector).get should not be null } "collect accurate metrics for a node" in { @@ -72,17 +72,17 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsEnabledSpec.config) with Impl val used = metrics collectFirst { case (HeapMemoryUsed, b) ⇒ b } val committed = metrics collectFirst { case (HeapMemoryCommitted, b) ⇒ b } metrics foreach { - case (SystemLoadAverage, b) ⇒ b.doubleValue must be >= (0.0) - case (Processors, b) ⇒ b.intValue must be >= (0) - case (HeapMemoryUsed, b) ⇒ b.longValue must be >= (0L) - case (HeapMemoryCommitted, b) ⇒ b.longValue must be > (0L) + case (SystemLoadAverage, b) ⇒ b.doubleValue should be >= (0.0) + case (Processors, b) ⇒ b.intValue should be >= (0) + case (HeapMemoryUsed, b) ⇒ b.longValue should be >= (0L) + case (HeapMemoryCommitted, b) ⇒ b.longValue should be > (0L) case (HeapMemoryMax, b) ⇒ - b.longValue must be > (0L) - used.get.longValue must be <= (b.longValue) - committed.get.longValue must be <= (b.longValue) + b.longValue should be > (0L) + used.get.longValue should be <= (b.longValue) + committed.get.longValue should be <= (b.longValue) case (CpuCombined, b) ⇒ - b.doubleValue must be <= (1.0) - b.doubleValue must be >= (0.0) + b.doubleValue should be <= (1.0) + b.doubleValue should be >= (0.0) } } @@ -93,15 +93,15 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsEnabledSpec.config) with Impl // it's not present on all platforms val c = collector.asInstanceOf[JmxMetricsCollector] val heap = c.heapMemoryUsage - c.heapUsed(heap).isDefined must be(true) - c.heapCommitted(heap).isDefined must be(true) - c.processors.isDefined must be(true) + c.heapUsed(heap).isDefined should be(true) + c.heapCommitted(heap).isDefined should be(true) + c.processors.isDefined should be(true) } "collect 50 node metrics samples in an acceptable duration" taggedAs LongRunningTest in within(10 seconds) { (1 to 50) foreach { _ ⇒ val sample = collector.sample - sample.metrics.size must be >= (3) + sample.metrics.size should be >= (3) Thread.sleep(100) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/MetricsGossipSpec.scala b/akka-cluster/src/test/scala/akka/cluster/MetricsGossipSpec.scala index a0d9733479..922d5c4639 100644 --- a/akka-cluster/src/test/scala/akka/cluster/MetricsGossipSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/MetricsGossipSpec.scala @@ -21,17 +21,17 @@ class MetricsGossipSpec extends AkkaSpec(MetricsEnabledSpec.config) with Implici val m1 = NodeMetrics(Address("akka.tcp", "sys", "a", 2554), newTimestamp, collector.sample.metrics) val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics) - m1.metrics.size must be > (3) - m2.metrics.size must be > (3) + m1.metrics.size should be > (3) + m2.metrics.size should be > (3) val g1 = MetricsGossip.empty :+ m1 - g1.nodes.size must be(1) - g1.nodeMetricsFor(m1.address).map(_.metrics) must be(Some(m1.metrics)) + g1.nodes.size should be(1) + g1.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics)) val g2 = g1 :+ m2 - g2.nodes.size must be(2) - g2.nodeMetricsFor(m1.address).map(_.metrics) must be(Some(m1.metrics)) - g2.nodeMetricsFor(m2.address).map(_.metrics) must be(Some(m2.metrics)) + g2.nodes.size should be(2) + g2.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics)) + g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2.metrics)) } "merge peer metrics" in { @@ -39,15 +39,15 @@ class MetricsGossipSpec extends AkkaSpec(MetricsEnabledSpec.config) with Implici val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics) val g1 = MetricsGossip.empty :+ m1 :+ m2 - g1.nodes.size must be(2) + g1.nodes.size should be(2) val beforeMergeNodes = g1.nodes val m2Updated = m2 copy (metrics = collector.sample.metrics, timestamp = m2.timestamp + 1000) val g2 = g1 :+ m2Updated // merge peers - g2.nodes.size must be(2) - g2.nodeMetricsFor(m1.address).map(_.metrics) must be(Some(m1.metrics)) - g2.nodeMetricsFor(m2.address).map(_.metrics) must be(Some(m2Updated.metrics)) - g2.nodes collect { case peer if peer.address == m2.address ⇒ peer.timestamp must be(m2Updated.timestamp) } + g2.nodes.size should be(2) + g2.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics)) + g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2Updated.metrics)) + g2.nodes collect { case peer if peer.address == m2.address ⇒ peer.timestamp should be(m2Updated.timestamp) } } "merge an existing metric set for a node and update node ring" in { @@ -59,22 +59,22 @@ class MetricsGossipSpec extends AkkaSpec(MetricsEnabledSpec.config) with Implici val g1 = MetricsGossip.empty :+ m1 :+ m2 val g2 = MetricsGossip.empty :+ m3 :+ m2Updated - g1.nodes.map(_.address) must be(Set(m1.address, m2.address)) + g1.nodes.map(_.address) should be(Set(m1.address, m2.address)) - // must contain nodes 1,3, and the most recent version of 2 + // should contain nodes 1,3, and the most recent version of 2 val mergedGossip = g1 merge g2 - mergedGossip.nodes.map(_.address) must be(Set(m1.address, m2.address, m3.address)) - mergedGossip.nodeMetricsFor(m1.address).map(_.metrics) must be(Some(m1.metrics)) - mergedGossip.nodeMetricsFor(m2.address).map(_.metrics) must be(Some(m2Updated.metrics)) - mergedGossip.nodeMetricsFor(m3.address).map(_.metrics) must be(Some(m3.metrics)) - mergedGossip.nodes.foreach(_.metrics.size must be > (3)) - mergedGossip.nodeMetricsFor(m2.address).map(_.timestamp) must be(Some(m2Updated.timestamp)) + mergedGossip.nodes.map(_.address) should be(Set(m1.address, m2.address, m3.address)) + mergedGossip.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics)) + mergedGossip.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2Updated.metrics)) + mergedGossip.nodeMetricsFor(m3.address).map(_.metrics) should be(Some(m3.metrics)) + mergedGossip.nodes.foreach(_.metrics.size should be > (3)) + mergedGossip.nodeMetricsFor(m2.address).map(_.timestamp) should be(Some(m2Updated.timestamp)) } "get the current NodeMetrics if it exists in the local nodes" in { val m1 = NodeMetrics(Address("akka.tcp", "sys", "a", 2554), newTimestamp, collector.sample.metrics) val g1 = MetricsGossip.empty :+ m1 - g1.nodeMetricsFor(m1.address).map(_.metrics) must be(Some(m1.metrics)) + g1.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics)) } "remove a node if it is no longer Up" in { @@ -82,12 +82,12 @@ class MetricsGossipSpec extends AkkaSpec(MetricsEnabledSpec.config) with Implici val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics) val g1 = MetricsGossip.empty :+ m1 :+ m2 - g1.nodes.size must be(2) + g1.nodes.size should be(2) val g2 = g1 remove m1.address - g2.nodes.size must be(1) - g2.nodes.exists(_.address == m1.address) must be(false) - g2.nodeMetricsFor(m1.address) must be(None) - g2.nodeMetricsFor(m2.address).map(_.metrics) must be(Some(m2.metrics)) + g2.nodes.size should be(1) + g2.nodes.exists(_.address == m1.address) should be(false) + g2.nodeMetricsFor(m1.address) should be(None) + g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2.metrics)) } "filter nodes" in { @@ -95,12 +95,12 @@ class MetricsGossipSpec extends AkkaSpec(MetricsEnabledSpec.config) with Implici val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics) val g1 = MetricsGossip.empty :+ m1 :+ m2 - g1.nodes.size must be(2) + g1.nodes.size should be(2) val g2 = g1 filter Set(m2.address) - g2.nodes.size must be(1) - g2.nodes.exists(_.address == m1.address) must be(false) - g2.nodeMetricsFor(m1.address) must be(None) - g2.nodeMetricsFor(m2.address).map(_.metrics) must be(Some(m2.metrics)) + g2.nodes.size should be(1) + g2.nodes.exists(_.address == m1.address) should be(false) + g2.nodeMetricsFor(m1.address) should be(None) + g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2.metrics)) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/NodeMetricsSpec.scala b/akka-cluster/src/test/scala/akka/cluster/NodeMetricsSpec.scala index 43b1aaf503..5f1d3990c1 100644 --- a/akka-cluster/src/test/scala/akka/cluster/NodeMetricsSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/NodeMetricsSpec.scala @@ -5,11 +5,11 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class NodeMetricsSpec extends WordSpec with MustMatchers { +class NodeMetricsSpec extends WordSpec with Matchers { val node1 = Address("akka.tcp", "sys", "a", 2554) val node2 = Address("akka.tcp", "sys", "a", 2555) @@ -17,11 +17,11 @@ class NodeMetricsSpec extends WordSpec with MustMatchers { "NodeMetrics must" must { "return correct result for 2 'same' nodes" in { - (NodeMetrics(node1, 0) sameAs NodeMetrics(node1, 0)) must be(true) + (NodeMetrics(node1, 0) sameAs NodeMetrics(node1, 0)) should be(true) } "return correct result for 2 not 'same' nodes" in { - (NodeMetrics(node1, 0) sameAs NodeMetrics(node2, 0)) must be(false) + (NodeMetrics(node1, 0) sameAs NodeMetrics(node2, 0)) should be(false) } "merge 2 NodeMetrics by most recent" in { @@ -29,10 +29,10 @@ class NodeMetricsSpec extends WordSpec with MustMatchers { val sample2 = NodeMetrics(node1, 2, Set(Metric.create("a", 11, None), Metric.create("c", 30, None)).flatten) val merged = sample1 merge sample2 - merged.timestamp must be(sample2.timestamp) - merged.metric("a").map(_.value) must be(Some(11)) - merged.metric("b").map(_.value) must be(Some(20)) - merged.metric("c").map(_.value) must be(Some(30)) + merged.timestamp should be(sample2.timestamp) + merged.metric("a").map(_.value) should be(Some(11)) + merged.metric("b").map(_.value) should be(Some(20)) + merged.metric("c").map(_.value) should be(Some(30)) } "not merge 2 NodeMetrics if master is more recent" in { @@ -40,8 +40,8 @@ class NodeMetricsSpec extends WordSpec with MustMatchers { val sample2 = NodeMetrics(node1, 0, Set(Metric.create("a", 11, None), Metric.create("c", 30, None)).flatten) val merged = sample1 merge sample2 // older and not same - merged.timestamp must be(sample1.timestamp) - merged.metrics must be(sample1.metrics) + merged.timestamp should be(sample1.timestamp) + merged.metrics should be(sample1.metrics) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/ReachabilityPerfSpec.scala b/akka-cluster/src/test/scala/akka/cluster/ReachabilityPerfSpec.scala index b217be3440..7f0b29c15b 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ReachabilityPerfSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ReachabilityPerfSpec.scala @@ -4,11 +4,11 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.ShouldMatchers +import org.scalatest.Matchers import akka.actor.Address @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class ReachabilityPerfSpec extends WordSpec with ShouldMatchers { +class ReachabilityPerfSpec extends WordSpec with Matchers { val nodesSize = sys.props.get("akka.cluster.ReachabilityPerfSpec.nodesSize").getOrElse("250").toInt val iterations = sys.props.get("akka.cluster.ReachabilityPerfSpec.iterations").getOrElse("10000").toInt diff --git a/akka-cluster/src/test/scala/akka/cluster/ReachabilitySpec.scala b/akka-cluster/src/test/scala/akka/cluster/ReachabilitySpec.scala index 0f6967b74b..49aaba3e97 100644 --- a/akka-cluster/src/test/scala/akka/cluster/ReachabilitySpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/ReachabilitySpec.scala @@ -5,11 +5,11 @@ package akka.cluster import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class ReachabilitySpec extends WordSpec with MustMatchers { +class ReachabilitySpec extends WordSpec with Matchers { import Reachability.{ Reachable, Unreachable, Terminated, Record } @@ -23,45 +23,45 @@ class ReachabilitySpec extends WordSpec with MustMatchers { "be reachable when empty" in { val r = Reachability.empty - r.isReachable(nodeA) must be(true) - r.allUnreachable must be(Set.empty) + r.isReachable(nodeA) should be(true) + r.allUnreachable should be(Set.empty) } "be unreachable when one observed unreachable" in { val r = Reachability.empty.unreachable(nodeB, nodeA) - r.isReachable(nodeA) must be(false) - r.allUnreachable must be(Set(nodeA)) + r.isReachable(nodeA) should be(false) + r.allUnreachable should be(Set(nodeA)) } "not be reachable when terminated" in { val r = Reachability.empty.terminated(nodeB, nodeA) - r.isReachable(nodeA) must be(false) + r.isReachable(nodeA) should be(false) // allUnreachable doesn't include terminated - r.allUnreachable must be(Set.empty) - r.allUnreachableOrTerminated must be(Set(nodeA)) + r.allUnreachable should be(Set.empty) + r.allUnreachableOrTerminated should be(Set(nodeA)) } "not change terminated entry" in { val r = Reachability.empty.terminated(nodeB, nodeA) - r.reachable(nodeB, nodeA) must be theSameInstanceAs (r) - r.unreachable(nodeB, nodeA) must be theSameInstanceAs (r) + r.reachable(nodeB, nodeA) should be theSameInstanceAs (r) + r.unreachable(nodeB, nodeA) should be theSameInstanceAs (r) } "not change when same status" in { val r = Reachability.empty.unreachable(nodeB, nodeA) - r.unreachable(nodeB, nodeA) must be theSameInstanceAs (r) + r.unreachable(nodeB, nodeA) should be theSameInstanceAs (r) } "be unreachable when some observed unreachable and others reachable" in { val r = Reachability.empty.unreachable(nodeB, nodeA).unreachable(nodeC, nodeA).reachable(nodeD, nodeA) - r.isReachable(nodeA) must be(false) + r.isReachable(nodeA) should be(false) } "be reachable when all observed reachable again" in { val r = Reachability.empty.unreachable(nodeB, nodeA).unreachable(nodeC, nodeA). reachable(nodeB, nodeA).reachable(nodeC, nodeA). unreachable(nodeB, nodeC).unreachable(nodeC, nodeB) - r.isReachable(nodeA) must be(true) + r.isReachable(nodeA) should be(true) } "be pruned when all records of an observer are Reachable" in { @@ -69,12 +69,12 @@ class ReachabilitySpec extends WordSpec with MustMatchers { unreachable(nodeB, nodeA).unreachable(nodeB, nodeC). unreachable(nodeD, nodeC). reachable(nodeB, nodeA).reachable(nodeB, nodeC) - r.isReachable(nodeA) must be(true) - r.isReachable(nodeC) must be(false) - r.records must be(Vector(Record(nodeD, nodeC, Unreachable, 1L))) + r.isReachable(nodeA) should be(true) + r.isReachable(nodeC) should be(false) + r.records should be(Vector(Record(nodeD, nodeC, Unreachable, 1L))) val r2 = r.unreachable(nodeB, nodeD).unreachable(nodeB, nodeE) - r2.records.toSet must be(Set( + r2.records.toSet should be(Set( Record(nodeD, nodeC, Unreachable, 1L), Record(nodeB, nodeD, Unreachable, 5L), Record(nodeB, nodeE, Unreachable, 6L))) @@ -88,9 +88,9 @@ class ReachabilitySpec extends WordSpec with MustMatchers { Reachability.Record(nodeD, nodeB, Terminated, 4)) val versions = Map(nodeA -> 3L, nodeC -> 3L, nodeD -> 4L) val r = Reachability(records, versions) - r.status(nodeA) must be(Reachable) - r.status(nodeB) must be(Terminated) - r.status(nodeD) must be(Unreachable) + r.status(nodeA) should be(Reachable) + r.status(nodeB) should be(Terminated) + r.status(nodeD) should be(Unreachable) } "have correct status for a mix of nodes" in { @@ -101,29 +101,29 @@ class ReachabilitySpec extends WordSpec with MustMatchers { reachable(nodeE, nodeD). unreachable(nodeA, nodeE).terminated(nodeB, nodeE) - r.status(nodeB, nodeA) must be(Unreachable) - r.status(nodeC, nodeA) must be(Unreachable) - r.status(nodeD, nodeA) must be(Unreachable) + r.status(nodeB, nodeA) should be(Unreachable) + r.status(nodeC, nodeA) should be(Unreachable) + r.status(nodeD, nodeA) should be(Unreachable) - r.status(nodeC, nodeB) must be(Reachable) - r.status(nodeD, nodeB) must be(Unreachable) + r.status(nodeC, nodeB) should be(Reachable) + r.status(nodeD, nodeB) should be(Unreachable) - r.status(nodeA, nodeE) must be(Unreachable) - r.status(nodeB, nodeE) must be(Terminated) + r.status(nodeA, nodeE) should be(Unreachable) + r.status(nodeB, nodeE) should be(Terminated) - r.isReachable(nodeA) must be(false) - r.isReachable(nodeB) must be(false) - r.isReachable(nodeC) must be(true) - r.isReachable(nodeD) must be(true) - r.isReachable(nodeE) must be(false) + r.isReachable(nodeA) should be(false) + r.isReachable(nodeB) should be(false) + r.isReachable(nodeC) should be(true) + r.isReachable(nodeD) should be(true) + r.isReachable(nodeE) should be(false) - r.allUnreachable must be(Set(nodeA, nodeB)) - r.allUnreachableFrom(nodeA) must be(Set(nodeE)) - r.allUnreachableFrom(nodeB) must be(Set(nodeA)) - r.allUnreachableFrom(nodeC) must be(Set(nodeA)) - r.allUnreachableFrom(nodeD) must be(Set(nodeA, nodeB)) + r.allUnreachable should be(Set(nodeA, nodeB)) + r.allUnreachableFrom(nodeA) should be(Set(nodeE)) + r.allUnreachableFrom(nodeB) should be(Set(nodeA)) + r.allUnreachableFrom(nodeC) should be(Set(nodeA)) + r.allUnreachableFrom(nodeD) should be(Set(nodeA, nodeB)) - r.observersGroupedByUnreachable must be(Map( + r.observersGroupedByUnreachable should be(Map( nodeA -> Set(nodeB, nodeC, nodeD), nodeB -> Set(nodeD), nodeE -> Set(nodeA))) @@ -134,18 +134,18 @@ class ReachabilitySpec extends WordSpec with MustMatchers { val r2 = r1.reachable(nodeB, nodeA).unreachable(nodeD, nodeE).unreachable(nodeC, nodeA) val merged = r1.merge(Set(nodeA, nodeB, nodeC, nodeD, nodeE), r2) - merged.status(nodeB, nodeA) must be(Reachable) - merged.status(nodeC, nodeA) must be(Unreachable) - merged.status(nodeC, nodeD) must be(Unreachable) - merged.status(nodeD, nodeE) must be(Unreachable) - merged.status(nodeE, nodeA) must be(Reachable) + merged.status(nodeB, nodeA) should be(Reachable) + merged.status(nodeC, nodeA) should be(Unreachable) + merged.status(nodeC, nodeD) should be(Unreachable) + merged.status(nodeD, nodeE) should be(Unreachable) + merged.status(nodeE, nodeA) should be(Reachable) - merged.isReachable(nodeA) must be(false) - merged.isReachable(nodeD) must be(false) - merged.isReachable(nodeE) must be(false) + merged.isReachable(nodeA) should be(false) + merged.isReachable(nodeD) should be(false) + merged.isReachable(nodeE) should be(false) val merged2 = r2.merge(Set(nodeA, nodeB, nodeC, nodeD, nodeE), r1) - merged2.records.toSet must be(merged.records.toSet) + merged2.records.toSet should be(merged.records.toSet) } "merge by taking allowed set into account" in { @@ -155,21 +155,21 @@ class ReachabilitySpec extends WordSpec with MustMatchers { val allowed = Set(nodeA, nodeB, nodeC, nodeE) val merged = r1.merge(allowed, r2) - merged.status(nodeB, nodeA) must be(Reachable) - merged.status(nodeC, nodeA) must be(Unreachable) - merged.status(nodeC, nodeD) must be(Reachable) - merged.status(nodeD, nodeE) must be(Reachable) - merged.status(nodeE, nodeA) must be(Reachable) + merged.status(nodeB, nodeA) should be(Reachable) + merged.status(nodeC, nodeA) should be(Unreachable) + merged.status(nodeC, nodeD) should be(Reachable) + merged.status(nodeD, nodeE) should be(Reachable) + merged.status(nodeE, nodeA) should be(Reachable) - merged.isReachable(nodeA) must be(false) - merged.isReachable(nodeD) must be(true) - merged.isReachable(nodeE) must be(true) + merged.isReachable(nodeA) should be(false) + merged.isReachable(nodeD) should be(true) + merged.isReachable(nodeE) should be(true) - merged.versions.keySet must be(Set(nodeB, nodeC)) + merged.versions.keySet should be(Set(nodeB, nodeC)) val merged2 = r2.merge(allowed, r1) - merged2.records.toSet must be(merged.records.toSet) - merged2.versions must be(merged.versions) + merged2.records.toSet should be(merged.records.toSet) + merged2.versions should be(merged.versions) } "merge correctly after pruning" in { @@ -178,12 +178,12 @@ class ReachabilitySpec extends WordSpec with MustMatchers { val r3 = r1.reachable(nodeB, nodeA) // nodeB pruned val merged = r2.merge(Set(nodeA, nodeB, nodeC, nodeD, nodeE), r3) - merged.records.toSet must be(Set( + merged.records.toSet should be(Set( Record(nodeA, nodeE, Unreachable, 1), Record(nodeC, nodeD, Unreachable, 1))) val merged3 = r3.merge(Set(nodeA, nodeB, nodeC, nodeD, nodeE), r2) - merged3.records.toSet must be(merged.records.toSet) + merged3.records.toSet should be(merged.records.toSet) } "merge versions correctly" in { @@ -192,10 +192,10 @@ class ReachabilitySpec extends WordSpec with MustMatchers { val merged = r1.merge(Set(nodeA, nodeB, nodeC, nodeD, nodeE), r2) val expected = Map(nodeA -> 6L, nodeB -> 5L, nodeC -> 7L, nodeD -> 1L) - merged.versions must be(expected) + merged.versions should be(expected) val merged2 = r2.merge(Set(nodeA, nodeB, nodeC, nodeD, nodeE), r1) - merged2.versions must be(expected) + merged2.versions should be(expected) } "remove node" in { @@ -206,10 +206,10 @@ class ReachabilitySpec extends WordSpec with MustMatchers { unreachable(nodeB, nodeE). remove(Set(nodeA, nodeB)) - r.status(nodeB, nodeA) must be(Reachable) - r.status(nodeC, nodeD) must be(Unreachable) - r.status(nodeB, nodeC) must be(Reachable) - r.status(nodeB, nodeE) must be(Reachable) + r.status(nodeB, nodeA) should be(Reachable) + r.status(nodeC, nodeD) should be(Unreachable) + r.status(nodeB, nodeC) should be(Reachable) + r.status(nodeB, nodeE) should be(Reachable) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/SerializationChecksSpec.scala b/akka-cluster/src/test/scala/akka/cluster/SerializationChecksSpec.scala index 81011ed890..f4d49d8432 100644 --- a/akka-cluster/src/test/scala/akka/cluster/SerializationChecksSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/SerializationChecksSpec.scala @@ -10,8 +10,8 @@ class SerializationChecksSpec extends AkkaSpec { "Settings serialize-messages and serialize-creators" must { "be on for tests" in { - system.settings.SerializeAllCreators must be(true) - system.settings.SerializeAllMessages must be(true) + system.settings.SerializeAllCreators should be(true) + system.settings.SerializeAllMessages should be(true) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/SerializeCreatorsVerificationSpec.scala b/akka-cluster/src/test/scala/akka/cluster/SerializeCreatorsVerificationSpec.scala index 206984d0dd..52bd1b1c8d 100644 --- a/akka-cluster/src/test/scala/akka/cluster/SerializeCreatorsVerificationSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/SerializeCreatorsVerificationSpec.scala @@ -8,8 +8,8 @@ import akka.testkit.AkkaSpec class SerializeCreatorsVerificationSpec extends AkkaSpec { - "serialize-creators must be on" in { - system.settings.SerializeAllCreators must be === true + "serialize-creators should be on" in { + system.settings.SerializeAllCreators should equal(true) } } \ No newline at end of file diff --git a/akka-cluster/src/test/scala/akka/cluster/VectorClockPerfSpec.scala b/akka-cluster/src/test/scala/akka/cluster/VectorClockPerfSpec.scala index 490e95a947..5008782c44 100644 --- a/akka-cluster/src/test/scala/akka/cluster/VectorClockPerfSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/VectorClockPerfSpec.scala @@ -7,7 +7,7 @@ package akka.cluster import akka.testkit.AkkaSpec import scala.collection.immutable.{ TreeMap, SortedSet } import org.scalatest.WordSpec -import org.scalatest.matchers.ShouldMatchers +import org.scalatest.Matchers object VectorClockPerfSpec { import VectorClock._ @@ -29,7 +29,7 @@ object VectorClockPerfSpec { } @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class VectorClockPerfSpec extends WordSpec with ShouldMatchers { +class VectorClockPerfSpec extends WordSpec with Matchers { import VectorClock._ import VectorClockPerfSpec._ diff --git a/akka-cluster/src/test/scala/akka/cluster/VectorClockSpec.scala b/akka-cluster/src/test/scala/akka/cluster/VectorClockSpec.scala index b20ad33871..a2ece7d834 100644 --- a/akka-cluster/src/test/scala/akka/cluster/VectorClockSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/VectorClockSpec.scala @@ -13,14 +13,14 @@ class VectorClockSpec extends AkkaSpec { "have zero versions when created" in { val clock = VectorClock() - clock.versions must be(Map()) + clock.versions should be(Map()) } "not happen before itself" in { val clock1 = VectorClock() val clock2 = VectorClock() - clock1 <> clock2 must be(false) + clock1 <> clock2 should be(false) } "pass misc comparison test 1" in { @@ -34,7 +34,7 @@ class VectorClockSpec extends AkkaSpec { val clock3_2 = clock2_2 :+ Node("2") val clock4_2 = clock3_2 :+ Node("1") - clock4_1 <> clock4_2 must be(false) + clock4_1 <> clock4_2 should be(false) } "pass misc comparison test 2" in { @@ -49,7 +49,7 @@ class VectorClockSpec extends AkkaSpec { val clock4_2 = clock3_2 :+ Node("1") val clock5_2 = clock4_2 :+ Node("3") - clock4_1 < clock5_2 must be(true) + clock4_1 < clock5_2 should be(true) } "pass misc comparison test 3" in { @@ -59,7 +59,7 @@ class VectorClockSpec extends AkkaSpec { val clock1_2 = VectorClock() val clock2_2 = clock1_2 :+ Node("2") - clock2_1 <> clock2_2 must be(true) + clock2_1 <> clock2_2 should be(true) } "pass misc comparison test 4" in { @@ -73,7 +73,7 @@ class VectorClockSpec extends AkkaSpec { val clock3_4 = clock2_4 :+ Node("1") val clock4_4 = clock3_4 :+ Node("3") - clock4_3 <> clock4_4 must be(true) + clock4_3 <> clock4_4 should be(true) } "pass misc comparison test 5" in { @@ -87,8 +87,8 @@ class VectorClockSpec extends AkkaSpec { val clock4_2 = clock3_2 :+ Node("2") val clock5_2 = clock4_2 :+ Node("3") - clock3_1 < clock5_2 must be(true) - clock5_2 > clock3_1 must be(true) + clock3_1 < clock5_2 should be(true) + clock5_2 > clock3_1 should be(true) } "pass misc comparison test 6" in { @@ -100,8 +100,8 @@ class VectorClockSpec extends AkkaSpec { val clock2_2 = clock1_2 :+ Node("1") val clock3_2 = clock2_2 :+ Node("1") - clock3_1 <> clock3_2 must be(true) - clock3_2 <> clock3_1 must be(true) + clock3_1 <> clock3_2 should be(true) + clock3_2 <> clock3_1 should be(true) } "pass misc comparison test 7" in { @@ -115,8 +115,8 @@ class VectorClockSpec extends AkkaSpec { val clock2_2 = clock1_2 :+ Node("2") val clock3_2 = clock2_2 :+ Node("2") - clock5_1 <> clock3_2 must be(true) - clock3_2 <> clock5_1 must be(true) + clock5_1 <> clock3_2 should be(true) + clock3_2 <> clock5_1 should be(true) } "pass misc comparison test 8" in { @@ -128,8 +128,8 @@ class VectorClockSpec extends AkkaSpec { val clock4_1 = clock3_1 :+ Node.fromHash("3") - clock4_1 <> clock1_2 must be(true) - clock1_2 <> clock4_1 must be(true) + clock4_1 <> clock1_2 should be(true) + clock1_2 <> clock4_1 should be(true) } "correctly merge two clocks" in { @@ -148,24 +148,24 @@ class VectorClockSpec extends AkkaSpec { val clock3_2 = clock2_2 :+ node2 val merged1 = clock3_2 merge clock5_1 - merged1.versions.size must be(3) - merged1.versions.contains(node1) must be(true) - merged1.versions.contains(node2) must be(true) - merged1.versions.contains(node3) must be(true) + merged1.versions.size should be(3) + merged1.versions.contains(node1) should be(true) + merged1.versions.contains(node2) should be(true) + merged1.versions.contains(node3) should be(true) val merged2 = clock5_1 merge clock3_2 - merged2.versions.size must be(3) - merged2.versions.contains(node1) must be(true) - merged2.versions.contains(node2) must be(true) - merged2.versions.contains(node3) must be(true) + merged2.versions.size should be(3) + merged2.versions.contains(node1) should be(true) + merged2.versions.contains(node2) should be(true) + merged2.versions.contains(node3) should be(true) - clock3_2 < merged1 must be(true) - clock5_1 < merged1 must be(true) + clock3_2 < merged1 should be(true) + clock5_1 < merged1 should be(true) - clock3_2 < merged2 must be(true) - clock5_1 < merged2 must be(true) + clock3_2 < merged2 should be(true) + clock5_1 < merged2 should be(true) - merged1 == merged2 must be(true) + merged1 == merged2 should be(true) } "correctly merge two disjoint vector clocks" in { @@ -185,26 +185,26 @@ class VectorClockSpec extends AkkaSpec { val clock3_2 = clock2_2 :+ node4 val merged1 = clock3_2 merge clock5_1 - merged1.versions.size must be(4) - merged1.versions.contains(node1) must be(true) - merged1.versions.contains(node2) must be(true) - merged1.versions.contains(node3) must be(true) - merged1.versions.contains(node4) must be(true) + merged1.versions.size should be(4) + merged1.versions.contains(node1) should be(true) + merged1.versions.contains(node2) should be(true) + merged1.versions.contains(node3) should be(true) + merged1.versions.contains(node4) should be(true) val merged2 = clock5_1 merge clock3_2 - merged2.versions.size must be(4) - merged2.versions.contains(node1) must be(true) - merged2.versions.contains(node2) must be(true) - merged2.versions.contains(node3) must be(true) - merged2.versions.contains(node4) must be(true) + merged2.versions.size should be(4) + merged2.versions.contains(node1) should be(true) + merged2.versions.contains(node2) should be(true) + merged2.versions.contains(node3) should be(true) + merged2.versions.contains(node4) should be(true) - clock3_2 < merged1 must be(true) - clock5_1 < merged1 must be(true) + clock3_2 < merged1 should be(true) + clock5_1 < merged1 should be(true) - clock3_2 < merged2 must be(true) - clock5_1 < merged2 must be(true) + clock3_2 < merged2 should be(true) + clock5_1 < merged2 should be(true) - merged1 == merged2 must be(true) + merged1 == merged2 should be(true) } "pass blank clock incrementing" in { @@ -217,14 +217,14 @@ class VectorClockSpec extends AkkaSpec { val vv1 = v1 :+ node1 val vv2 = v2 :+ node2 - (vv1 > v1) must equal(true) - (vv2 > v2) must equal(true) + (vv1 > v1) should equal(true) + (vv2 > v2) should equal(true) - (vv1 > v2) must equal(true) - (vv2 > v1) must equal(true) + (vv1 > v2) should equal(true) + (vv2 > v1) should equal(true) - (vv2 > vv1) must equal(false) - (vv1 > vv2) must equal(false) + (vv2 > vv1) should equal(false) + (vv1 > vv2) should equal(false) } "pass merging behavior" in { @@ -242,8 +242,8 @@ class VectorClockSpec extends AkkaSpec { var c = a2.merge(b1) var c1 = c :+ node3 - (c1 > a2) must equal(true) - (c1 > b1) must equal(true) + (c1 > a2) should equal(true) + (c1 > b1) should equal(true) } } } diff --git a/akka-cluster/src/test/scala/akka/cluster/protobuf/ClusterMessageSerializerSpec.scala b/akka-cluster/src/test/scala/akka/cluster/protobuf/ClusterMessageSerializerSpec.scala index c3ebd8afa2..0c08af5463 100644 --- a/akka-cluster/src/test/scala/akka/cluster/protobuf/ClusterMessageSerializerSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/protobuf/ClusterMessageSerializerSpec.scala @@ -21,11 +21,11 @@ class ClusterMessageSerializerSpec extends AkkaSpec( obj match { case env: GossipEnvelope ⇒ val env2 = obj.asInstanceOf[GossipEnvelope] - env2.from must be(env.from) - env2.to must be(env.to) - env2.gossip must be(env.gossip) + env2.from should be(env.from) + env2.to should be(env.to) + env2.gossip should be(env.gossip) case _ ⇒ - ref must be(obj) + ref should be(obj) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/routing/MetricsSelectorSpec.scala b/akka-cluster/src/test/scala/akka/cluster/routing/MetricsSelectorSpec.scala index f0443d4f61..14701e08bb 100644 --- a/akka-cluster/src/test/scala/akka/cluster/routing/MetricsSelectorSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/routing/MetricsSelectorSpec.scala @@ -5,7 +5,7 @@ package akka.cluster.routing import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Address import akka.cluster.Metric @@ -13,7 +13,7 @@ import akka.cluster.NodeMetrics import akka.cluster.StandardMetrics._ @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class MetricsSelectorSpec extends WordSpec with MustMatchers { +class MetricsSelectorSpec extends WordSpec with Matchers { val abstractSelector = new CapacityMetricsSelector { override def capacity(nodeMetrics: Set[NodeMetrics]): Map[Address, Double] = Map.empty @@ -63,13 +63,13 @@ class MetricsSelectorSpec extends WordSpec with MustMatchers { "calculate weights from capacity" in { val capacity = Map(a1 -> 0.6, b1 -> 0.3, c1 -> 0.1) val weights = abstractSelector.weights(capacity) - weights must be(Map(c1 -> 1, b1 -> 3, a1 -> 6)) + weights should be(Map(c1 -> 1, b1 -> 3, a1 -> 6)) } "handle low and zero capacity" in { val capacity = Map(a1 -> 0.0, b1 -> 1.0, c1 -> 0.005, d1 -> 0.004) val weights = abstractSelector.weights(capacity) - weights must be(Map(a1 -> 0, b1 -> 100, c1 -> 1, d1 -> 0)) + weights should be(Map(a1 -> 0, b1 -> 100, c1 -> 1, d1 -> 0)) } } @@ -77,40 +77,40 @@ class MetricsSelectorSpec extends WordSpec with MustMatchers { "HeapMetricsSelector" must { "calculate capacity of heap metrics" in { val capacity = HeapMetricsSelector.capacity(nodeMetrics) - capacity(a1) must be(0.75 plusOrMinus 0.0001) - capacity(b1) must be(0.75 plusOrMinus 0.0001) - capacity(c1) must be(0.0 plusOrMinus 0.0001) - capacity(d1) must be(0.001953125 plusOrMinus 0.0001) + capacity(a1) should be(0.75 +- 0.0001) + capacity(b1) should be(0.75 +- 0.0001) + capacity(c1) should be(0.0 +- 0.0001) + capacity(d1) should be(0.001953125 +- 0.0001) } } "CpuMetricsSelector" must { "calculate capacity of cpuCombined metrics" in { val capacity = CpuMetricsSelector.capacity(nodeMetrics) - capacity(a1) must be(0.9 plusOrMinus 0.0001) - capacity(b1) must be(0.5 plusOrMinus 0.0001) - capacity(c1) must be(0.0 plusOrMinus 0.0001) - capacity.contains(d1) must be(false) + capacity(a1) should be(0.9 +- 0.0001) + capacity(b1) should be(0.5 +- 0.0001) + capacity(c1) should be(0.0 +- 0.0001) + capacity.contains(d1) should be(false) } } "SystemLoadAverageMetricsSelector" must { "calculate capacity of systemLoadAverage metrics" in { val capacity = SystemLoadAverageMetricsSelector.capacity(nodeMetrics) - capacity(a1) must be(0.9375 plusOrMinus 0.0001) - capacity(b1) must be(0.9375 plusOrMinus 0.0001) - capacity(c1) must be(0.0 plusOrMinus 0.0001) - capacity.contains(d1) must be(false) + capacity(a1) should be(0.9375 +- 0.0001) + capacity(b1) should be(0.9375 +- 0.0001) + capacity(c1) should be(0.0 +- 0.0001) + capacity.contains(d1) should be(false) } } "MixMetricsSelector" must { "aggregate capacity of all metrics" in { val capacity = MixMetricsSelector.capacity(nodeMetrics) - capacity(a1) must be((0.75 + 0.9 + 0.9375) / 3 plusOrMinus 0.0001) - capacity(b1) must be((0.75 + 0.5 + 0.9375) / 3 plusOrMinus 0.0001) - capacity(c1) must be((0.0 + 0.0 + 0.0) / 3 plusOrMinus 0.0001) - capacity(d1) must be((0.001953125) / 1 plusOrMinus 0.0001) + capacity(a1) should be((0.75 + 0.9 + 0.9375) / 3 +- 0.0001) + capacity(b1) should be((0.75 + 0.5 + 0.9375) / 3 +- 0.0001) + capacity(c1) should be((0.0 + 0.0 + 0.0) / 3 +- 0.0001) + capacity(d1) should be((0.001953125) / 1 +- 0.0001) } } diff --git a/akka-cluster/src/test/scala/akka/cluster/routing/WeightedRouteesSpec.scala b/akka-cluster/src/test/scala/akka/cluster/routing/WeightedRouteesSpec.scala index 462f49f550..f051cb47ae 100644 --- a/akka-cluster/src/test/scala/akka/cluster/routing/WeightedRouteesSpec.scala +++ b/akka-cluster/src/test/scala/akka/cluster/routing/WeightedRouteesSpec.scala @@ -34,21 +34,21 @@ class WeightedRouteesSpec extends AkkaSpec(ConfigFactory.parseString(""" val weights = Map(a1 -> 1, b1 -> 3, c1 -> 10) val weighted = new WeightedRoutees(routees, a1, weights) - weighted(1) must be(routeeA) - 2 to 4 foreach { weighted(_) must be(routeeB) } - 5 to 14 foreach { weighted(_) must be(routeeC) } - weighted.total must be(14) + weighted(1) should be(routeeA) + 2 to 4 foreach { weighted(_) should be(routeeB) } + 5 to 14 foreach { weighted(_) should be(routeeC) } + weighted.total should be(14) } "check boundaries" in { val empty = new WeightedRoutees(Vector(), a1, Map.empty) - empty.isEmpty must be(true) + empty.isEmpty should be(true) intercept[IllegalArgumentException] { empty.total } val empty2 = new WeightedRoutees(Vector(routeeA), a1, Map(a1 -> 0)) - empty2.isEmpty must be(true) + empty2.isEmpty should be(true) intercept[IllegalArgumentException] { empty2.total } @@ -57,7 +57,7 @@ class WeightedRouteesSpec extends AkkaSpec(ConfigFactory.parseString(""" } val weighted = new WeightedRoutees(routees, a1, Map.empty) - weighted.total must be(3) + weighted.total should be(3) intercept[IllegalArgumentException] { weighted(0) } @@ -70,11 +70,11 @@ class WeightedRouteesSpec extends AkkaSpec(ConfigFactory.parseString(""" val weights = Map(a1 -> 1, b1 -> 7) val weighted = new WeightedRoutees(routees, a1, weights) - weighted(1) must be(routeeA) - 2 to 8 foreach { weighted(_) must be(routeeB) } + weighted(1) should be(routeeA) + 2 to 8 foreach { weighted(_) should be(routeeB) } // undefined, uses the mean of the weights, i.e. 4 - 9 to 12 foreach { weighted(_) must be(routeeC) } - weighted.total must be(12) + 9 to 12 foreach { weighted(_) should be(routeeC) } + weighted.total should be(12) } "allocate weighted local routees" in { @@ -82,15 +82,15 @@ class WeightedRouteesSpec extends AkkaSpec(ConfigFactory.parseString(""" val routees2 = Vector(testActorRoutee, routeeB, routeeC) val weighted = new WeightedRoutees(routees2, a1, weights) - 1 to 2 foreach { weighted(_) must be(testActorRoutee) } - 3 to weighted.total foreach { weighted(_) must not be (testActorRoutee) } + 1 to 2 foreach { weighted(_) should be(testActorRoutee) } + 3 to weighted.total foreach { weighted(_) should not be (testActorRoutee) } } "not allocate ref with weight zero" in { val weights = Map(a1 -> 0, b1 -> 2, c1 -> 10) val weighted = new WeightedRoutees(routees, a1, weights) - 1 to weighted.total foreach { weighted(_) must not be (routeeA) } + 1 to weighted.total foreach { weighted(_) should not be (routeeA) } } } diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterClientSpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterClientSpec.scala index d4e2fc283f..296e99a7fd 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterClientSpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterClientSpec.scala @@ -72,7 +72,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod def awaitCount(expected: Int): Unit = { awaitAssert { DistributedPubSubExtension(system).mediator ! DistributedPubSubMediator.Count - expectMsgType[Int] must be(expected) + expectMsgType[Int] should be(expected) } } @@ -145,7 +145,7 @@ class ClusterClientSpec extends MultiNodeSpec(ClusterClientSpec) with STMultiNod runOn(client) { // note that "hi" was sent to 2 "serviceB" - receiveN(3).toSet must be(Set("hello", "hi")) + receiveN(3).toSet should be(Set("hello", "hi")) } { //not used, only demo diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterShardingSpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterShardingSpec.scala index 33553355cc..d9d695c25e 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterShardingSpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterShardingSpec.scala @@ -228,14 +228,14 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult region ! EntryEnvelope(2, Increment) region ! Get(2) expectMsg(3) - lastSender.path must be(node(second) / "user" / "counterRegion" / "2") + lastSender.path should be(node(second) / "user" / "counterRegion" / "2") } enterBarrier("first-update") runOn(second) { region ! Get(2) expectMsg(3) - lastSender.path must be(region.path / "2") + lastSender.path should be(region.path / "2") } enterBarrier("after-3") @@ -272,7 +272,7 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult within(1.second) { region.tell(Get(2), probe.ref) probe.expectMsg(4) - probe.lastSender.path must be(region.path / "2") + probe.lastSender.path should be(region.path / "2") } } } @@ -304,25 +304,25 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult region ! EntryEnvelope(3, Increment) region ! Get(3) expectMsg(11) - lastSender.path must be(node(third) / "user" / "counterRegion" / "3") + lastSender.path should be(node(third) / "user" / "counterRegion" / "3") region ! EntryEnvelope(4, Increment) region ! Get(4) expectMsg(21) - lastSender.path must be(node(fourth) / "user" / "counterRegion" / "4") + lastSender.path should be(node(fourth) / "user" / "counterRegion" / "4") } enterBarrier("first-update") runOn(third) { region ! Get(3) expectMsg(11) - lastSender.path must be(region.path / "3") + lastSender.path should be(region.path / "3") } runOn(fourth) { region ! Get(4) expectMsg(21) - lastSender.path must be(region.path / "4") + lastSender.path should be(region.path / "4") } enterBarrier("after-6") @@ -342,7 +342,7 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult within(1.second) { region.tell(Get(3), probe3.ref) probe3.expectMsg(11) - probe3.lastSender.path must be(node(third) / "user" / "counterRegion" / "3") + probe3.lastSender.path should be(node(third) / "user" / "counterRegion" / "3") } } val probe4 = TestProbe() @@ -350,7 +350,7 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult within(1.second) { region.tell(Get(4), probe4.ref) probe4.expectMsg(21) - probe4.lastSender.path must be(node(fourth) / "user" / "counterRegion" / "4") + probe4.lastSender.path should be(node(fourth) / "user" / "counterRegion" / "4") } } @@ -404,7 +404,7 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult if (probe.lastSender.path == region.path / n.toString) count += 1 } - count must be(2) + count should be(2) } } } @@ -473,7 +473,7 @@ class ClusterShardingSpec extends MultiNodeSpec(ClusterShardingSpec) with STMult ClusterSharding(system).shardRegion("Counter") ! EntryEnvelope(n, Increment) ClusterSharding(system).shardRegion("Counter") ! Get(n) expectMsg(1) - lastSender.path.address must not be (Cluster(system).selfAddress) + lastSender.path.address should not be (Cluster(system).selfAddress) } } diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerChaosSpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerChaosSpec.scala index 3f97034336..6f0417f027 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerChaosSpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerChaosSpec.scala @@ -99,10 +99,10 @@ class ClusterSingletonManagerChaosSpec extends MultiNodeSpec(ClusterSingletonMan def awaitMemberUp(memberProbe: TestProbe, nodes: RoleName*): Unit = { runOn(nodes.filterNot(_ == nodes.head): _*) { - memberProbe.expectMsgType[MemberUp](15.seconds).member.address must be(node(nodes.head).address) + memberProbe.expectMsgType[MemberUp](15.seconds).member.address should be(node(nodes.head).address) } runOn(nodes.head) { - memberProbe.receiveN(nodes.size, 15.seconds).collect { case MemberUp(m) ⇒ m.address }.toSet must be( + memberProbe.receiveN(nodes.size, 15.seconds).collect { case MemberUp(m) ⇒ m.address }.toSet should be( nodes.map(node(_).address).toSet) } enterBarrier(nodes.head.name + "-up") @@ -139,7 +139,7 @@ class ClusterSingletonManagerChaosSpec extends MultiNodeSpec(ClusterSingletonMan runOn(controller) { echo(first) ! "hello" - expectMsgType[ActorRef](3.seconds).path.address must be(node(first).address) + expectMsgType[ActorRef](3.seconds).path.address should be(node(first).address) } enterBarrier("first-verified") @@ -160,7 +160,7 @@ class ClusterSingletonManagerChaosSpec extends MultiNodeSpec(ClusterSingletonMan runOn(controller) { echo(fourth) ! "hello" - expectMsgType[ActorRef](3.seconds).path.address must be(node(fourth).address) + expectMsgType[ActorRef](3.seconds).path.address should be(node(fourth).address) } enterBarrier("fourth-verified") diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerSpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerSpec.scala index 626b0b31b2..8d9780ca5d 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerSpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ClusterSingletonManagerSpec.scala @@ -207,10 +207,10 @@ class ClusterSingletonManagerSpec extends MultiNodeSpec(ClusterSingletonManagerS def awaitMemberUp(memberProbe: TestProbe, nodes: RoleName*): Unit = { runOn(nodes.filterNot(_ == nodes.head): _*) { - memberProbe.expectMsgType[MemberUp](15.seconds).member.address must be(node(nodes.head).address) + memberProbe.expectMsgType[MemberUp](15.seconds).member.address should be(node(nodes.head).address) } runOn(nodes.head) { - memberProbe.receiveN(nodes.size, 15.seconds).collect { case MemberUp(m) ⇒ m.address }.toSet must be( + memberProbe.receiveN(nodes.size, 15.seconds).collect { case MemberUp(m) ⇒ m.address }.toSet should be( nodes.map(node(_).address).toSet) } enterBarrier(nodes.head.name + "-up") diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala index 5fe7ea893b..45067ccb99 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala @@ -125,7 +125,7 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia def awaitCount(expected: Int): Unit = { awaitAssert { mediator ! Count - expectMsgType[Int] must be(expected) + expectMsgType[Int] should be(expected) } } @@ -150,7 +150,7 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia // send to actor at same node u1 ! Whisper("/user/u2", "hello") expectMsg("hello") - lastSender must be(u2) + lastSender should be(u2) } runOn(second) { @@ -180,7 +180,7 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia runOn(second) { expectMsg("hi there") - lastSender.path.name must be("u4") + lastSender.path.name should be("u4") } enterBarrier("after-2") @@ -203,7 +203,7 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia runOn(second) { expectMsg("go") - lastSender.path.name must be("u4") + lastSender.path.name should be("u4") } enterBarrier("after-3") @@ -248,7 +248,7 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia runOn(first, second) { expectMsg("hi") - lastSender.path.name must be("u7") + lastSender.path.name should be("u7") } runOn(third) { expectNoMsg(2.seconds) @@ -283,11 +283,11 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia val names = receiveWhile(messages = 2) { case "hello all" ⇒ lastSender.path.name } - names.toSet must be(Set("u8", "u9")) + names.toSet should be(Set("u8", "u9")) } runOn(second) { expectMsg("hello all") - lastSender.path.name must be("u10") + lastSender.path.name should be("u10") } runOn(third) { expectNoMsg(2.seconds) @@ -337,7 +337,7 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia runOn(first, second) { expectMsg("hi") - lastSender.path.name must be("u11") + lastSender.path.name should be("u11") } runOn(third) { expectNoMsg(2.seconds) // sender node should not receive a message @@ -354,10 +354,10 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia runOn(first) { mediator ! Status(versions = Map.empty) val deltaBuckets = expectMsgType[Delta].buckets - deltaBuckets.size must be(3) - deltaBuckets.find(_.owner == firstAddress).get.content.size must be(7) - deltaBuckets.find(_.owner == secondAddress).get.content.size must be(6) - deltaBuckets.find(_.owner == thirdAddress).get.content.size must be(2) + deltaBuckets.size should be(3) + deltaBuckets.find(_.owner == firstAddress).get.content.size should be(7) + deltaBuckets.find(_.owner == secondAddress).get.content.size should be(6) + deltaBuckets.find(_.owner == thirdAddress).get.content.size should be(2) } enterBarrier("verified-initial-delta") @@ -369,16 +369,16 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia mediator ! Status(versions = Map.empty) val deltaBuckets1 = expectMsgType[Delta].buckets - deltaBuckets1.map(_.content.size).sum must be(500) + deltaBuckets1.map(_.content.size).sum should be(500) mediator ! Status(versions = deltaBuckets1.map(b ⇒ b.owner -> b.version).toMap) val deltaBuckets2 = expectMsgType[Delta].buckets - deltaBuckets1.map(_.content.size).sum must be(500) + deltaBuckets1.map(_.content.size).sum should be(500) mediator ! Status(versions = deltaBuckets2.map(b ⇒ b.owner -> b.version).toMap) val deltaBuckets3 = expectMsgType[Delta].buckets - deltaBuckets3.map(_.content.size).sum must be(7 + 6 + 2 + many - 500 - 500) + deltaBuckets3.map(_.content.size).sum should be(7 + 6 + 2 + many - 500 - 500) } enterBarrier("verified-delta-with-many") diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala index 1bd746a9cb..c5461de86b 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala @@ -51,7 +51,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod def expectTransition(s1: State, s2: State) = expectMsg(FSM.Transition(proxy, s1, s2)) def sendN(n: Int) = (1 to n) foreach (proxy ! _) - def expectN(n: Int) = (1 to n) foreach { n ⇒ expectMsg(n); lastSender must be === target } + def expectN(n: Int) = (1 to n) foreach { n ⇒ expectMsg(n); lastSender should equal(target) } "A ReliableProxy" must { @@ -173,7 +173,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod "resend across a slow outbound link" in { runOn(local) { // the rateMBit value is derived from empirical studies so that it will trigger resends, - // the exact value is not important, but it must not be too large + // the exact value is not important, but it should not be too large testConductor.throttle(local, remote, Direction.Send, rateMBit = 0.02).await sendN(50) within(5 seconds) { @@ -199,7 +199,7 @@ class ReliableProxySpec extends MultiNodeSpec(ReliableProxySpec) with STMultiNod runOn(local) { testConductor.passThrough(local, remote, Direction.Send).await // the rateMBit value is derived from empirical studies so that it will trigger resends, - // the exact value is not important, but it must not be too large + // the exact value is not important, but it should not be too large testConductor.throttle(local, remote, Direction.Receive, rateMBit = 0.02).await sendN(50) within(5 seconds) { diff --git a/akka-contrib/src/test/scala/akka/contrib/jul/JavaLoggerSpec.scala b/akka-contrib/src/test/scala/akka/contrib/jul/JavaLoggerSpec.scala index 5a0d82210e..afbb24fdb2 100644 --- a/akka-contrib/src/test/scala/akka/contrib/jul/JavaLoggerSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/jul/JavaLoggerSpec.scala @@ -50,14 +50,14 @@ class JavaLoggerSpec extends AkkaSpec(JavaLoggerSpec.config) { val record = expectMsgType[logging.LogRecord] - record must not be (null) - record.getMillis must not be (0) - record.getThreadID must not be (0) - record.getLevel must be(logging.Level.SEVERE) - record.getMessage must be("Simulated error") - record.getThrown.isInstanceOf[RuntimeException] must be(true) - record.getSourceClassName must be(classOf[JavaLoggerSpec.LogProducer].getName) - record.getSourceMethodName must be(null) + record should not be (null) + record.getMillis should not be (0) + record.getThreadID should not be (0) + record.getLevel should be(logging.Level.SEVERE) + record.getMessage should be("Simulated error") + record.getThrown.isInstanceOf[RuntimeException] should be(true) + record.getSourceClassName should be(classOf[JavaLoggerSpec.LogProducer].getName) + record.getSourceMethodName should be(null) } "log info without stackTrace" in { @@ -65,14 +65,14 @@ class JavaLoggerSpec extends AkkaSpec(JavaLoggerSpec.config) { val record = expectMsgType[logging.LogRecord] - record must not be (null) - record.getMillis must not be (0) - record.getThreadID must not be (0) - record.getLevel must be(logging.Level.INFO) - record.getMessage must be("3 is the magic number") - record.getThrown must be(null) - record.getSourceClassName must be(classOf[JavaLoggerSpec.LogProducer].getName) - record.getSourceMethodName must be(null) + record should not be (null) + record.getMillis should not be (0) + record.getThreadID should not be (0) + record.getLevel should be(logging.Level.INFO) + record.getMessage should be("3 is the magic number") + record.getThrown should be(null) + record.getSourceClassName should be(classOf[JavaLoggerSpec.LogProducer].getName) + record.getSourceMethodName should be(null) } } diff --git a/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala b/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala index c89e963390..0d3fb27d57 100644 --- a/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/mailbox/PeekMailboxSpec.scala @@ -83,7 +83,7 @@ class PeekMailboxSpec extends AkkaSpec(""" a ! "DIE" // stays in the mailbox } expectMsg("DIE") - expectMsgType[DeadLetter].message must be("DIE") + expectMsgType[DeadLetter].message should be("DIE") expectTerminated(a) } diff --git a/akka-contrib/src/test/scala/akka/contrib/pattern/AggregatorSpec.scala b/akka-contrib/src/test/scala/akka/contrib/pattern/AggregatorSpec.scala index 22a0810edf..c33bab8b4a 100644 --- a/akka-contrib/src/test/scala/akka/contrib/pattern/AggregatorSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/pattern/AggregatorSpec.scala @@ -5,7 +5,7 @@ package akka.contrib.pattern import akka.testkit.{ ImplicitSender, TestKit } import org.scalatest.FunSuiteLike -import org.scalatest.matchers.ShouldMatchers +import org.scalatest.Matchers import scala.annotation.tailrec //#demo-code @@ -187,7 +187,7 @@ class ChainingSample extends Actor with Aggregator { } //#chain-sample -class AggregatorSpec extends TestKit(ActorSystem("test")) with ImplicitSender with FunSuiteLike with ShouldMatchers { +class AggregatorSpec extends TestKit(ActorSystem("test")) with ImplicitSender with FunSuiteLike with Matchers { test("Test request 1 account type") { system.actorOf(Props[AccountBalanceRetriever]) ! GetCustomerAccountBalances(1, Set(Savings)) diff --git a/akka-contrib/src/test/scala/akka/contrib/pattern/LeastShardAllocationStrategySpec.scala b/akka-contrib/src/test/scala/akka/contrib/pattern/LeastShardAllocationStrategySpec.scala index 3643f8b7f4..50c15b5e97 100644 --- a/akka-contrib/src/test/scala/akka/contrib/pattern/LeastShardAllocationStrategySpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/pattern/LeastShardAllocationStrategySpec.scala @@ -18,7 +18,7 @@ class LeastShardAllocationStrategySpec extends AkkaSpec { "LeastShardAllocationStrategy" must { "allocate to region with least number of shards" in { val allocations = Map(regionA -> Vector("shard1"), regionB -> Vector("shard2"), regionC -> Vector.empty) - allocationStrategy.allocateShard(regionA, "shard3", allocations) must be(regionC) + allocationStrategy.allocateShard(regionA, "shard3", allocations) should be(regionC) } "rebalance from region with most number of shards" in { @@ -26,22 +26,22 @@ class LeastShardAllocationStrategySpec extends AkkaSpec { regionC -> Vector.empty) // so far regionB has 2 shards and regionC has 0 shards, but the diff is less than rebalanceThreshold - allocationStrategy.rebalance(allocations, Set.empty) must be(Set.empty) + allocationStrategy.rebalance(allocations, Set.empty) should be(Set.empty) val allocations2 = allocations.updated(regionB, Vector("shard2", "shard3", "shard4")) - allocationStrategy.rebalance(allocations2, Set.empty) must be(Set("shard2")) - allocationStrategy.rebalance(allocations2, Set("shard4")) must be(Set.empty) + allocationStrategy.rebalance(allocations2, Set.empty) should be(Set("shard2")) + allocationStrategy.rebalance(allocations2, Set("shard4")) should be(Set.empty) val allocations3 = allocations2.updated(regionA, Vector("shard1", "shard5", "shard6")) - allocationStrategy.rebalance(allocations3, Set("shard1")) must be(Set("shard2")) + allocationStrategy.rebalance(allocations3, Set("shard1")) should be(Set("shard2")) } "must limit number of simultanious rebalance" in { val allocations = Map(regionA -> Vector("shard1"), regionB -> Vector("shard2", "shard3", "shard4", "shard5", "shard6"), regionC -> Vector.empty) - allocationStrategy.rebalance(allocations, Set("shard2")) must be(Set("shard3")) - allocationStrategy.rebalance(allocations, Set("shard2", "shard3")) must be(Set.empty) + allocationStrategy.rebalance(allocations, Set("shard2")) should be(Set("shard3")) + allocationStrategy.rebalance(allocations, Set("shard2", "shard3")) should be(Set.empty) } } } \ No newline at end of file diff --git a/akka-contrib/src/test/scala/akka/contrib/pattern/protobuf/DistributedPubSubMessageSerializerSpec.scala b/akka-contrib/src/test/scala/akka/contrib/pattern/protobuf/DistributedPubSubMessageSerializerSpec.scala index cd10e0ce13..80b83528e3 100644 --- a/akka-contrib/src/test/scala/akka/contrib/pattern/protobuf/DistributedPubSubMessageSerializerSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/pattern/protobuf/DistributedPubSubMessageSerializerSpec.scala @@ -17,7 +17,7 @@ class DistributedPubSubMessageSerializerSpec extends AkkaSpec { def checkSerialization(obj: AnyRef): Unit = { val blob = serializer.toBinary(obj) val ref = serializer.fromBinary(blob, obj.getClass) - ref must be(obj) + ref should be(obj) } " DistributedPubSubMessages" must { diff --git a/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala b/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala index 86427cc7e3..88bc396e93 100644 --- a/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala +++ b/akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala @@ -15,7 +15,7 @@ import akka.contrib.throttle.Throttler._ import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.BeforeAndAfterAll import akka.testkit._ @@ -41,7 +41,7 @@ object TimerBasedThrottlerSpec { @RunWith(classOf[JUnitRunner]) class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSpec")) with ImplicitSender - with WordSpecLike with MustMatchers with BeforeAndAfterAll { + with WordSpecLike with Matchers with BeforeAndAfterAll { import TimerBasedThrottlerSpec._ diff --git a/akka-docs/rst/general/code/docs/config/ConfigDocSpec.scala b/akka-docs/rst/general/code/docs/config/ConfigDocSpec.scala index 3a60fcd51f..39ef870196 100644 --- a/akka-docs/rst/general/code/docs/config/ConfigDocSpec.scala +++ b/akka-docs/rst/general/code/docs/config/ConfigDocSpec.scala @@ -4,7 +4,7 @@ package docs.config import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit.TestKit //#imports @@ -12,7 +12,7 @@ import akka.actor.ActorSystem import com.typesafe.config.ConfigFactory //#imports -class ConfigDocSpec extends WordSpec with MustMatchers { +class ConfigDocSpec extends WordSpec with Matchers { "programmatically configure ActorSystem" in { //#custom-config diff --git a/akka-docs/rst/scala/code/docs/actor/ActorDocSpec.scala b/akka-docs/rst/scala/code/docs/actor/ActorDocSpec.scala index ccc61aa5cc..ba3cf7ddc5 100644 --- a/akka-docs/rst/scala/code/docs/actor/ActorDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/actor/ActorDocSpec.scala @@ -15,7 +15,7 @@ import akka.event.Logging import scala.concurrent.Future import akka.actor.{ ActorRef, ActorSystem } import org.scalatest.{ BeforeAndAfterAll, WordSpec } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit._ import akka.util._ import scala.concurrent.duration._ @@ -326,7 +326,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { implicit val timeout = Timeout(5 seconds) val future = myActor ? "hello" //#using-implicit-timeout - Await.result(future, timeout.duration) must be("hello") + Await.result(future, timeout.duration) should be("hello") } @@ -337,7 +337,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { import akka.pattern.ask val future = myActor.ask("hello")(5 seconds) //#using-explicit-timeout - Await.result(future, 5 seconds) must be("hello") + Await.result(future, 5 seconds) should be("hello") } "using receiveTimeout" in { @@ -474,7 +474,7 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { val b = system.actorOf(Props(classOf[Follower], this)) watch(b) system.stop(a) - expectMsgType[akka.actor.Terminated].actor must be === b + expectMsgType[akka.actor.Terminated].actor should equal(b) } } @@ -536,12 +536,12 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { implicit val me = testActor actor ! 42 expectMsg(42) - lastSender must be === actor + lastSender should equal(actor) actor ! me expectMsg("reply") - lastSender.path.elements.mkString("/", "/", "") must be === "/user" + lastSender.path.elements.mkString("/", "/", "") should equal("/user") expectMsg("reply") - lastSender.path.elements.mkString("/", "/", "") must be === "/user" + lastSender.path.elements.mkString("/", "/", "") should equal("/user") } "using ActorDSL outside of akka.actor package" in { diff --git a/akka-docs/rst/scala/code/docs/actor/SchedulerDocSpec.scala b/akka-docs/rst/scala/code/docs/actor/SchedulerDocSpec.scala index e915ab09c3..c72f5021fc 100644 --- a/akka-docs/rst/scala/code/docs/actor/SchedulerDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/actor/SchedulerDocSpec.scala @@ -13,7 +13,7 @@ import scala.concurrent.duration._ //#imports1 import org.scalatest.{ BeforeAndAfterAll, WordSpec } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit._ class SchedulerDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { diff --git a/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala b/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala index b6c1ce1901..db7197c527 100644 --- a/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala @@ -8,7 +8,7 @@ import scala.concurrent.{ Promise, Future, Await } import scala.concurrent.duration._ import akka.actor.{ ActorContext, TypedActor, TypedProps } import org.scalatest.{ BeforeAndAfterAll, WordSpec } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit._ //Mr funny man avoids printing to stdout AND keeping docs alright @@ -124,11 +124,11 @@ class TypedActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { //#typed-actor-call-strict //#typed-actor-calls - Await.result(fSquare, 3 seconds) must be === 100 + Await.result(fSquare, 3 seconds) should equal(100) - oSquare must be === Some(100) + oSquare should equal(Some(100)) - iSquare must be === 100 + iSquare should equal(100) //#typed-actor-stop TypedActor(system).stop(mySquarer) @@ -174,6 +174,6 @@ class TypedActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) { TypedActor(system).poisonPill(awesomeFooBar) //#typed-actor-supercharge-usage - Await.result(f, 3 seconds) must be === "YES" + Await.result(f, 3 seconds) should equal("YES") } } diff --git a/akka-docs/rst/scala/code/docs/agent/AgentDocSpec.scala b/akka-docs/rst/scala/code/docs/agent/AgentDocSpec.scala index cfd15f0fe0..4d42a2d89a 100644 --- a/akka-docs/rst/scala/code/docs/agent/AgentDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/agent/AgentDocSpec.scala @@ -28,20 +28,20 @@ class AgentDocSpec extends AkkaSpec { //#read-apply val result = agent() //#read-apply - result must be === 0 + result should equal(0) } { //#read-get val result = agent.get //#read-get - result must be === 0 + result should equal(0) } { //#read-future val future = agent.future //#read-future - Await.result(future, 5 seconds) must be === 0 + Await.result(future, 5 seconds) should equal(0) } } @@ -67,7 +67,7 @@ class AgentDocSpec extends AkkaSpec { agent sendOff longRunningOrBlockingFunction //#send-off - Await.result(agent.future, 5 seconds) must be === 16 + Await.result(agent.future, 5 seconds) should equal(16) } "alter and alterOff" in { @@ -91,7 +91,7 @@ class AgentDocSpec extends AkkaSpec { val f4: Future[Int] = agent alterOff longRunningOrBlockingFunction //#alter-off - Await.result(f4, 5 seconds) must be === 16 + Await.result(f4, 5 seconds) should equal(16) } "transfer example" in { @@ -120,9 +120,9 @@ class AgentDocSpec extends AkkaSpec { val toValue = to.future // -> 70 //#transfer-example - Await.result(fromValue, 5 seconds) must be === 50 - Await.result(toValue, 5 seconds) must be === 70 - ok must be === true + Await.result(fromValue, 5 seconds) should equal(50) + Await.result(toValue, 5 seconds) should equal(70) + ok should equal(true) } "monadic example" in { @@ -149,8 +149,8 @@ class AgentDocSpec extends AkkaSpec { } yield value1 + value2 //#monadic-example - agent3() must be === 4 - agent4() must be === 4 - agent5() must be === 8 + agent3() should equal(4) + agent4() should equal(4) + agent5() should equal(8) } } diff --git a/akka-docs/rst/scala/code/docs/dispatcher/DispatcherDocSpec.scala b/akka-docs/rst/scala/code/docs/dispatcher/DispatcherDocSpec.scala index d48448685b..19fd5f6445 100644 --- a/akka-docs/rst/scala/code/docs/dispatcher/DispatcherDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/dispatcher/DispatcherDocSpec.scala @@ -6,7 +6,7 @@ package docs.dispatcher import language.postfixOps import org.scalatest.{ BeforeAndAfterAll, WordSpec } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit.AkkaSpec import akka.event.Logging import akka.event.LoggingAdapter diff --git a/akka-docs/rst/scala/code/docs/dispatcher/MyUnboundedMailbox.scala b/akka-docs/rst/scala/code/docs/dispatcher/MyUnboundedMailbox.scala index a1db8c753f..968d2f343b 100644 --- a/akka-docs/rst/scala/code/docs/dispatcher/MyUnboundedMailbox.scala +++ b/akka-docs/rst/scala/code/docs/dispatcher/MyUnboundedMailbox.scala @@ -25,7 +25,7 @@ object MyUnboundedMailbox { private final val queue = new ConcurrentLinkedQueue[Envelope]() - // these must be implemented; queue used as example + // these should be implemented; queue used as example def enqueue(receiver: ActorRef, handle: Envelope): Unit = queue.offer(handle) def dequeue(): Envelope = queue.poll() diff --git a/akka-docs/rst/scala/code/docs/future/FutureDocSpec.scala b/akka-docs/rst/scala/code/docs/future/FutureDocSpec.scala index ed72e1a2d8..5374e0aced 100644 --- a/akka-docs/rst/scala/code/docs/future/FutureDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/future/FutureDocSpec.scala @@ -77,7 +77,7 @@ class FutureDocSpec extends AkkaSpec { future pipeTo actor //#pipe-to - result must be("HELLO") + result should be("HELLO") } "demonstrate usage of mapTo" in { @@ -90,7 +90,7 @@ class FutureDocSpec extends AkkaSpec { val future: Future[String] = ask(actor, msg).mapTo[String] //#map-to - Await.result(future, timeout.duration) must be("HELLO") + Await.result(future, timeout.duration) should be("HELLO") } "demonstrate usage of simple future eval" in { @@ -104,7 +104,7 @@ class FutureDocSpec extends AkkaSpec { } future foreach println //#future-eval - Await.result(future, 3 seconds) must be("HelloWorld") + Await.result(future, 3 seconds) should be("HelloWorld") } "demonstrate usage of map" in { @@ -118,8 +118,8 @@ class FutureDocSpec extends AkkaSpec { f2 foreach println //#map val result = Await.result(f2, 3 seconds) - result must be(10) - f1.value must be(Some(Success("HelloWorld"))) + result should be(10) + f1.value should be(Some(Success("HelloWorld"))) } "demonstrate wrong usage of nested map" in { @@ -152,7 +152,7 @@ class FutureDocSpec extends AkkaSpec { f3 foreach println //#flat-map val result = Await.result(f3, 3 seconds) - result must be(30) + result should be(30) } "demonstrate usage of filter" in { @@ -170,9 +170,9 @@ class FutureDocSpec extends AkkaSpec { failedFilter foreach println //#filter val result = Await.result(future2, 3 seconds) - result must be(4) + result should be(4) val result2 = Await.result(failedFilter, 3 seconds) - result2 must be(0) //Can only be 0 when there was a MatchError + result2 should be(0) //Can only be 0 when there was a MatchError } "demonstrate usage of for comprehension" in { @@ -190,7 +190,7 @@ class FutureDocSpec extends AkkaSpec { f foreach println //#for-comprehension val result = Await.result(f, 3 seconds) - result must be(24) + result should be(24) } "demonstrate wrong way of composing" in { @@ -214,7 +214,7 @@ class FutureDocSpec extends AkkaSpec { val result = Await.result(f3, 3 seconds).asInstanceOf[Int] //#composing-wrong - result must be(3) + result should be(3) } "demonstrate composing" in { @@ -240,7 +240,7 @@ class FutureDocSpec extends AkkaSpec { f3 foreach println //#composing val result = Await.result(f3, 3 seconds).asInstanceOf[Int] - result must be(3) + result should be(3) } "demonstrate usage of sequence with actors" in { @@ -257,7 +257,7 @@ class FutureDocSpec extends AkkaSpec { val oddSum = futureList.map(_.sum) oddSum foreach println //#sequence-ask - Await.result(oddSum, 3 seconds).asInstanceOf[Int] must be(10000) + Await.result(oddSum, 3 seconds).asInstanceOf[Int] should be(10000) } "demonstrate usage of sequence" in { @@ -266,7 +266,7 @@ class FutureDocSpec extends AkkaSpec { val oddSum = futureList.map(_.sum) oddSum foreach println //#sequence - Await.result(oddSum, 3 seconds).asInstanceOf[Int] must be(10000) + Await.result(oddSum, 3 seconds).asInstanceOf[Int] should be(10000) } "demonstrate usage of traverse" in { @@ -275,7 +275,7 @@ class FutureDocSpec extends AkkaSpec { val oddSum = futureList.map(_.sum) oddSum foreach println //#traverse - Await.result(oddSum, 3 seconds).asInstanceOf[Int] must be(10000) + Await.result(oddSum, 3 seconds).asInstanceOf[Int] should be(10000) } "demonstrate usage of fold" in { @@ -285,7 +285,7 @@ class FutureDocSpec extends AkkaSpec { val futureSum = Future.fold(futures)(0)(_ + _) futureSum foreach println //#fold - Await.result(futureSum, 3 seconds) must be(1001000) + Await.result(futureSum, 3 seconds) should be(1001000) } "demonstrate usage of reduce" in { @@ -295,7 +295,7 @@ class FutureDocSpec extends AkkaSpec { val futureSum = Future.reduce(futures)(_ + _) futureSum foreach println //#reduce - Await.result(futureSum, 3 seconds) must be(1001000) + Await.result(futureSum, 3 seconds) should be(1001000) } "demonstrate usage of recover" in { @@ -308,7 +308,7 @@ class FutureDocSpec extends AkkaSpec { } future foreach println //#recover - Await.result(future, 3 seconds) must be(0) + Await.result(future, 3 seconds) should be(0) } "demonstrate usage of recoverWith" in { @@ -323,7 +323,7 @@ class FutureDocSpec extends AkkaSpec { } future foreach println //#try-recover - Await.result(future, 3 seconds) must be(0) + Await.result(future, 3 seconds) should be(0) } "demonstrate usage of zip" in { @@ -333,7 +333,7 @@ class FutureDocSpec extends AkkaSpec { val future3 = future1 zip future2 map { case (a, b) => a + " " + b } future3 foreach println //#zip - Await.result(future3, 3 seconds) must be("foo bar") + Await.result(future3, 3 seconds) should be("foo bar") } "demonstrate usage of andThen" in { @@ -349,7 +349,7 @@ class FutureDocSpec extends AkkaSpec { } result foreach println //#and-then - Await.result(result, 3 seconds) must be("foo bar") + Await.result(result, 3 seconds) should be("foo bar") } "demonstrate usage of fallbackTo" in { @@ -360,7 +360,7 @@ class FutureDocSpec extends AkkaSpec { val future4 = future1 fallbackTo future2 fallbackTo future3 future4 foreach println //#fallback-to - Await.result(future4, 3 seconds) must be("foo") + Await.result(future4, 3 seconds) should be("foo") } "demonstrate usage of onSuccess & onFailure & onComplete" in { @@ -372,7 +372,7 @@ class FutureDocSpec extends AkkaSpec { case x: String => println("Got some random string: " + x) } //#onSuccess - Await.result(future, 3 seconds) must be("foo") + Await.result(future, 3 seconds) should be("foo") } { val future = Future.failed[String](new IllegalStateException("OHNOES")) @@ -395,7 +395,7 @@ class FutureDocSpec extends AkkaSpec { case Failure(failure) => doSomethingOnFailure(failure) } //#onComplete - Await.result(future, 3 seconds) must be("foo") + Await.result(future, 3 seconds) should be("foo") } } @@ -411,9 +411,9 @@ class FutureDocSpec extends AkkaSpec { val theFuture = promise.future promise.success("hello") //#promise - Await.result(future, 3 seconds) must be("Yay!") + Await.result(future, 3 seconds) should be("Yay!") intercept[IllegalArgumentException] { Await.result(otherFuture, 3 seconds) } - Await.result(theFuture, 3 seconds) must be("hello") + Await.result(theFuture, 3 seconds) should be("hello") } "demonstrate usage of pattern.after" in { diff --git a/akka-docs/rst/scala/code/docs/io/IODocSpec.scala b/akka-docs/rst/scala/code/docs/io/IODocSpec.scala index b115903a7e..b2d58afbb7 100644 --- a/akka-docs/rst/scala/code/docs/io/IODocSpec.scala +++ b/akka-docs/rst/scala/code/docs/io/IODocSpec.scala @@ -120,11 +120,11 @@ class IODocSpec extends AkkaSpec { watch(client) val c1, c2 = expectMsgType[Tcp.Connected] - c1.localAddress must be(c2.remoteAddress) - c2.localAddress must be(c1.remoteAddress) + c1.localAddress should be(c2.remoteAddress) + c2.localAddress should be(c1.remoteAddress) client ! ByteString("hello") - expectMsgType[ByteString].utf8String must be("hello") + expectMsgType[ByteString].utf8String should be("hello") client ! "close" expectMsg("connection closed") diff --git a/akka-docs/rst/scala/code/docs/io/Pipelines.scala b/akka-docs/rst/scala/code/docs/io/Pipelines.scala index 1f830cf25b..c5802cddaf 100644 --- a/akka-docs/rst/scala/code/docs/io/Pipelines.scala +++ b/akka-docs/rst/scala/code/docs/io/Pipelines.scala @@ -138,10 +138,10 @@ class PipelinesDocSpec extends AkkaSpec { val encoded: (Iterable[Message], Iterable[ByteString]) = cmd(msg) //#build-pipeline - encoded._1 must have size 0 - encoded._2 must have size 1 + encoded._1 should have size 0 + encoded._2 should have size 1 - evt(encoded._2.head)._1 must be === Seq(msg) + evt(encoded._2.head)._1 should equal(Seq(msg)) } "demonstrate Injector/Sink" in { @@ -163,7 +163,7 @@ class PipelinesDocSpec extends AkkaSpec { val encoded = expectMsgType[Success[ByteString]].get injector.injectEvent(encoded) - expectMsgType[Try[Message]].get must be === msg + expectMsgType[Try[Message]].get should equal(msg) } "demonstrate management port and context" in { @@ -174,7 +174,7 @@ class PipelinesDocSpec extends AkkaSpec { val encoded = expectMsgType[ByteString] proc ! encoded val decoded = expectMsgType[Message] - decoded must be === msg + decoded should equal(msg) within(1.5.seconds, 3.seconds) { expectMsgType[Tick] diff --git a/akka-docs/rst/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala b/akka-docs/rst/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala index b636380835..14314afdfc 100644 --- a/akka-docs/rst/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/remoting/RemoteDeploymentDocSpec.scala @@ -37,9 +37,9 @@ class RemoteDeploymentDocSpec extends AkkaSpec(""" val ref = system.actorOf(Props[SampleActor]. withDeploy(Deploy(scope = RemoteScope(address)))) //#deploy - ref.path.address must be(address) + ref.path.address should be(address) ref ! "test" - expectMsgType[ActorRef].path.address must be(address) + expectMsgType[ActorRef].path.address should be(address) } "demonstrate address extractor" in { @@ -47,7 +47,7 @@ class RemoteDeploymentDocSpec extends AkkaSpec(""" val one = AddressFromURIString("akka.tcp://sys@host:1234") val two = Address("akka.tcp", "sys", "host", 1234) // this gives the same //#make-address - one must be === two + one should equal(two) } "demonstrate sampleActor" in { diff --git a/akka-docs/rst/scala/code/docs/routing/CustomRouterDocSpec.scala b/akka-docs/rst/scala/code/docs/routing/CustomRouterDocSpec.scala index 3a3f8e1f78..de43f7590c 100644 --- a/akka-docs/rst/scala/code/docs/routing/CustomRouterDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/routing/CustomRouterDocSpec.scala @@ -102,15 +102,15 @@ class CustomRouterDocSpec extends AkkaSpec(CustomRouterDocSpec.config) with Impl val routees = for (n <- 1 to 7) yield TestRoutee(n) val r1 = logic.select("msg", routees) - r1.asInstanceOf[SeveralRoutees].routees must be( + r1.asInstanceOf[SeveralRoutees].routees should be( Vector(TestRoutee(1), TestRoutee(2), TestRoutee(3))) val r2 = logic.select("msg", routees) - r2.asInstanceOf[SeveralRoutees].routees must be( + r2.asInstanceOf[SeveralRoutees].routees should be( Vector(TestRoutee(4), TestRoutee(5), TestRoutee(6))) val r3 = logic.select("msg", routees) - r3.asInstanceOf[SeveralRoutees].routees must be( + r3.asInstanceOf[SeveralRoutees].routees should be( Vector(TestRoutee(7), TestRoutee(1), TestRoutee(2))) //#unit-test-logic diff --git a/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala b/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala index ac3c410ee7..b30e11588d 100644 --- a/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/routing/RouterDocSpec.scala @@ -375,7 +375,7 @@ class RouterDocSpec extends AkkaSpec(RouterDocSpec.config) with ImplicitSender { import akka.routing.Broadcast router ! Broadcast("Watch out for Davy Jones' locker") //#broadcastDavyJonesWarning - receiveN(5, 5.seconds.dilated) must have length (5) + receiveN(5, 5.seconds.dilated) should have length (5) } "demonstrate PoisonPill" in { diff --git a/akka-docs/rst/scala/code/docs/serialization/SerializationDocSpec.scala b/akka-docs/rst/scala/code/docs/serialization/SerializationDocSpec.scala index 006ab20c92..21955a494e 100644 --- a/akka-docs/rst/scala/code/docs/serialization/SerializationDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/serialization/SerializationDocSpec.scala @@ -63,7 +63,7 @@ package docs.serialization { """) //#serialize-messages-config val a = ActorSystem("system", config) - a.settings.SerializeAllMessages must be(true) + a.settings.SerializeAllMessages should be(true) shutdown(a) } @@ -78,7 +78,7 @@ package docs.serialization { """) //#serialize-creators-config val a = ActorSystem("system", config) - a.settings.SerializeAllCreators must be(true) + a.settings.SerializeAllCreators should be(true) shutdown(a) } @@ -123,9 +123,9 @@ package docs.serialization { """) //#serialization-bindings-config val a = ActorSystem("system", config) - SerializationExtension(a).serializerFor(classOf[String]).getClass must equal(classOf[JavaSerializer]) - SerializationExtension(a).serializerFor(classOf[Customer]).getClass must equal(classOf[JavaSerializer]) - SerializationExtension(a).serializerFor(classOf[java.lang.Boolean]).getClass must equal(classOf[MyOwnSerializer]) + SerializationExtension(a).serializerFor(classOf[String]).getClass should equal(classOf[JavaSerializer]) + SerializationExtension(a).serializerFor(classOf[Customer]).getClass should equal(classOf[JavaSerializer]) + SerializationExtension(a).serializerFor(classOf[java.lang.Boolean]).getClass should equal(classOf[MyOwnSerializer]) shutdown(a) } @@ -149,7 +149,7 @@ package docs.serialization { val back = serializer.fromBinary(bytes, manifest = None) // Voilá! - back must equal(original) + back should equal(original) //#programmatic shutdown(system) diff --git a/akka-docs/rst/scala/code/docs/testkit/PlainWordSpec.scala b/akka-docs/rst/scala/code/docs/testkit/PlainWordSpec.scala index 9da9036a15..33aee7ef8f 100644 --- a/akka-docs/rst/scala/code/docs/testkit/PlainWordSpec.scala +++ b/akka-docs/rst/scala/code/docs/testkit/PlainWordSpec.scala @@ -9,7 +9,7 @@ import akka.actor.Actor import akka.actor.Props import akka.testkit.TestKit import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.BeforeAndAfterAll import akka.testkit.ImplicitSender @@ -23,7 +23,7 @@ object MySpec { //#implicit-sender class MySpec(_system: ActorSystem) extends TestKit(_system) with ImplicitSender - with WordSpecLike with MustMatchers with BeforeAndAfterAll { + with WordSpecLike with Matchers with BeforeAndAfterAll { //#implicit-sender def this() = this(ActorSystem("MySpec")) diff --git a/akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala b/akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala index 9ae9f780cc..bcc61707a8 100644 --- a/akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala +++ b/akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala @@ -10,7 +10,7 @@ import scala.util.Random import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.ShouldMatchers +import org.scalatest.Matchers import com.typesafe.config.ConfigFactory @@ -31,7 +31,7 @@ class TestKitUsageSpec extends TestKit(ActorSystem("TestKitUsageSpec", ConfigFactory.parseString(TestKitUsageSpec.config))) with DefaultTimeout with ImplicitSender - with WordSpecLike with ShouldMatchers with BeforeAndAfterAll { + with WordSpecLike with Matchers with BeforeAndAfterAll { import TestKitUsageSpec._ val echoRef = system.actorOf(Props[EchoActor]) diff --git a/akka-docs/rst/scala/code/docs/testkit/TestkitDocSpec.scala b/akka-docs/rst/scala/code/docs/testkit/TestkitDocSpec.scala index a19d9f20cc..5d4e748351 100644 --- a/akka-docs/rst/scala/code/docs/testkit/TestkitDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/testkit/TestkitDocSpec.scala @@ -131,7 +131,7 @@ class TestkitDocSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { // hypothetical message stimulating a '42' answer val future = actorRef ? Say42 val Success(result: Int) = future.value.get - result must be(42) + result should be(42) //#test-behavior } diff --git a/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/filebased/FileBasedMailboxSpec.scala b/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/filebased/FileBasedMailboxSpec.scala index 50e64b1fe2..7e48ca8676 100644 --- a/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/filebased/FileBasedMailboxSpec.scala +++ b/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/filebased/FileBasedMailboxSpec.scala @@ -26,9 +26,9 @@ class FileBasedMailboxSpec extends DurableMailboxSpec("File", FileBasedMailboxSp "FileBasedMailboxSettings" must { "read the file-based section" in { - settings.QueuePath must be("file-based") - settings.CircuitBreakerMaxFailures must be(5) - settings.CircuitBreakerCallTimeout must be(5 seconds) + settings.QueuePath should be("file-based") + settings.CircuitBreakerMaxFailures should be(5) + settings.CircuitBreakerCallTimeout should be(5 seconds) } } diff --git a/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala b/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala index 2ca2364327..4272ec2aa3 100644 --- a/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala +++ b/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala @@ -11,7 +11,7 @@ import java.util.concurrent.TimeoutException import scala.annotation.tailrec import org.scalatest.{ WordSpecLike, BeforeAndAfterAll } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import com.typesafe.config.{ ConfigFactory, Config } @@ -54,17 +54,17 @@ object DurableMailboxSpec { * tests can be added in concrete subclass. * * Subclass must define dispatcher in the supplied config for the specific backend. - * The id of the dispatcher must be the same as the `-dispatcher`. + * The id of the dispatcher should be the same as the `-dispatcher`. */ @deprecated("durable mailboxes are superseded by akka-persistence", "2.3") abstract class DurableMailboxSpec(system: ActorSystem, val backendName: String) - extends TestKit(system) with WordSpecLike with MustMatchers with BeforeAndAfterAll { + extends TestKit(system) with WordSpecLike with Matchers with BeforeAndAfterAll { import DurableMailboxSpecActorFactory._ /** * Subclass must define dispatcher in the supplied config for the specific backend. - * The id of the dispatcher must be the same as the `-dispatcher`. + * The id of the dispatcher should be the same as the `-dispatcher`. */ def this(backendName: String, config: String) = { this(ActorSystem(backendName + "BasedDurableMailboxSpec", @@ -136,9 +136,9 @@ abstract class DurableMailboxSpec(system: ActorSystem, val backendName: String) val a1, a2 = createMailboxTestActor() val mb1 = a1.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox val mb2 = a2.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox - isDurableMailbox(mb1) must be(true) - isDurableMailbox(mb2) must be(true) - (mb1 ne mb2) must be(true) + isDurableMailbox(mb1) should be(true) + isDurableMailbox(mb2) should be(true) + (mb1 ne mb2) should be(true) } "deliver messages at most once" in { @@ -157,7 +157,7 @@ abstract class DurableMailboxSpec(system: ActorSystem, val backendName: String) "support having multiple actors at the same time" in { val actors = Vector.fill(3)(createMailboxTestActor(Props[AccumulatorActor])) - actors foreach { a ⇒ isDurableMailbox(a.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox) must be(true) } + actors foreach { a ⇒ isDurableMailbox(a.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox) should be(true) } val msgs = 1 to 3 diff --git a/akka-osgi-aries/src/test/scala/akka/osgi/aries/blueprint/NamespaceHandlerTest.scala b/akka-osgi-aries/src/test/scala/akka/osgi/aries/blueprint/NamespaceHandlerTest.scala index 166e595c86..100cea4db1 100644 --- a/akka-osgi-aries/src/test/scala/akka/osgi/aries/blueprint/NamespaceHandlerTest.scala +++ b/akka-osgi-aries/src/test/scala/akka/osgi/aries/blueprint/NamespaceHandlerTest.scala @@ -8,7 +8,7 @@ import akka.actor.ActorSystem import de.kalpatec.pojosr.framework.launch.BundleDescriptor import akka.osgi.PojoSRTestSupport import akka.osgi.PojoSRTestSupport.bundle -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers /** * Test cases for {@link ActorSystemActivator} @@ -28,7 +28,7 @@ object NamespaceHandlerTest { } -class SimpleNamespaceHandlerTest extends WordSpec with MustMatchers with PojoSRTestSupport { +class SimpleNamespaceHandlerTest extends WordSpec with Matchers with PojoSRTestSupport { import NamespaceHandlerTest._ @@ -39,26 +39,26 @@ class SimpleNamespaceHandlerTest extends WordSpec with MustMatchers with PojoSRT "simple.xml" must { "set up ActorSystem when bundle starts" in { filterErrors() { - serviceForType[ActorSystem] must not be (null) + serviceForType[ActorSystem] should not be (null) } } "stop the ActorSystem when bundle stops" in { filterErrors() { val system = serviceForType[ActorSystem] - system.isTerminated must be(false) + system.isTerminated should be(false) bundleForName(TEST_BUNDLE_NAME).stop() system.awaitTermination() - system.isTerminated must be(true) + system.isTerminated should be(true) } } } } -class ConfigNamespaceHandlerTest extends WordSpec with MustMatchers with PojoSRTestSupport { +class ConfigNamespaceHandlerTest extends WordSpec with Matchers with PojoSRTestSupport { import NamespaceHandlerTest._ @@ -70,27 +70,27 @@ class ConfigNamespaceHandlerTest extends WordSpec with MustMatchers with PojoSRT "set up ActorSystem when bundle starts" in { filterErrors() { val system = serviceForType[ActorSystem] - system must not be (null) - system.settings.config.getString("some.config.key") must be("value") + system should not be (null) + system.settings.config.getString("some.config.key") should be("value") } } "stop the ActorSystem when bundle stops" in { filterErrors() { val system = serviceForType[ActorSystem] - system.isTerminated must be(false) + system.isTerminated should be(false) bundleForName(TEST_BUNDLE_NAME).stop() system.awaitTermination() - system.isTerminated must be(true) + system.isTerminated should be(true) } } } } -class DependencyInjectionNamespaceHandlerTest extends WordSpec with MustMatchers with PojoSRTestSupport { +class DependencyInjectionNamespaceHandlerTest extends WordSpec with Matchers with PojoSRTestSupport { import NamespaceHandlerTest._ @@ -103,8 +103,8 @@ class DependencyInjectionNamespaceHandlerTest extends WordSpec with MustMatchers "set up bean containing ActorSystem" in { filterErrors() { val bean = serviceForType[ActorSystemAwareBean] - bean must not be (null) - bean.system must not be (null) + bean should not be (null) + bean.system should not be (null) } } } diff --git a/akka-osgi/src/test/scala/akka/osgi/ActorSystemActivatorTest.scala b/akka-osgi/src/test/scala/akka/osgi/ActorSystemActivatorTest.scala index f55bf9d815..e1e1839090 100644 --- a/akka-osgi/src/test/scala/akka/osgi/ActorSystemActivatorTest.scala +++ b/akka-osgi/src/test/scala/akka/osgi/ActorSystemActivatorTest.scala @@ -16,7 +16,7 @@ import de.kalpatec.pojosr.framework.launch.BundleDescriptor import test.{ RuntimeNameActorSystemActivator, TestActivators, PingPongActorSystemActivator } import test.PingPong._ import PojoSRTestSupport.bundle -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers /** * Test cases for [[akka.osgi.ActorSystemActivator]] in 2 different scenarios: @@ -29,7 +29,7 @@ object ActorSystemActivatorTest { } -class PingPongActorSystemActivatorTest extends WordSpec with MustMatchers with PojoSRTestSupport { +class PingPongActorSystemActivatorTest extends WordSpec with Matchers with PojoSRTestSupport { import ActorSystemActivatorTest._ @@ -44,25 +44,25 @@ class PingPongActorSystemActivatorTest extends WordSpec with MustMatchers with P val actor = system.actorFor("/user/pong") implicit val timeout = Timeout(5 seconds) - Await.result(actor ? Ping, timeout.duration) must be(Pong) + Await.result(actor ? Ping, timeout.duration) should be(Pong) } } "stop the ActorSystem when bundle stops" in { filterErrors() { val system = serviceForType[ActorSystem] - system.isTerminated must be(false) + system.isTerminated should be(false) bundleForName(TEST_BUNDLE_NAME).stop() system.awaitTermination() - system.isTerminated must be(true) + system.isTerminated should be(true) } } } } -class RuntimeNameActorSystemActivatorTest extends WordSpec with MustMatchers with PojoSRTestSupport { +class RuntimeNameActorSystemActivatorTest extends WordSpec with Matchers with PojoSRTestSupport { import ActorSystemActivatorTest._ @@ -73,7 +73,7 @@ class RuntimeNameActorSystemActivatorTest extends WordSpec with MustMatchers wit "register an ActorSystem and add the bundle id to the system name" in { filterErrors() { - serviceForType[ActorSystem].name must equal(TestActivators.ACTOR_SYSTEM_NAME_PATTERN.format(bundleForName(TEST_BUNDLE_NAME).getBundleId)) + serviceForType[ActorSystem].name should equal(TestActivators.ACTOR_SYSTEM_NAME_PATTERN.format(bundleForName(TEST_BUNDLE_NAME).getBundleId)) } } } diff --git a/akka-persistence/src/test/scala/akka/persistence/ChannelSpec.scala b/akka-persistence/src/test/scala/akka/persistence/ChannelSpec.scala index 1de0863789..0676e839d3 100644 --- a/akka-persistence/src/test/scala/akka/persistence/ChannelSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/ChannelSpec.scala @@ -146,9 +146,9 @@ abstract class ChannelSpec(config: Config) extends AkkaSpec(config) with Persist redeliverTestChannel ! Deliver(Persistent("b"), probe.ref) - probe.expectMsgPF() { case m @ ConfirmablePersistent("b", _, redeliveries) ⇒ redeliveries must be(0) } - probe.expectMsgPF() { case m @ ConfirmablePersistent("b", _, redeliveries) ⇒ redeliveries must be(1) } - probe.expectMsgPF() { case m @ ConfirmablePersistent("b", _, redeliveries) ⇒ redeliveries must be(2); m.confirm() } + probe.expectMsgPF() { case m @ ConfirmablePersistent("b", _, redeliveries) ⇒ redeliveries should be(0) } + probe.expectMsgPF() { case m @ ConfirmablePersistent("b", _, redeliveries) ⇒ redeliveries should be(1) } + probe.expectMsgPF() { case m @ ConfirmablePersistent("b", _, redeliveries) ⇒ redeliveries should be(2); m.confirm() } } "redeliver in correct relative order" in { val deliveries = redeliverChannelSettings.redeliverMax + 1 @@ -169,18 +169,18 @@ abstract class ChannelSpec(config: Config) extends AkkaSpec(config) with Persist val grouped = received.groupBy(_.redeliveries) val expected = 1 to 9 toVector - grouped(0).map(_.payload) must be(expected) - grouped(1).map(_.payload) must be(expected) - grouped(2).map(_.payload) must be(expected) + grouped(0).map(_.payload) should be(expected) + grouped(1).map(_.payload) should be(expected) + grouped(2).map(_.payload) should be(expected) } "redeliver not more than redeliverMax on missing confirmation" in { val probe = TestProbe() redeliverTestChannel ! Deliver(PersistentRepr("a"), probe.ref) - probe.expectMsgPF() { case m @ ConfirmablePersistent("a", _, redeliveries) ⇒ redeliveries must be(0) } - probe.expectMsgPF() { case m @ ConfirmablePersistent("a", _, redeliveries) ⇒ redeliveries must be(1) } - probe.expectMsgPF() { case m @ ConfirmablePersistent("a", _, redeliveries) ⇒ redeliveries must be(2) } + probe.expectMsgPF() { case m @ ConfirmablePersistent("a", _, redeliveries) ⇒ redeliveries should be(0) } + probe.expectMsgPF() { case m @ ConfirmablePersistent("a", _, redeliveries) ⇒ redeliveries should be(1) } + probe.expectMsgPF() { case m @ ConfirmablePersistent("a", _, redeliveries) ⇒ redeliveries should be(2) } probe.expectNoMsg(300 milliseconds) } } diff --git a/akka-persistence/src/test/scala/akka/persistence/FailureSpec.scala b/akka-persistence/src/test/scala/akka/persistence/FailureSpec.scala index 87b37fee3e..953653fa5f 100644 --- a/akka-persistence/src/test/scala/akka/persistence/FailureSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/FailureSpec.scala @@ -144,12 +144,12 @@ class FailureSpec extends AkkaSpec(FailureSpec.config) with Cleanup with Implici expectDone() // by processor expectDone() // by destination - system.actorOf(Props(classOf[ChaosProcessorApp], testActor)) // recovery of new instance must have same outcome + system.actorOf(Props(classOf[ChaosProcessorApp], testActor)) // recovery of new instance should have same outcome expectDone() // by processor // destination doesn't receive messages again because all have been confirmed already } } def expectDone() = - expectMsgPF(numMessages seconds) { case Done(ints) ⇒ ints.sorted must be(1 to numMessages toVector) } + expectMsgPF(numMessages seconds) { case Done(ints) ⇒ ints.sorted should be(1 to numMessages toVector) } } diff --git a/akka-persistence/src/test/scala/akka/persistence/ProcessorSpec.scala b/akka-persistence/src/test/scala/akka/persistence/ProcessorSpec.scala index 1e1baa2d02..785132e423 100644 --- a/akka-persistence/src/test/scala/akka/persistence/ProcessorSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/ProcessorSpec.scala @@ -225,7 +225,7 @@ abstract class ProcessorSpec(config: Config) extends AkkaSpec(config) with Persi "derive outbound messages from the current message" in { val processor = namedProcessor[OutboundMessageTestProcessor] processor ! Persistent("c") - 1 to 3 foreach { _ ⇒ expectMsgPF() { case Persistent(payload, snr) ⇒ payload must be(snr) } } + 1 to 3 foreach { _ ⇒ expectMsgPF() { case Persistent(payload, snr) ⇒ payload should be(snr) } } } "support recovery with upper sequence number bound" in { val processor = namedProcessor[RecoverOffTestProcessor] diff --git a/akka-persistence/src/test/scala/akka/persistence/SnapshotSpec.scala b/akka-persistence/src/test/scala/akka/persistence/SnapshotSpec.scala index a6d1c0d14c..8ce6e55c06 100644 --- a/akka-persistence/src/test/scala/akka/persistence/SnapshotSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/SnapshotSpec.scala @@ -70,8 +70,8 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" expectMsgPF() { case (SnapshotMetadata(`processorId`, 4, timestamp), state) ⇒ - state must be(List("a-1", "b-2", "c-3", "d-4").reverse) - timestamp must be > (0L) + state should be(List("a-1", "b-2", "c-3", "d-4").reverse) + timestamp should be > (0L) } expectMsg("e-5") expectMsg("f-6") @@ -84,8 +84,8 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" expectMsgPF() { case (SnapshotMetadata(`processorId`, 2, timestamp), state) ⇒ - state must be(List("a-1", "b-2").reverse) - timestamp must be > (0L) + state should be(List("a-1", "b-2").reverse) + timestamp should be > (0L) } expectMsg("c-3") } @@ -98,8 +98,8 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" expectMsgPF() { case (SnapshotMetadata(`processorId`, 4, timestamp), state) ⇒ - state must be(List("a-1", "b-2", "c-3", "d-4").reverse) - timestamp must be > (0L) + state should be(List("a-1", "b-2", "c-3", "d-4").reverse) + timestamp should be > (0L) } expectMsg("done") } @@ -111,8 +111,8 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" expectMsgPF() { case (SnapshotMetadata(`processorId`, 2, timestamp), state) ⇒ - state must be(List("a-1", "b-2").reverse) - timestamp must be > (0L) + state should be(List("a-1", "b-2").reverse) + timestamp should be > (0L) } expectMsg("c-3") expectMsg("d-4") @@ -127,8 +127,8 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" expectMsgPF() { case (SnapshotMetadata(`processorId`, 2, timestamp), state) ⇒ - state must be(List("a-1", "b-2").reverse) - timestamp must be > (0L) + state should be(List("a-1", "b-2").reverse) + timestamp should be > (0L) } expectMsg("c-3") } @@ -155,7 +155,7 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" val metadata = expectMsgPF() { case (md @ SnapshotMetadata(`processorId`, 4, _), state) ⇒ - state must be(List("a-1", "b-2", "c-3", "d-4").reverse) + state should be(List("a-1", "b-2", "c-3", "d-4").reverse) md } expectMsg("done") @@ -169,7 +169,7 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" processor2 ! Recover(toSequenceNr = 4) expectMsgPF() { case (md @ SnapshotMetadata(`processorId`, 2, _), state) ⇒ - state must be(List("a-1", "b-2").reverse) + state should be(List("a-1", "b-2").reverse) md } expectMsg("c-3") @@ -188,7 +188,7 @@ class SnapshotSpec extends AkkaSpec(PersistenceSpec.config("leveldb", "snapshot" processor1 ! DeleteN(SnapshotSelectionCriteria(maxSequenceNr = 4)) expectMsgPF() { case (md @ SnapshotMetadata(`processorId`, 4, _), state) ⇒ - state must be(List("a-1", "b-2", "c-3", "d-4").reverse) + state should be(List("a-1", "b-2", "c-3", "d-4").reverse) } deleteProbe.expectMsgType[DeleteSnapshots] diff --git a/akka-persistence/src/test/scala/akka/persistence/serialization/SerializerSpec.scala b/akka-persistence/src/test/scala/akka/persistence/serialization/SerializerSpec.scala index 48a7845122..907d531a61 100644 --- a/akka-persistence/src/test/scala/akka/persistence/serialization/SerializerSpec.scala +++ b/akka-persistence/src/test/scala/akka/persistence/serialization/SerializerSpec.scala @@ -65,7 +65,7 @@ class SnapshotSerializerPersistenceSpec extends AkkaSpec(config(customSerializer val bytes = serializer.toBinary(wrapped) val deserialized = serializer.fromBinary(bytes, None) - deserialized must be(Snapshot(MySnapshot(".a."))) + deserialized should be(Snapshot(MySnapshot(".a."))) } } } @@ -82,7 +82,7 @@ class MessageSerializerPersistenceSpec extends AkkaSpec(config(customSerializers val bytes = serializer.toBinary(persistent) val deserialized = serializer.fromBinary(bytes, None) - deserialized must be(persistent.withPayload(MyPayload(".a."))) + deserialized should be(persistent.withPayload(MyPayload(".a."))) } "handle custom Persistent message serialization" in { val persistent = PersistentRepr(MyPayload("a"), 13, "p1", true, true, 0, List("c1", "c2"), confirmable = false, Confirm("p2", 14, "c2"), testActor, testActor) @@ -91,7 +91,7 @@ class MessageSerializerPersistenceSpec extends AkkaSpec(config(customSerializers val bytes = serializer.toBinary(persistent) val deserialized = serializer.fromBinary(bytes, None) - deserialized must be(persistent.withPayload(MyPayload(".a."))) + deserialized should be(persistent.withPayload(MyPayload(".a."))) } } "given a PersistentRepr manifest" must { @@ -102,7 +102,7 @@ class MessageSerializerPersistenceSpec extends AkkaSpec(config(customSerializers val bytes = serializer.toBinary(persistent) val deserialized = serializer.fromBinary(bytes, Some(classOf[PersistentRepr])) - deserialized must be(persistent.withPayload(MyPayload(".b."))) + deserialized should be(persistent.withPayload(MyPayload(".b."))) } "handle custom Persistent message serialization" in { val persistent = PersistentRepr(MyPayload("b"), 13, "p1", true, true, 3, List("c1", "c2"), confirmable = true, Confirm("p2", 14, "c2"), testActor, testActor) @@ -111,7 +111,7 @@ class MessageSerializerPersistenceSpec extends AkkaSpec(config(customSerializers val bytes = serializer.toBinary(persistent) val deserialized = serializer.fromBinary(bytes, Some(classOf[PersistentRepr])) - deserialized must be(persistent.withPayload(MyPayload(".b."))) + deserialized should be(persistent.withPayload(MyPayload(".b."))) } } "given a Confirm manifest" must { @@ -122,7 +122,7 @@ class MessageSerializerPersistenceSpec extends AkkaSpec(config(customSerializers val bytes = serializer.toBinary(confirmation) val deserialized = serializer.fromBinary(bytes, Some(classOf[Confirm])) - deserialized must be(confirmation) + deserialized should be(confirmation) } } } diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/LookupRemoteActorSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/LookupRemoteActorSpec.scala index 6167f78f4b..68a64f5d42 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/LookupRemoteActorSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/LookupRemoteActorSpec.scala @@ -47,9 +47,9 @@ class LookupRemoteActorSpec extends MultiNodeSpec(LookupRemoteActorMultiJvmSpec) system.actorSelection(node(master) / "user" / "service-hello") ! Identify("id1") expectMsgType[ActorIdentity].ref.get } - hello.isInstanceOf[RemoteActorRef] must be(true) + hello.isInstanceOf[RemoteActorRef] should be(true) val masterAddress = testConductor.getAddressFor(master).await - (hello ? "identify").await.asInstanceOf[ActorRef].path.address must equal(masterAddress) + (hello ? "identify").await.asInstanceOf[ActorRef].path.address should equal(masterAddress) } enterBarrier("done") } diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/NewRemoteActorSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/NewRemoteActorSpec.scala index e9b935db21..6c39b12502 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/NewRemoteActorSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/NewRemoteActorSpec.scala @@ -54,12 +54,12 @@ class NewRemoteActorSpec extends MultiNodeSpec(NewRemoteActorMultiJvmSpec) runOn(master) { val actor = system.actorOf(Props[SomeActor], "service-hello") - actor.isInstanceOf[RemoteActorRef] must be(true) - actor.path.address must be(node(slave).address) + actor.isInstanceOf[RemoteActorRef] should be(true) + actor.path.address should be(node(slave).address) val slaveAddress = testConductor.getAddressFor(slave).await actor ! "identify" - expectMsgType[ActorRef].path.address must equal(slaveAddress) + expectMsgType[ActorRef].path.address should equal(slaveAddress) } enterBarrier("done") @@ -69,12 +69,12 @@ class NewRemoteActorSpec extends MultiNodeSpec(NewRemoteActorMultiJvmSpec) runOn(master) { val actor = system.actorOf(Props[SomeActor], "service-hello2") - actor.isInstanceOf[RemoteActorRef] must be(true) - actor.path.address must be(node(slave).address) + actor.isInstanceOf[RemoteActorRef] should be(true) + actor.path.address should be(node(slave).address) val slaveAddress = testConductor.getAddressFor(slave).await actor ! "identify" - expectMsgType[ActorRef].path.address must equal(slaveAddress) + expectMsgType[ActorRef].path.address should equal(slaveAddress) } enterBarrier("done") @@ -83,8 +83,8 @@ class NewRemoteActorSpec extends MultiNodeSpec(NewRemoteActorMultiJvmSpec) "be able to shutdown system when using remote deployed actor" taggedAs LongRunningTest in within(20 seconds) { runOn(master) { val actor = system.actorOf(Props[SomeActor], "service-hello3") - actor.isInstanceOf[RemoteActorRef] must be(true) - actor.path.address must be(node(slave).address) + actor.isInstanceOf[RemoteActorRef] should be(true) + actor.path.address should be(node(slave).address) // This watch is in race with the shutdown of the watched system. This race should remain, as the test should // handle both cases: // - remote system receives watch, replies with DeathWatchNotification @@ -104,7 +104,7 @@ class NewRemoteActorSpec extends MultiNodeSpec(NewRemoteActorMultiJvmSpec) } // Important that this is the last test. - // It must not be any barriers here. + // It should not be any barriers here. // verifySystemShutdown = true will ensure that system shutdown is successful } } diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteDeploymentDeathWatchSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteDeploymentDeathWatchSpec.scala index 668b1e7d8b..5ba4218151 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteDeploymentDeathWatchSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteDeploymentDeathWatchSpec.scala @@ -69,7 +69,7 @@ abstract class RemoteDeploymentDeathWatchSpec runOn(second) { // remote deployment to third val hello = system.actorOf(Props[Hello], "hello") - hello.path.address must be(node(third).address) + hello.path.address should be(node(third).address) enterBarrier("hello-deployed") enterBarrier("third-crashed") diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteNodeDeathWatchSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteNodeDeathWatchSpec.scala index d1575bb2d2..c4064a3b39 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteNodeDeathWatchSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteNodeDeathWatchSpec.scala @@ -122,7 +122,7 @@ abstract class RemoteNodeDeathWatchSpec enterBarrier("watch-established-1") sleep() - expectMsgType[WrappedTerminated].t.actor must be(subject) + expectMsgType[WrappedTerminated].t.actor should be(subject) } runOn(second) { @@ -246,7 +246,7 @@ abstract class RemoteNodeDeathWatchSpec system.stop(s2) enterBarrier("stop-s2-4") - expectMsgType[WrappedTerminated].t.actor must be(subject2) + expectMsgType[WrappedTerminated].t.actor should be(subject2) } runOn(third) { @@ -333,8 +333,8 @@ abstract class RemoteNodeDeathWatchSpec enterBarrier("watch-established-5") enterBarrier("stopped-5") - p1.receiveN(2, 5 seconds).collect { case WrappedTerminated(t) ⇒ t.actor }.toSet must be(Set(a1, a2)) - p3.expectMsgType[WrappedTerminated](5 seconds).t.actor must be(a3) + p1.receiveN(2, 5 seconds).collect { case WrappedTerminated(t) ⇒ t.actor }.toSet should be(Set(a1, a2)) + p3.expectMsgType[WrappedTerminated](5 seconds).t.actor should be(a3) p2.expectNoMsg(2 seconds) enterBarrier("terminated-verified-5") @@ -381,7 +381,7 @@ abstract class RemoteNodeDeathWatchSpec log.info("exit second") testConductor.exit(second, 0).await - expectMsgType[WrappedTerminated](15 seconds).t.actor must be(subject) + expectMsgType[WrappedTerminated](15 seconds).t.actor should be(subject) // verify that things are cleaned up, and heartbeating is stopped assertCleanup() diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteQuarantinePiercingSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteQuarantinePiercingSpec.scala index 92a8720d85..514e51cd17 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteQuarantinePiercingSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/RemoteQuarantinePiercingSpec.scala @@ -82,8 +82,8 @@ abstract class RemoteQuarantinePiercingSpec extends MultiNodeSpec(RemoteQuaranti awaitAssert { system.actorSelection(RootActorPath(secondAddress) / "user" / "subject") ! "identify" val (uidSecond, subjectSecond) = expectMsgType[(Int, ActorRef)](1.second) - uidSecond must not be (uidFirst) - subjectSecond must not be (subjectFirst) + uidSecond should not be (uidFirst) + subjectSecond should not be (subjectFirst) } } diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RandomRoutedRemoteActorSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RandomRoutedRemoteActorSpec.scala index 8402f08268..87e13ec069 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RandomRoutedRemoteActorSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RandomRoutedRemoteActorSpec.scala @@ -62,7 +62,7 @@ class RandomRoutedRemoteActorSpec extends MultiNodeSpec(RandomRoutedRemoteActorM runOn(fourth) { enterBarrier("start") val actor = system.actorOf(Props[SomeActor].withRouter(RandomRouter()), "service-hello") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 100 @@ -82,8 +82,8 @@ class RandomRoutedRemoteActorSpec extends MultiNodeSpec(RandomRoutedRemoteActorM enterBarrier("end") // since it's random we can't be too strict in the assert - replies.values count (_ > 0) must be > (connectionCount - 2) - replies.get(node(fourth).address) must be(None) + replies.values count (_ > 0) should be > (connectionCount - 2) + replies.get(node(fourth).address) should be(None) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RoundRobinRoutedRemoteActorSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RoundRobinRoutedRemoteActorSpec.scala index 22d22be53b..3a0f1a7eaa 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RoundRobinRoutedRemoteActorSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/RoundRobinRoutedRemoteActorSpec.scala @@ -75,7 +75,7 @@ class RoundRobinRoutedRemoteActorSpec extends MultiNodeSpec(RoundRobinRoutedRemo runOn(fourth) { enterBarrier("start") val actor = system.actorOf(Props[SomeActor].withRouter(RoundRobinRouter()), "service-hello") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 10 @@ -94,8 +94,8 @@ class RoundRobinRoutedRemoteActorSpec extends MultiNodeSpec(RoundRobinRoutedRemo actor ! Broadcast(PoisonPill) enterBarrier("end") - replies.values foreach { _ must be(iterationCount) } - replies.get(node(fourth).address) must be(None) + replies.values foreach { _ should be(iterationCount) } + replies.get(node(fourth).address) should be(None) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node @@ -116,10 +116,10 @@ class RoundRobinRoutedRemoteActorSpec extends MultiNodeSpec(RoundRobinRoutedRemo enterBarrier("start") val actor = system.actorOf(Props[SomeActor].withRouter(RoundRobinRouter( resizer = Some(new TestResizer))), "service-hello2") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) actor ! CurrentRoutees - expectMsgType[RouterRoutees].routees.size must be(1) + expectMsgType[RouterRoutees].routees.size should be(1) val repliesFrom: Set[ActorRef] = (for (n ← 2 to 8) yield { @@ -132,9 +132,9 @@ class RoundRobinRoutedRemoteActorSpec extends MultiNodeSpec(RoundRobinRoutedRemo actor ! Broadcast(PoisonPill) enterBarrier("end") - repliesFrom.size must be(7) + repliesFrom.size should be(7) val repliesFromAddresses = repliesFrom.map(_.path.address) - repliesFromAddresses must be === (Set(node(first), node(second), node(third)).map(_.address)) + repliesFromAddresses should equal(Set(node(first), node(second), node(third)).map(_.address)) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/ScatterGatherRoutedRemoteActorSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/ScatterGatherRoutedRemoteActorSpec.scala index 4588180c4a..f989cb7560 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/ScatterGatherRoutedRemoteActorSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/oldrouting/ScatterGatherRoutedRemoteActorSpec.scala @@ -65,7 +65,7 @@ class ScatterGatherRoutedRemoteActorSpec extends MultiNodeSpec(ScatterGatherRout runOn(fourth) { enterBarrier("start") val actor = system.actorOf(Props[SomeActor].withRouter(ScatterGatherFirstCompletedRouter(within = 10 seconds)), "service-hello") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 10 @@ -84,8 +84,8 @@ class ScatterGatherRoutedRemoteActorSpec extends MultiNodeSpec(ScatterGatherRout actor ! Broadcast(PoisonPill) enterBarrier("end") - replies.values.sum must be === connectionCount * iterationCount - replies.get(node(fourth).address) must be(None) + replies.values.sum should equal(connectionCount * iterationCount) + replies.get(node(fourth).address) should be(None) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRandomSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRandomSpec.scala index 05fbb0912c..976391b7c5 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRandomSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRandomSpec.scala @@ -60,7 +60,7 @@ class RemoteRandomSpec extends MultiNodeSpec(RemoteRandomMultiJvmSpec) runOn(fourth) { enterBarrier("start") val actor = system.actorOf(RandomPool(nrOfInstances = 0).props(Props[SomeActor]), "service-hello") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 100 @@ -80,8 +80,8 @@ class RemoteRandomSpec extends MultiNodeSpec(RemoteRandomMultiJvmSpec) enterBarrier("end") // since it's random we can't be too strict in the assert - replies.values count (_ > 0) must be > (connectionCount - 2) - replies.get(node(fourth).address) must be(None) + replies.values count (_ > 0) should be > (connectionCount - 2) + replies.get(node(fourth).address) should be(None) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRoundRobinSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRoundRobinSpec.scala index 84c68db2f8..65b2a7f106 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRoundRobinSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteRoundRobinSpec.scala @@ -88,7 +88,7 @@ class RemoteRoundRobinSpec extends MultiNodeSpec(RemoteRoundRobinMultiJvmSpec) runOn(fourth) { enterBarrier("start") val actor = system.actorOf(RoundRobinPool(nrOfInstances = 0).props(Props[SomeActor]), "service-hello") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 10 @@ -107,8 +107,8 @@ class RemoteRoundRobinSpec extends MultiNodeSpec(RemoteRoundRobinMultiJvmSpec) actor ! Broadcast(PoisonPill) enterBarrier("end") - replies.values foreach { _ must be(iterationCount) } - replies.get(node(fourth).address) must be(None) + replies.values foreach { _ should be(iterationCount) } + replies.get(node(fourth).address) should be(None) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node @@ -131,17 +131,17 @@ class RemoteRoundRobinSpec extends MultiNodeSpec(RemoteRoundRobinMultiJvmSpec) val actor = system.actorOf(RoundRobinPool( nrOfInstances = 1, resizer = Some(new TestResizer)).props(Props[SomeActor]), "service-hello2") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) actor ! GetRoutees // initial nrOfInstances 1 + inital resize => 2 - expectMsgType[Routees].routees.size must be(2) + expectMsgType[Routees].routees.size should be(2) val repliesFrom: Set[ActorRef] = (for (n ← 3 to 9) yield { // each message trigger a resize, incrementing number of routees with 1 actor ! "hit" - Await.result(actor ? GetRoutees, remaining).asInstanceOf[Routees].routees.size must be(n) + Await.result(actor ? GetRoutees, remaining).asInstanceOf[Routees].routees.size should be(n) expectMsgType[ActorRef] }).toSet @@ -149,9 +149,9 @@ class RemoteRoundRobinSpec extends MultiNodeSpec(RemoteRoundRobinMultiJvmSpec) actor ! Broadcast(PoisonPill) enterBarrier("end") - repliesFrom.size must be(7) + repliesFrom.size should be(7) val repliesFromAddresses = repliesFrom.map(_.path.address) - repliesFromAddresses must be === (Set(node(first), node(second), node(third)).map(_.address)) + repliesFromAddresses should equal(Set(node(first), node(second), node(third)).map(_.address)) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node @@ -173,7 +173,7 @@ class RemoteRoundRobinSpec extends MultiNodeSpec(RemoteRoundRobinMultiJvmSpec) runOn(fourth) { enterBarrier("start") val actor = system.actorOf(FromConfig.props(), "service-hello3") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 10 @@ -189,8 +189,8 @@ class RemoteRoundRobinSpec extends MultiNodeSpec(RemoteRoundRobinMultiJvmSpec) } enterBarrier("end") - replies.values foreach { _ must be(iterationCount) } - replies.get(node(fourth).address) must be(None) + replies.values foreach { _ should be(iterationCount) } + replies.get(node(fourth).address) should be(None) } enterBarrier("done") diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteScatterGatherSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteScatterGatherSpec.scala index 9846800c7f..26ab1be48a 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteScatterGatherSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/routing/RemoteScatterGatherSpec.scala @@ -63,7 +63,7 @@ class RemoteScatterGatherSpec extends MultiNodeSpec(RemoteScatterGatherMultiJvmS runOn(fourth) { enterBarrier("start") val actor = system.actorOf(ScatterGatherFirstCompletedPool(nrOfInstances = 1, within = 10.seconds).props(Props[SomeActor]), "service-hello") - actor.isInstanceOf[RoutedActorRef] must be(true) + actor.isInstanceOf[RoutedActorRef] should be(true) val connectionCount = 3 val iterationCount = 10 @@ -82,8 +82,8 @@ class RemoteScatterGatherSpec extends MultiNodeSpec(RemoteScatterGatherMultiJvmS actor ! Broadcast(PoisonPill) enterBarrier("end") - replies.values.sum must be === connectionCount * iterationCount - replies.get(node(fourth).address) must be(None) + replies.values.sum should equal(connectionCount * iterationCount) + replies.get(node(fourth).address) should be(None) // shut down the actor before we let the other node(s) shut down so we don't try to send // "Terminate" to a shut down node diff --git a/akka-remote-tests/src/multi-jvm/scala/akka/remote/testconductor/TestConductorSpec.scala b/akka-remote-tests/src/multi-jvm/scala/akka/remote/testconductor/TestConductorSpec.scala index 66b46dd82c..0d004989f8 100644 --- a/akka-remote-tests/src/multi-jvm/scala/akka/remote/testconductor/TestConductorSpec.scala +++ b/akka-remote-tests/src/multi-jvm/scala/akka/remote/testconductor/TestConductorSpec.scala @@ -74,7 +74,7 @@ class TestConductorSpec extends MultiNodeSpec(TestConductorMultiJvmSpec) with ST within(0.6 seconds, 2 seconds) { expectMsg(500 millis, 0) - receiveN(9) must be(1 to 9) + receiveN(9) should be(1 to 9) } enterBarrier("throttled_send2") @@ -96,7 +96,7 @@ class TestConductorSpec extends MultiNodeSpec(TestConductorMultiJvmSpec) with ST within(min, max) { expectMsg(500 millis, 10) - receiveN(9) must be(11 to 19) + receiveN(9) should be(11 to 19) } enterBarrier("throttled_recv2") diff --git a/akka-remote-tests/src/test/scala/akka/remote/SerializationChecksSpec.scala b/akka-remote-tests/src/test/scala/akka/remote/SerializationChecksSpec.scala index 7d6e742b6b..37336f0722 100644 --- a/akka-remote-tests/src/test/scala/akka/remote/SerializationChecksSpec.scala +++ b/akka-remote-tests/src/test/scala/akka/remote/SerializationChecksSpec.scala @@ -10,8 +10,8 @@ class SerializationChecksSpec extends AkkaSpec { "Settings serialize-messages and serialize-creators" must { "be on for tests" in { - system.settings.SerializeAllCreators must be(true) - system.settings.SerializeAllMessages must be(true) + system.settings.SerializeAllCreators should be(true) + system.settings.SerializeAllMessages should be(true) } } diff --git a/akka-remote-tests/src/test/scala/akka/remote/testconductor/BarrierSpec.scala b/akka-remote-tests/src/test/scala/akka/remote/testconductor/BarrierSpec.scala index 321e856ac9..7648826896 100644 --- a/akka-remote-tests/src/test/scala/akka/remote/testconductor/BarrierSpec.scala +++ b/akka-remote-tests/src/test/scala/akka/remote/testconductor/BarrierSpec.scala @@ -556,7 +556,7 @@ class BarrierSpec extends AkkaSpec(BarrierSpec.config) with ImplicitSender { private def noMsg(probes: TestProbe*) { expectNoMsg(1 second) - probes foreach (_.msgAvailable must be(false)) + probes foreach (_.msgAvailable should be(false)) } private def data(clients: Set[Controller.NodeInfo], barrier: String, arrived: List[ActorRef], previous: Data): Data = { diff --git a/akka-remote-tests/src/test/scala/akka/remote/testconductor/ControllerSpec.scala b/akka-remote-tests/src/test/scala/akka/remote/testconductor/ControllerSpec.scala index 2e0ee878ee..fdb525ebe2 100644 --- a/akka-remote-tests/src/test/scala/akka/remote/testconductor/ControllerSpec.scala +++ b/akka-remote-tests/src/test/scala/akka/remote/testconductor/ControllerSpec.scala @@ -33,7 +33,7 @@ class ControllerSpec extends AkkaSpec(ControllerSpec.config) with ImplicitSender c ! NodeInfo(B, AddressFromURIString("akka://sys"), testActor) expectMsg(ToClient(Done)) c ! Controller.GetNodes - expectMsgType[Iterable[RoleName]].toSet must be(Set(A, B)) + expectMsgType[Iterable[RoleName]].toSet should be(Set(A, B)) c ! PoisonPill // clean up so network connections don't accumulate during test run } diff --git a/akka-remote-tests/src/test/scala/akka/remote/testkit/STMultiNodeSpec.scala b/akka-remote-tests/src/test/scala/akka/remote/testkit/STMultiNodeSpec.scala index 2414f050c9..bd68c4b239 100644 --- a/akka-remote-tests/src/test/scala/akka/remote/testkit/STMultiNodeSpec.scala +++ b/akka-remote-tests/src/test/scala/akka/remote/testkit/STMultiNodeSpec.scala @@ -5,12 +5,12 @@ package akka.remote.testkit import org.scalatest.{ BeforeAndAfterAll, WordSpecLike } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers /** * Hooks up MultiNodeSpec with ScalaTest */ -trait STMultiNodeSpec extends MultiNodeSpecCallbacks with WordSpecLike with MustMatchers with BeforeAndAfterAll { +trait STMultiNodeSpec extends MultiNodeSpecCallbacks with WordSpecLike with Matchers with BeforeAndAfterAll { override def beforeAll() = multiNodeSpecBeforeAll() diff --git a/akka-remote/src/test/scala/akka/io/ssl/SslTlsSupportSpec.scala b/akka-remote/src/test/scala/akka/io/ssl/SslTlsSupportSpec.scala index ca81d7ce0b..13ed9ce2d0 100644 --- a/akka-remote/src/test/scala/akka/io/ssl/SslTlsSupportSpec.scala +++ b/akka-remote/src/test/scala/akka/io/ssl/SslTlsSupportSpec.scala @@ -286,9 +286,9 @@ class SslTlsSupportSpec extends AkkaSpec { def run() { write("1+2") - readLine() must be === "3" + readLine() should equal("3") write("12+24") - readLine() must be === "36" + readLine() should equal("36") } def write(string: String) { diff --git a/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala b/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala index d225fdd893..0d464bc5e4 100644 --- a/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/AccrualFailureDetectorSpec.scala @@ -41,43 +41,43 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { "use good enough cumulative distribution function" in { val fd = createFailureDetector() - cdf(fd.phi(0, 0, 10)) must be(0.5 plusOrMinus (0.001)) - cdf(fd.phi(6L, 0, 10)) must be(0.7257 plusOrMinus (0.001)) - cdf(fd.phi(15L, 0, 10)) must be(0.9332 plusOrMinus (0.001)) - cdf(fd.phi(20L, 0, 10)) must be(0.97725 plusOrMinus (0.001)) - cdf(fd.phi(25L, 0, 10)) must be(0.99379 plusOrMinus (0.001)) - cdf(fd.phi(35L, 0, 10)) must be(0.99977 plusOrMinus (0.001)) - cdf(fd.phi(40L, 0, 10)) must be(0.99997 plusOrMinus (0.0001)) + cdf(fd.phi(0, 0, 10)) should be(0.5 +- (0.001)) + cdf(fd.phi(6L, 0, 10)) should be(0.7257 +- (0.001)) + cdf(fd.phi(15L, 0, 10)) should be(0.9332 +- (0.001)) + cdf(fd.phi(20L, 0, 10)) should be(0.97725 +- (0.001)) + cdf(fd.phi(25L, 0, 10)) should be(0.99379 +- (0.001)) + cdf(fd.phi(35L, 0, 10)) should be(0.99977 +- (0.001)) + cdf(fd.phi(40L, 0, 10)) should be(0.99997 +- (0.0001)) for (x :: y :: Nil ← (0 to 40).toList.sliding(2)) { - fd.phi(x, 0, 10) must be < (fd.phi(y, 0, 10)) + fd.phi(x, 0, 10) should be < (fd.phi(y, 0, 10)) } - cdf(fd.phi(22, 20.0, 3)) must be(0.7475 plusOrMinus (0.001)) + cdf(fd.phi(22, 20.0, 3)) should be(0.7475 +- (0.001)) } "handle outliers without losing precision or hitting exceptions" in { val fd = createFailureDetector() - fd.phi(10L, 0, 1) must be(38.0 plusOrMinus 1.0) - fd.phi(-25L, 0, 1) must be(0.0) + fd.phi(10L, 0, 1) should be(38.0 +- 1.0) + fd.phi(-25L, 0, 1) should be(0.0) } "return realistic phi values" in { val fd = createFailureDetector() val test = TreeMap(0 -> 0.0, 500 -> 0.1, 1000 -> 0.3, 1200 -> 1.6, 1400 -> 4.7, 1600 -> 10.8, 1700 -> 15.3) for ((timeDiff, expectedPhi) ← test) { - fd.phi(timeDiff = timeDiff, mean = 1000.0, stdDeviation = 100.0) must be(expectedPhi plusOrMinus (0.1)) + fd.phi(timeDiff = timeDiff, mean = 1000.0, stdDeviation = 100.0) should be(expectedPhi +- (0.1)) } // larger stdDeviation results => lower phi - fd.phi(timeDiff = 1100, mean = 1000.0, stdDeviation = 500.0) must be < ( + fd.phi(timeDiff = 1100, mean = 1000.0, stdDeviation = 500.0) should be < ( fd.phi(timeDiff = 1100, mean = 1000.0, stdDeviation = 100.0)) } "return phi value of 0.0 on startup for each address, when no heartbeats" in { val fd = createFailureDetector() - fd.phi must be(0.0) - fd.phi must be(0.0) + fd.phi should be(0.0) + fd.phi should be(0.0) } "return phi based on guess when only one heartbeat" in { @@ -86,9 +86,9 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { clock = fakeTimeGenerator(timeInterval)) fd.heartbeat() - fd.phi must be(0.3 plusOrMinus 0.2) - fd.phi must be(4.5 plusOrMinus 0.3) - fd.phi must be > (15.0) + fd.phi should be(0.3 +- 0.2) + fd.phi should be(4.5 +- 0.3) + fd.phi should be > (15.0) } "return phi value using first interval after second heartbeat" in { @@ -96,22 +96,22 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { val fd = createFailureDetector(clock = fakeTimeGenerator(timeInterval)) fd.heartbeat() - fd.phi must be > (0.0) + fd.phi should be > (0.0) fd.heartbeat() - fd.phi must be > (0.0) + fd.phi should be > (0.0) } "mark node as monitored after a series of successful heartbeats" in { val timeInterval = List[Long](0, 1000, 100, 100) val fd = createFailureDetector(clock = fakeTimeGenerator(timeInterval)) - fd.isMonitoring must be(false) + fd.isMonitoring should be(false) fd.heartbeat() fd.heartbeat() fd.heartbeat() - fd.isMonitoring must be(true) - fd.isAvailable must be(true) + fd.isMonitoring should be(true) + fd.isAvailable should be(true) } "mark node as dead if heartbeat are missed" in { @@ -122,8 +122,8 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat() //1000 fd.heartbeat() //1100 - fd.isAvailable must be(true) //1200 - fd.isAvailable must be(false) //8200 + fd.isAvailable should be(true) //1200 + fd.isAvailable should be(false) //8200 } "mark node as available if it starts heartbeat again after being marked dead due to detection of failure" in { @@ -133,15 +133,15 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { val fd = createFailureDetector(threshold = 8, acceptableLostDuration = 3.seconds, clock = fakeTimeGenerator(timeIntervals)) for (_ ← 0 until 1000) fd.heartbeat() - fd.isAvailable must be(false) // after the long pause + fd.isAvailable should be(false) // after the long pause fd.heartbeat() - fd.isAvailable must be(true) + fd.isAvailable should be(true) fd.heartbeat() - fd.isAvailable must be(false) // after the 7 seconds pause + fd.isAvailable should be(false) // after the 7 seconds pause fd.heartbeat() - fd.isAvailable must be(true) + fd.isAvailable should be(true) fd.heartbeat() - fd.isAvailable must be(true) + fd.isAvailable should be(true) } "accept some configured missing heartbeats" in { @@ -152,9 +152,9 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat() fd.heartbeat() fd.heartbeat() - fd.isAvailable must be(true) + fd.isAvailable should be(true) fd.heartbeat() - fd.isAvailable must be(true) + fd.isAvailable should be(true) } "fail after configured acceptable missing heartbeats" in { @@ -167,9 +167,9 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat() fd.heartbeat() fd.heartbeat() - fd.isAvailable must be(true) + fd.isAvailable should be(true) fd.heartbeat() - fd.isAvailable must be(false) + fd.isAvailable should be(false) } "use maxSampleSize heartbeats" in { @@ -188,7 +188,7 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat() //2000 fd.heartbeat() //2500 val phi2 = fd.phi //3000 - phi2 must be(phi1.plusOrMinus(0.001)) + phi2 should be(phi1.plusOrMinus(0.001)) } } @@ -200,26 +200,26 @@ class AccrualFailureDetectorSpec extends AkkaSpec("akka.loglevel = INFO") { val stats = (HeartbeatHistory(maxSampleSize = 20) /: samples) { (stats, value) ⇒ stats :+ value } - stats.mean must be(179.0 plusOrMinus 0.00001) - stats.variance must be(7584.0 plusOrMinus 0.00001) + stats.mean should be(179.0 +- 0.00001) + stats.variance should be(7584.0 +- 0.00001) } "have 0.0 variance for one sample" in { - (HeartbeatHistory(600) :+ 1000L).variance must be(0.0 plusOrMinus 0.00001) + (HeartbeatHistory(600) :+ 1000L).variance should be(0.0 +- 0.00001) } "be capped by the specified maxSampleSize" in { val history3 = HeartbeatHistory(maxSampleSize = 3) :+ 100 :+ 110 :+ 90 - history3.mean must be(100.0 plusOrMinus 0.00001) - history3.variance must be(66.6666667 plusOrMinus 0.00001) + history3.mean should be(100.0 +- 0.00001) + history3.variance should be(66.6666667 +- 0.00001) val history4 = history3 :+ 140 - history4.mean must be(113.333333 plusOrMinus 0.00001) - history4.variance must be(422.222222 plusOrMinus 0.00001) + history4.mean should be(113.333333 +- 0.00001) + history4.variance should be(422.222222 +- 0.00001) val history5 = history4 :+ 80 - history5.mean must be(103.333333 plusOrMinus 0.00001) - history5.variance must be(688.88888889 plusOrMinus 0.00001) + history5.mean should be(103.333333 +- 0.00001) + history5.variance should be(688.88888889 +- 0.00001) } } diff --git a/akka-remote/src/test/scala/akka/remote/AckedDeliverySpec.scala b/akka-remote/src/test/scala/akka/remote/AckedDeliverySpec.scala index 68a4a38b30..ee731e1933 100644 --- a/akka-remote/src/test/scala/akka/remote/AckedDeliverySpec.scala +++ b/akka-remote/src/test/scala/akka/remote/AckedDeliverySpec.scala @@ -29,16 +29,16 @@ class AckedDeliverySpec extends AkkaSpec { val s2 = SeqNo(2) val s0b = SeqNo(0) - sm1 < s0 must be(true) - sm1 > s0 must be(false) + sm1 < s0 should be(true) + sm1 > s0 should be(false) - s0 < s1 must be(true) - s0 > s1 must be(false) + s0 < s1 should be(true) + s0 > s1 should be(false) - s1 < s2 must be(true) - s1 > s2 must be(false) + s1 < s2 should be(true) + s1 > s2 should be(false) - s0b == s0 must be(true) + s0b == s0 should be(true) } "correctly handle wrapping over" in { @@ -47,14 +47,14 @@ class AckedDeliverySpec extends AkkaSpec { val s3 = SeqNo(Long.MinValue) val s4 = SeqNo(Long.MinValue + 1) - s1 < s2 must be(true) - s1 > s2 must be(false) + s1 < s2 should be(true) + s1 > s2 should be(false) - s2 < s3 must be(true) - s2 > s3 must be(false) + s2 < s3 should be(true) + s2 > s3 should be(false) - s3 < s4 must be(true) - s3 > s4 must be(false) + s3 < s4 should be(true) + s3 > s4 should be(false) } "correctly handle large gaps" in { @@ -62,11 +62,11 @@ class AckedDeliverySpec extends AkkaSpec { val smin2 = SeqNo(Long.MinValue + 1) val s0 = SeqNo(0) - s0 < smin must be(true) - s0 > smin must be(false) + s0 < smin should be(true) + s0 > smin should be(false) - smin2 < s0 must be(true) - smin2 > s0 must be(false) + smin2 < s0 should be(true) + smin2 > s0 should be(false) } } @@ -80,13 +80,13 @@ class AckedDeliverySpec extends AkkaSpec { val msg2 = msg(2) val b1 = b0.buffer(msg0) - b1.nonAcked must be === Vector(msg0) + b1.nonAcked should equal(Vector(msg0)) val b2 = b1.buffer(msg1) - b2.nonAcked must be === Vector(msg0, msg1) + b2.nonAcked should equal(Vector(msg0, msg1)) val b3 = b2.buffer(msg2) - b3.nonAcked must be === Vector(msg0, msg1, msg2) + b3.nonAcked should equal(Vector(msg0, msg1, msg2)) } @@ -107,31 +107,31 @@ class AckedDeliverySpec extends AkkaSpec { val msg4 = msg(4) val b1 = b0.buffer(msg0) - b1.nonAcked must be === Vector(msg0) + b1.nonAcked should equal(Vector(msg0)) val b2 = b1.buffer(msg1) - b2.nonAcked must be === Vector(msg0, msg1) + b2.nonAcked should equal(Vector(msg0, msg1)) val b3 = b2.buffer(msg2) - b3.nonAcked must be === Vector(msg0, msg1, msg2) + b3.nonAcked should equal(Vector(msg0, msg1, msg2)) val b4 = b3.acknowledge(Ack(SeqNo(1))) - b4.nonAcked must be === Vector(msg2) + b4.nonAcked should equal(Vector(msg2)) val b5 = b4.buffer(msg3) - b5.nonAcked must be === Vector(msg2, msg3) + b5.nonAcked should equal(Vector(msg2, msg3)) val b6 = b5.buffer(msg4) - b6.nonAcked must be === Vector(msg2, msg3, msg4) + b6.nonAcked should equal(Vector(msg2, msg3, msg4)) val b7 = b6.acknowledge(Ack(SeqNo(1))) - b7.nonAcked must be === Vector(msg2, msg3, msg4) + b7.nonAcked should equal(Vector(msg2, msg3, msg4)) val b8 = b7.acknowledge(Ack(SeqNo(2))) - b8.nonAcked must be === Vector(msg3, msg4) + b8.nonAcked should equal(Vector(msg3, msg4)) val b9 = b8.acknowledge(Ack(SeqNo(5))) - b9.nonAcked must be === Vector.empty + b9.nonAcked should equal(Vector.empty) } @@ -144,29 +144,29 @@ class AckedDeliverySpec extends AkkaSpec { val msg4 = msg(4) val b1 = b0.buffer(msg0) - b1.nonAcked must be === Vector(msg0) + b1.nonAcked should equal(Vector(msg0)) val b2 = b1.buffer(msg1) - b2.nonAcked must be === Vector(msg0, msg1) + b2.nonAcked should equal(Vector(msg0, msg1)) val b3 = b2.buffer(msg2) - b3.nonAcked must be === Vector(msg0, msg1, msg2) + b3.nonAcked should equal(Vector(msg0, msg1, msg2)) val b4 = b3.acknowledge(Ack(SeqNo(1), nacks = Set(SeqNo(0)))) - b4.nonAcked must be === Vector(msg2) - b4.nacked must be === Vector(msg0) + b4.nonAcked should equal(Vector(msg2)) + b4.nacked should equal(Vector(msg0)) val b5 = b4.buffer(msg3).buffer(msg4) - b5.nonAcked must be === Vector(msg2, msg3, msg4) - b5.nacked must be === Vector(msg0) + b5.nonAcked should equal(Vector(msg2, msg3, msg4)) + b5.nacked should equal(Vector(msg0)) val b6 = b5.acknowledge(Ack(SeqNo(4), nacks = Set(SeqNo(2), SeqNo(3)))) - b6.nonAcked must be === Vector() - b6.nacked must be === Vector(msg2, msg3) + b6.nonAcked should equal(Vector()) + b6.nacked should equal(Vector(msg2, msg3)) val b7 = b6.acknowledge(Ack(SeqNo(5))) - b7.nonAcked must be === Vector.empty - b7.nacked must be === Vector.empty + b7.nonAcked should equal(Vector.empty) + b7.nacked should equal(Vector.empty) } "throw exception if non-buffered sequence number is NACKed" in { @@ -194,28 +194,28 @@ class AckedDeliverySpec extends AkkaSpec { val msg5 = msg(5) val (b1, deliver1, ack1) = b0.receive(msg1).extractDeliverable - deliver1 must be === Vector.empty - ack1 must be === Ack(SeqNo(1), nacks = Set(SeqNo(0))) + deliver1 should equal(Vector.empty) + ack1 should equal(Ack(SeqNo(1), nacks = Set(SeqNo(0)))) val (b2, deliver2, ack2) = b1.receive(msg0).extractDeliverable - deliver2 must be === Vector(msg0, msg1) - ack2 must be === Ack(SeqNo(1)) + deliver2 should equal(Vector(msg0, msg1)) + ack2 should equal(Ack(SeqNo(1))) val (b3, deliver3, ack3) = b2.receive(msg4).extractDeliverable - deliver3 must be === Vector.empty - ack3 must be === Ack(SeqNo(4), nacks = Set(SeqNo(2), SeqNo(3))) + deliver3 should equal(Vector.empty) + ack3 should equal(Ack(SeqNo(4), nacks = Set(SeqNo(2), SeqNo(3)))) val (b4, deliver4, ack4) = b3.receive(msg2).extractDeliverable - deliver4 must be === Vector(msg2) - ack4 must be === Ack(SeqNo(4), nacks = Set(SeqNo(3))) + deliver4 should equal(Vector(msg2)) + ack4 should equal(Ack(SeqNo(4), nacks = Set(SeqNo(3)))) val (b5, deliver5, ack5) = b4.receive(msg5).extractDeliverable - deliver5 must be === Vector.empty - ack5 must be === Ack(SeqNo(5), nacks = Set(SeqNo(3))) + deliver5 should equal(Vector.empty) + ack5 should equal(Ack(SeqNo(5), nacks = Set(SeqNo(3)))) val (_, deliver6, ack6) = b5.receive(msg3).extractDeliverable - deliver6 must be === Vector(msg3, msg4, msg5) - ack6 must be === Ack(SeqNo(5)) + deliver6 should equal(Vector(msg3, msg4, msg5)) + ack6 should equal(Ack(SeqNo(5))) } @@ -237,8 +237,8 @@ class AckedDeliverySpec extends AkkaSpec { val (_, deliver, ack) = buf3.extractDeliverable - deliver must be === Vector.empty - ack must be === Ack(SeqNo(2)) + deliver should equal(Vector.empty) + ack should equal(Ack(SeqNo(2))) } "be able to correctly merge with another receive buffer" in { @@ -254,8 +254,8 @@ class AckedDeliverySpec extends AkkaSpec { buf2.receive(msg1b).receive(msg3)) val (_, deliver, ack) = buf.receive(msg0).extractDeliverable - deliver must be === Vector(msg0, msg1a, msg2, msg3) - ack must be === Ack(SeqNo(3)) + deliver should equal(Vector(msg0, msg1a, msg2, msg3)) + ack should equal(Ack(SeqNo(3))) } } diff --git a/akka-remote/src/test/scala/akka/remote/DaemonicSpec.scala b/akka-remote/src/test/scala/akka/remote/DaemonicSpec.scala index 776aab1417..f27eb6a94c 100644 --- a/akka-remote/src/test/scala/akka/remote/DaemonicSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/DaemonicSpec.scala @@ -47,7 +47,7 @@ class DaemonicSpec extends AkkaSpec { val newNonDaemons: Set[Thread] = Thread.getAllStackTraces().keySet().asScala.seq. filter(t ⇒ !origThreads(t) && t.isDaemon == false).to[Set] - newNonDaemons must be(Set.empty[Thread]) + newNonDaemons should be(Set.empty[Thread]) shutdown(daemonicSystem) } } diff --git a/akka-remote/src/test/scala/akka/remote/EndpointRegistrySpec.scala b/akka-remote/src/test/scala/akka/remote/EndpointRegistrySpec.scala index cc2119689b..56200ac7eb 100644 --- a/akka-remote/src/test/scala/akka/remote/EndpointRegistrySpec.scala +++ b/akka-remote/src/test/scala/akka/remote/EndpointRegistrySpec.scala @@ -18,60 +18,60 @@ class EndpointRegistrySpec extends AkkaSpec { "be able to register a writable endpoint and policy" in { val reg = new EndpointRegistry - reg.writableEndpointWithPolicyFor(address1) must be === None + reg.writableEndpointWithPolicyFor(address1) should equal(None) - reg.registerWritableEndpoint(address1, actorA) must be === actorA + reg.registerWritableEndpoint(address1, actorA) should equal(actorA) - reg.writableEndpointWithPolicyFor(address1) must be === Some(Pass(actorA)) - reg.readOnlyEndpointFor(address1) must be === None - reg.isWritable(actorA) must be(true) - reg.isReadOnly(actorA) must be(false) + reg.writableEndpointWithPolicyFor(address1) should equal(Some(Pass(actorA))) + reg.readOnlyEndpointFor(address1) should equal(None) + reg.isWritable(actorA) should be(true) + reg.isReadOnly(actorA) should be(false) - reg.isQuarantined(address1, 42) must be(false) + reg.isQuarantined(address1, 42) should be(false) } "be able to register a read-only endpoint" in { val reg = new EndpointRegistry - reg.readOnlyEndpointFor(address1) must be === None + reg.readOnlyEndpointFor(address1) should equal(None) - reg.registerReadOnlyEndpoint(address1, actorA) must be === actorA + reg.registerReadOnlyEndpoint(address1, actorA) should equal(actorA) - reg.readOnlyEndpointFor(address1) must be === Some(actorA) - reg.writableEndpointWithPolicyFor(address1) must be === None - reg.isWritable(actorA) must be(false) - reg.isReadOnly(actorA) must be(true) - reg.isQuarantined(address1, 42) must be(false) + reg.readOnlyEndpointFor(address1) should equal(Some(actorA)) + reg.writableEndpointWithPolicyFor(address1) should equal(None) + reg.isWritable(actorA) should be(false) + reg.isReadOnly(actorA) should be(true) + reg.isQuarantined(address1, 42) should be(false) } "be able to register a writable and a read-only endpoint correctly" in { val reg = new EndpointRegistry - reg.readOnlyEndpointFor(address1) must be === None - reg.writableEndpointWithPolicyFor(address1) must be === None + reg.readOnlyEndpointFor(address1) should equal(None) + reg.writableEndpointWithPolicyFor(address1) should equal(None) - reg.registerReadOnlyEndpoint(address1, actorA) must be === actorA - reg.registerWritableEndpoint(address1, actorB) must be === actorB + reg.registerReadOnlyEndpoint(address1, actorA) should equal(actorA) + reg.registerWritableEndpoint(address1, actorB) should equal(actorB) - reg.readOnlyEndpointFor(address1) must be === Some(actorA) - reg.writableEndpointWithPolicyFor(address1) must be === Some(Pass(actorB)) + reg.readOnlyEndpointFor(address1) should equal(Some(actorA)) + reg.writableEndpointWithPolicyFor(address1) should equal(Some(Pass(actorB))) - reg.isWritable(actorA) must be(false) - reg.isWritable(actorB) must be(true) + reg.isWritable(actorA) should be(false) + reg.isWritable(actorB) should be(true) - reg.isReadOnly(actorA) must be(true) - reg.isReadOnly(actorB) must be(false) + reg.isReadOnly(actorA) should be(true) + reg.isReadOnly(actorB) should be(false) } "be able to register Gated policy for an address" in { val reg = new EndpointRegistry - reg.writableEndpointWithPolicyFor(address1) must be === None + reg.writableEndpointWithPolicyFor(address1) should equal(None) reg.registerWritableEndpoint(address1, actorA) val deadline = Deadline.now reg.markAsFailed(actorA, deadline) - reg.writableEndpointWithPolicyFor(address1) must be === Some(Gated(deadline)) - reg.isReadOnly(actorA) must be(false) - reg.isWritable(actorA) must be(false) + reg.writableEndpointWithPolicyFor(address1) should equal(Some(Gated(deadline))) + reg.isReadOnly(actorA) should be(false) + reg.isWritable(actorA) should be(false) } "remove read-only endpoints if marked as failed" in { @@ -79,7 +79,7 @@ class EndpointRegistrySpec extends AkkaSpec { reg.registerReadOnlyEndpoint(address1, actorA) reg.markAsFailed(actorA, Deadline.now) - reg.readOnlyEndpointFor(address1) must be === None + reg.readOnlyEndpointFor(address1) should equal(None) } "keep tombstones when removing an endpoint" in { @@ -94,8 +94,8 @@ class EndpointRegistrySpec extends AkkaSpec { reg.unregisterEndpoint(actorA) reg.unregisterEndpoint(actorB) - reg.writableEndpointWithPolicyFor(address1) must be === Some(Gated(deadline)) - reg.writableEndpointWithPolicyFor(address2) must be === Some(Quarantined(42, deadline)) + reg.writableEndpointWithPolicyFor(address1) should equal(Some(Gated(deadline))) + reg.writableEndpointWithPolicyFor(address2) should equal(Some(Quarantined(42, deadline))) } @@ -109,19 +109,19 @@ class EndpointRegistrySpec extends AkkaSpec { reg.markAsFailed(actorB, farInTheFuture) reg.prune() - reg.writableEndpointWithPolicyFor(address1) must be === None - reg.writableEndpointWithPolicyFor(address2) must be === Some(Gated(farInTheFuture)) + reg.writableEndpointWithPolicyFor(address1) should equal(None) + reg.writableEndpointWithPolicyFor(address2) should equal(Some(Gated(farInTheFuture))) } "be able to register Quarantined policy for an address" in { val reg = new EndpointRegistry val deadline = Deadline.now + 30.minutes - reg.writableEndpointWithPolicyFor(address1) must be === None + reg.writableEndpointWithPolicyFor(address1) should equal(None) reg.markAsQuarantined(address1, 42, deadline) - reg.isQuarantined(address1, 42) must be(true) - reg.isQuarantined(address1, 33) must be(false) - reg.writableEndpointWithPolicyFor(address1) must be === Some(Quarantined(42, deadline)) + reg.isQuarantined(address1, 42) should be(true) + reg.isQuarantined(address1, 33) should be(false) + reg.writableEndpointWithPolicyFor(address1) should equal(Some(Quarantined(42, deadline))) } } diff --git a/akka-remote/src/test/scala/akka/remote/FailureDetectorRegistrySpec.scala b/akka-remote/src/test/scala/akka/remote/FailureDetectorRegistrySpec.scala index 7c9e9f6bab..5ce115e8d1 100644 --- a/akka-remote/src/test/scala/akka/remote/FailureDetectorRegistrySpec.scala +++ b/akka-remote/src/test/scala/akka/remote/FailureDetectorRegistrySpec.scala @@ -52,7 +52,7 @@ class FailureDetectorRegistrySpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat("resource1") fd.heartbeat("resource1") - fd.isAvailable("resource1") must be(true) + fd.isAvailable("resource1") should be(true) } "mark node as dead if heartbeat are missed" in { @@ -63,9 +63,9 @@ class FailureDetectorRegistrySpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat("resource1") //1000 fd.heartbeat("resource1") //1100 - fd.isAvailable("resource1") must be(true) //1200 + fd.isAvailable("resource1") should be(true) //1200 fd.heartbeat("resource2") //5200, but unrelated resource - fd.isAvailable("resource1") must be(false) //8200 + fd.isAvailable("resource1") should be(false) //8200 } "accept some configured missing heartbeats" in { @@ -76,9 +76,9 @@ class FailureDetectorRegistrySpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat("resource1") fd.heartbeat("resource1") fd.heartbeat("resource1") - fd.isAvailable("resource1") must be(true) + fd.isAvailable("resource1") should be(true) fd.heartbeat("resource1") - fd.isAvailable("resource1") must be(true) + fd.isAvailable("resource1") should be(true) } "fail after configured acceptable missing heartbeats" in { @@ -91,9 +91,9 @@ class FailureDetectorRegistrySpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat("resource1") fd.heartbeat("resource1") fd.heartbeat("resource1") - fd.isAvailable("resource1") must be(true) + fd.isAvailable("resource1") should be(true) fd.heartbeat("resource1") - fd.isAvailable("resource1") must be(false) + fd.isAvailable("resource1") should be(false) } "mark node as available after explicit removal of connection" in { @@ -103,37 +103,37 @@ class FailureDetectorRegistrySpec extends AkkaSpec("akka.loglevel = INFO") { fd.heartbeat("resource1") fd.heartbeat("resource1") fd.heartbeat("resource1") - fd.isAvailable("resource1") must be(true) + fd.isAvailable("resource1") should be(true) fd.remove("resource1") - fd.isAvailable("resource1") must be(true) + fd.isAvailable("resource1") should be(true) } "mark node as available after explicit removal of connection and receiving heartbeat again" in { val timeInterval = List[Long](0, 1000, 100, 1100, 1100, 1100, 1100, 1100, 100) val fd = createFailureDetectorRegistry(clock = fakeTimeGenerator(timeInterval)) - fd.isMonitoring("resource1") must be(false) + fd.isMonitoring("resource1") should be(false) fd.heartbeat("resource1") //0 fd.heartbeat("resource1") //1000 fd.heartbeat("resource1") //1100 - fd.isAvailable("resource1") must be(true) //2200 - fd.isMonitoring("resource1") must be(true) + fd.isAvailable("resource1") should be(true) //2200 + fd.isMonitoring("resource1") should be(true) fd.remove("resource1") - fd.isMonitoring("resource1") must be(false) - fd.isAvailable("resource1") must be(true) //3300 + fd.isMonitoring("resource1") should be(false) + fd.isAvailable("resource1") should be(true) //3300 // it receives heartbeat from an explicitly removed node fd.heartbeat("resource1") //4400 fd.heartbeat("resource1") //5500 fd.heartbeat("resource1") //6600 - fd.isAvailable("resource1") must be(true) //6700 - fd.isMonitoring("resource1") must be(true) + fd.isAvailable("resource1") should be(true) //6700 + fd.isMonitoring("resource1") should be(true) } } diff --git a/akka-remote/src/test/scala/akka/remote/LogSourceSpec.scala b/akka-remote/src/test/scala/akka/remote/LogSourceSpec.scala index fa4b8f6be4..1e52996ad6 100644 --- a/akka-remote/src/test/scala/akka/remote/LogSourceSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/LogSourceSpec.scala @@ -45,12 +45,12 @@ class LogSourceSpec extends AkkaSpec( "Log events" must { - "must include host and port for local LogSource" in { + "should include host and port for local LogSource" in { reporter ! "hello" val info = logProbe.expectMsgType[Info] - info.message must be("hello") + info.message should be("hello") val defaultAddress = system.asInstanceOf[ExtendedActorSystem].provider.getDefaultAddress - info.logSource must include(defaultAddress.toString) + info.logSource should include(defaultAddress.toString) } } } diff --git a/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala index 9ec54106ff..53fe1b59e3 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala @@ -24,58 +24,58 @@ class RemoteConfigSpec extends AkkaSpec( val remoteSettings = RARP(system).provider.remoteSettings import remoteSettings._ - LogReceive must be(false) - LogSend must be(false) - UntrustedMode must be(false) - TrustedSelectionPaths must be(Set.empty[String]) - LogRemoteLifecycleEvents must be(true) - ShutdownTimeout.duration must be(10 seconds) - FlushWait must be(2 seconds) - StartupTimeout.duration must be(10 seconds) - RetryGateClosedFor must be(Duration.Zero) - UnknownAddressGateClosedFor must be(1 minute) - Dispatcher must be === "" - UsePassiveConnections must be(true) - MaximumRetriesInWindow must be(3) - RetryWindow must be(60 seconds) - BackoffPeriod must be(10 millis) - SysMsgAckTimeout must be(0.3 seconds) - SysResendTimeout must be(1 seconds) - SysMsgBufferSize must be(1000) - QuarantineDuration must be(60 seconds) - CommandAckTimeout.duration must be(30 seconds) - Transports.size must be(1) - Transports.head._1 must be(classOf[akka.remote.transport.netty.NettyTransport].getName) - Transports.head._2 must be(Nil) - Adapters must be(Map( + LogReceive should be(false) + LogSend should be(false) + UntrustedMode should be(false) + TrustedSelectionPaths should be(Set.empty[String]) + LogRemoteLifecycleEvents should be(true) + ShutdownTimeout.duration should be(10 seconds) + FlushWait should be(2 seconds) + StartupTimeout.duration should be(10 seconds) + RetryGateClosedFor should be(Duration.Zero) + UnknownAddressGateClosedFor should be(1 minute) + Dispatcher should equal("") + UsePassiveConnections should be(true) + MaximumRetriesInWindow should be(3) + RetryWindow should be(60 seconds) + BackoffPeriod should be(10 millis) + SysMsgAckTimeout should be(0.3 seconds) + SysResendTimeout should be(1 seconds) + SysMsgBufferSize should be(1000) + QuarantineDuration should be(60 seconds) + CommandAckTimeout.duration should be(30 seconds) + Transports.size should be(1) + Transports.head._1 should be(classOf[akka.remote.transport.netty.NettyTransport].getName) + Transports.head._2 should be(Nil) + Adapters should be(Map( "gremlin" -> classOf[akka.remote.transport.FailureInjectorProvider].getName, "trttl" -> classOf[akka.remote.transport.ThrottlerProvider].getName)) - WatchFailureDetectorImplementationClass must be(classOf[PhiAccrualFailureDetector].getName) - WatchHeartBeatInterval must be(1 seconds) - WatchHeartbeatExpectedResponseAfter must be(3 seconds) - WatchUnreachableReaperInterval must be(1 second) - WatchFailureDetectorConfig.getDouble("threshold") must be(10.0 plusOrMinus 0.0001) - WatchFailureDetectorConfig.getInt("max-sample-size") must be(200) - Duration(WatchFailureDetectorConfig.getMilliseconds("acceptable-heartbeat-pause"), MILLISECONDS) must be(4 seconds) - Duration(WatchFailureDetectorConfig.getMilliseconds("min-std-deviation"), MILLISECONDS) must be(100 millis) + WatchFailureDetectorImplementationClass should be(classOf[PhiAccrualFailureDetector].getName) + WatchHeartBeatInterval should be(1 seconds) + WatchHeartbeatExpectedResponseAfter should be(3 seconds) + WatchUnreachableReaperInterval should be(1 second) + WatchFailureDetectorConfig.getDouble("threshold") should be(10.0 +- 0.0001) + WatchFailureDetectorConfig.getInt("max-sample-size") should be(200) + Duration(WatchFailureDetectorConfig.getMilliseconds("acceptable-heartbeat-pause"), MILLISECONDS) should be(4 seconds) + Duration(WatchFailureDetectorConfig.getMilliseconds("min-std-deviation"), MILLISECONDS) should be(100 millis) - remoteSettings.config.getString("akka.remote.log-frame-size-exceeding") must be("off") + remoteSettings.config.getString("akka.remote.log-frame-size-exceeding") should be("off") } "be able to parse AkkaProtocol related config elements" in { val settings = new AkkaProtocolSettings(RARP(system).provider.remoteSettings.config) import settings._ - RequireCookie must be(false) - SecureCookie must be === None + RequireCookie should be(false) + SecureCookie should equal(None) - TransportFailureDetectorImplementationClass must be(classOf[PhiAccrualFailureDetector].getName) - TransportHeartBeatInterval must be === 1.seconds - TransportFailureDetectorConfig.getDouble("threshold") must be(7.0 plusOrMinus 0.0001) - TransportFailureDetectorConfig.getInt("max-sample-size") must be(100) - Duration(TransportFailureDetectorConfig.getMilliseconds("acceptable-heartbeat-pause"), MILLISECONDS) must be(3 seconds) - Duration(TransportFailureDetectorConfig.getMilliseconds("min-std-deviation"), MILLISECONDS) must be(100 millis) + TransportFailureDetectorImplementationClass should be(classOf[PhiAccrualFailureDetector].getName) + TransportHeartBeatInterval should equal(1.seconds) + TransportFailureDetectorConfig.getDouble("threshold") should be(7.0 +- 0.0001) + TransportFailureDetectorConfig.getInt("max-sample-size") should be(100) + Duration(TransportFailureDetectorConfig.getMilliseconds("acceptable-heartbeat-pause"), MILLISECONDS) should be(3 seconds) + Duration(TransportFailureDetectorConfig.getMilliseconds("min-std-deviation"), MILLISECONDS) should be(100 millis) } @@ -84,19 +84,19 @@ class RemoteConfigSpec extends AkkaSpec( val s = new NettyTransportSettings(c) import s._ - ConnectionTimeout must be === 15.seconds - WriteBufferHighWaterMark must be === None - WriteBufferLowWaterMark must be === None - SendBufferSize must be === Some(256000) - ReceiveBufferSize must be === Some(256000) - MaxFrameSize must be === 128000 - Backlog must be === 4096 - TcpNodelay must be(true) - TcpKeepalive must be(true) - TcpReuseAddr must be(!Helpers.isWindows) - c.getString("hostname") must be === "" - ServerSocketWorkerPoolSize must be === 2 - ClientSocketWorkerPoolSize must be === 2 + ConnectionTimeout should equal(15.seconds) + WriteBufferHighWaterMark should equal(None) + WriteBufferLowWaterMark should equal(None) + SendBufferSize should equal(Some(256000)) + ReceiveBufferSize should equal(Some(256000)) + MaxFrameSize should equal(128000) + Backlog should equal(4096) + TcpNodelay should be(true) + TcpKeepalive should be(true) + TcpReuseAddr should be(!Helpers.isWindows) + c.getString("hostname") should equal("") + ServerSocketWorkerPoolSize should equal(2) + ClientSocketWorkerPoolSize should equal(2) } "contain correct socket worker pool configuration values in reference.conf" in { @@ -105,37 +105,37 @@ class RemoteConfigSpec extends AkkaSpec( // server-socket-worker-pool { val pool = c.getConfig("server-socket-worker-pool") - pool.getInt("pool-size-min") must equal(2) + pool.getInt("pool-size-min") should equal(2) - pool.getDouble("pool-size-factor") must equal(1.0) - pool.getInt("pool-size-max") must equal(2) + pool.getDouble("pool-size-factor") should equal(1.0) + pool.getInt("pool-size-max") should equal(2) } // client-socket-worker-pool { val pool = c.getConfig("client-socket-worker-pool") - pool.getInt("pool-size-min") must equal(2) - pool.getDouble("pool-size-factor") must equal(1.0) - pool.getInt("pool-size-max") must equal(2) + pool.getInt("pool-size-min") should equal(2) + pool.getDouble("pool-size-factor") should equal(1.0) + pool.getInt("pool-size-max") should equal(2) } } "contain correct ssl configuration values in reference.conf" in { val sslSettings = new SSLSettings(system.settings.config.getConfig("akka.remote.netty.ssl.security")) - sslSettings.SSLKeyStore must be(Some("keystore")) - sslSettings.SSLKeyStorePassword must be(Some("changeme")) - sslSettings.SSLKeyPassword must be(Some("changeme")) - sslSettings.SSLTrustStore must be(Some("truststore")) - sslSettings.SSLTrustStorePassword must be(Some("changeme")) - sslSettings.SSLProtocol must be(Some("TLSv1")) - sslSettings.SSLEnabledAlgorithms must be(Set("TLS_RSA_WITH_AES_128_CBC_SHA")) - sslSettings.SSLRandomNumberGenerator must be(None) + sslSettings.SSLKeyStore should be(Some("keystore")) + sslSettings.SSLKeyStorePassword should be(Some("changeme")) + sslSettings.SSLKeyPassword should be(Some("changeme")) + sslSettings.SSLTrustStore should be(Some("truststore")) + sslSettings.SSLTrustStorePassword should be(Some("changeme")) + sslSettings.SSLProtocol should be(Some("TLSv1")) + sslSettings.SSLEnabledAlgorithms should be(Set("TLS_RSA_WITH_AES_128_CBC_SHA")) + sslSettings.SSLRandomNumberGenerator should be(None) } "have debug logging of the failure injector turned off in reference.conf" in { val c = RARP(system).provider.remoteSettings.config.getConfig("akka.remote.gremlin") - c.getBoolean("debug") must be(false) + c.getBoolean("debug") should be(false) } } } diff --git a/akka-remote/src/test/scala/akka/remote/RemoteDeployerSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteDeployerSpec.scala index 8f30b8c66a..60f20abcf5 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteDeployerSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteDeployerSpec.scala @@ -38,7 +38,7 @@ class RemoteDeployerSpec extends AkkaSpec(RemoteDeployerSpec.deployerConf) { val service = "/service2" val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1)) - deployment must be(Some( + deployment should be(Some( Deploy( service, deployment.get.config, @@ -50,7 +50,7 @@ class RemoteDeployerSpec extends AkkaSpec(RemoteDeployerSpec.deployerConf) { "reject remote deployment when the source requires LocalScope" in { intercept[ConfigurationException] { system.actorOf(Props.empty.withDeploy(Deploy.local), "service2") - }.getMessage must be === "configuration requested remote deployment for local-only Props at [akka://RemoteDeployerSpec/user/service2]" + }.getMessage should equal("configuration requested remote deployment for local-only Props at [akka://RemoteDeployerSpec/user/service2]") } } diff --git a/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala index b91d367fef..e91c5db251 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala @@ -86,9 +86,9 @@ class RemoteRouterSpec extends AkkaSpec(""" probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 - children.map(_.parent) must have size 1 - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + children should have size 2 + children.map(_.parent) should have size 1 + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -101,9 +101,9 @@ class RemoteRouterSpec extends AkkaSpec(""" probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 - children.map(_.parent) must have size 1 - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + children should have size 2 + children.map(_.parent) should have size 1 + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -115,26 +115,26 @@ class RemoteRouterSpec extends AkkaSpec(""" probe.expectMsgType[ActorRef].path } val children = replies.toSet - children.size must be >= 2 - children.map(_.parent) must have size 1 - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + children.size should be >= 2 + children.map(_.parent) should have size 1 + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } "deploy remote routers based on configuration" in { val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(FromConfig.props(Props[Echo]), "remote-blub") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 + children should have size 2 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -142,17 +142,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(RoundRobinPool(2).props(Props[Echo]) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "remote-blub2") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 + children should have size 2 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -160,17 +160,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(RoundRobinPool(2).props(Props[Echo]) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "local-blub") - router.path.address.toString must be("akka://MasterRemoteRouterSpec") + router.path.address.toString should be("akka://MasterRemoteRouterSpec") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 + children should have size 2 val parents = children.map(_.parent) - parents must have size 1 - parents.head.address must be(Address("akka.tcp", sysName, "localhost", port)) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head.address should be(Address("akka.tcp", sysName, "localhost", port)) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -178,17 +178,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(RoundRobinPool(2).props(Props[Echo]) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "local-blub2") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 4 + children should have size 4 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -196,17 +196,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(RoundRobinPool(2).props(Props[Echo]) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "remote-override") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 4 + children should have size 4 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } diff --git a/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala b/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala index 7b601a966d..624e4c5f59 100644 --- a/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemotingSpec.scala @@ -244,7 +244,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D } within(5.seconds) { - receiveN(n * 2) foreach { reply ⇒ reply must be(("pong", testActor)) } + receiveN(n * 2) foreach { reply ⇒ reply should be(("pong", testActor)) } } // then we shutdown all but one system to simulate broken connections @@ -259,13 +259,13 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D // ping messages to aliveEcho should go through even though we use many different broken connections within(5.seconds) { - receiveN(n) foreach { reply ⇒ reply must be(("pong", testActor)) } + receiveN(n) foreach { reply ⇒ reply should be(("pong", testActor)) } } } "create and supervise children on remote node" in { val r = system.actorOf(Props[Echo1], "blub") - r.path.toString must be === "akka.test://remote-sys@localhost:12346/remote/akka.test/RemotingSpec@localhost:12345/user/blub" + r.path.toString should equal("akka.test://remote-sys@localhost:12346/remote/akka.test/RemotingSpec@localhost:12345/user/blub") r ! 42 expectMsg(42) EventFilter[Exception]("crash", occurrences = 1).intercept { @@ -291,7 +291,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D echo2 ! 73 expectMsg(73) // msg to old ActorRef (different uid) should not get through - echo2.path.uid must not be (echo.path.uid) + echo2.path.uid should not be (echo.path.uid) echo ! 74 expectNoMsg(1.second) @@ -321,19 +321,19 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D // grandchild is configured to be deployed on RemotingSpec (system) child ! ((Props[Echo1], "grandchild")) val grandchild = expectMsgType[ActorRef] - grandchild.asInstanceOf[ActorRefScope].isLocal must be(true) + grandchild.asInstanceOf[ActorRefScope].isLocal should be(true) grandchild ! 43 expectMsg(43) val myref = system.actorFor(system / "looker1" / "child" / "grandchild") - myref.isInstanceOf[RemoteActorRef] must be(true) + myref.isInstanceOf[RemoteActorRef] should be(true) myref ! 44 expectMsg(44) - lastSender must be(grandchild) - lastSender must be theSameInstanceAs grandchild - child.asInstanceOf[RemoteActorRef].getParent must be(l) - system.actorFor("/user/looker1/child") must be theSameInstanceAs child - Await.result(l ? ActorForReq("child/.."), timeout.duration).asInstanceOf[AnyRef] must be theSameInstanceAs l - Await.result(system.actorFor(system / "looker1" / "child") ? ActorForReq(".."), timeout.duration).asInstanceOf[AnyRef] must be theSameInstanceAs l + lastSender should be(grandchild) + lastSender should be theSameInstanceAs grandchild + child.asInstanceOf[RemoteActorRef].getParent should be(l) + system.actorFor("/user/looker1/child") should be theSameInstanceAs child + Await.result(l ? ActorForReq("child/.."), timeout.duration).asInstanceOf[AnyRef] should be theSameInstanceAs l + Await.result(system.actorFor(system / "looker1" / "child") ? ActorForReq(".."), timeout.duration).asInstanceOf[AnyRef] should be theSameInstanceAs l watch(child) child ! PoisonPill @@ -344,7 +344,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D child2 ! 45 expectMsg(45) // msg to old ActorRef (different uid) should not get through - child2.path.uid must not be (child.path.uid) + child2.path.uid should not be (child.path.uid) child ! 46 expectNoMsg(1.second) system.actorFor(system / "looker1" / "child") ! 47 @@ -364,25 +364,25 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D // grandchild is configured to be deployed on RemotingSpec (system) child ! ((Props[Echo1], "grandchild")) val grandchild = expectMsgType[ActorRef] - grandchild.asInstanceOf[ActorRefScope].isLocal must be(true) + grandchild.asInstanceOf[ActorRefScope].isLocal should be(true) grandchild ! 53 expectMsg(53) val mysel = system.actorSelection(system / "looker2" / "child" / "grandchild") mysel ! 54 expectMsg(54) - lastSender must be(grandchild) - lastSender must be theSameInstanceAs grandchild + lastSender should be(grandchild) + lastSender should be theSameInstanceAs grandchild mysel ! Identify(mysel) val grandchild2 = expectMsgType[ActorIdentity].ref - grandchild2 must be === Some(grandchild) + grandchild2 should equal(Some(grandchild)) system.actorSelection("/user/looker2/child") ! Identify(None) - expectMsgType[ActorIdentity].ref must be === Some(child) + expectMsgType[ActorIdentity].ref should equal(Some(child)) l ! ActorSelReq("child/..") expectMsgType[ActorSelection] ! Identify(None) - expectMsgType[ActorIdentity].ref.get must be theSameInstanceAs l + expectMsgType[ActorIdentity].ref.get should be theSameInstanceAs l system.actorSelection(system / "looker2" / "child") ! ActorSelReq("..") expectMsgType[ActorSelection] ! Identify(None) - expectMsgType[ActorIdentity].ref.get must be theSameInstanceAs l + expectMsgType[ActorIdentity].ref.get should be theSameInstanceAs l grandchild ! ((Props[Echo1], "grandgrandchild")) val grandgrandchild = expectMsgType[ActorRef] @@ -421,7 +421,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D watch(child) child ! PoisonPill expectMsg("postStop") - expectMsgType[Terminated].actor must be === child + expectMsgType[Terminated].actor should equal(child) l ! ((Props[Echo1], "child")) val child2 = expectMsgType[ActorRef] child2 ! Identify("idReq15") @@ -434,7 +434,7 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D child2 ! 55 expectMsg(55) // msg to old ActorRef (different uid) should not get through - child2.path.uid must not be (child.path.uid) + child2.path.uid should not be (child.path.uid) child ! 56 expectNoMsg(1.second) system.actorSelection(system / "looker2" / "child") ! 57 @@ -444,12 +444,12 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D "not fail ask across node boundaries" in within(5.seconds) { import system.dispatcher val f = for (_ ← 1 to 1000) yield here ? "ping" mapTo manifest[(String, ActorRef)] - Await.result(Future.sequence(f), remaining).map(_._1).toSet must be(Set("pong")) + Await.result(Future.sequence(f), remaining).map(_._1).toSet should be(Set("pong")) } "be able to use multiple transports and use the appropriate one (TCP)" in { val r = system.actorOf(Props[Echo1], "gonk") - r.path.toString must be === + 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 ! 42 expectMsg(42) @@ -465,7 +465,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 must be === + 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 ! 42 expectMsg(10.seconds, 42) @@ -481,7 +481,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 must be === + 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 ! 42 expectMsg(10.seconds, 42) diff --git a/akka-remote/src/test/scala/akka/remote/SerializationChecksPlainRemotingSpec.scala b/akka-remote/src/test/scala/akka/remote/SerializationChecksPlainRemotingSpec.scala index 33434a560c..f058b5c6d2 100644 --- a/akka-remote/src/test/scala/akka/remote/SerializationChecksPlainRemotingSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/SerializationChecksPlainRemotingSpec.scala @@ -10,8 +10,8 @@ class SerializationChecksPlainRemotingSpec extends AkkaSpec { "Settings serialize-messages and serialize-creators" must { "be on for tests" in { - system.settings.SerializeAllCreators must be(true) - system.settings.SerializeAllMessages must be(true) + system.settings.SerializeAllCreators should be(true) + system.settings.SerializeAllMessages should be(true) } } diff --git a/akka-remote/src/test/scala/akka/remote/SerializeCreatorsVerificationSpec.scala b/akka-remote/src/test/scala/akka/remote/SerializeCreatorsVerificationSpec.scala index 6b2a20238a..193333b16e 100644 --- a/akka-remote/src/test/scala/akka/remote/SerializeCreatorsVerificationSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/SerializeCreatorsVerificationSpec.scala @@ -8,8 +8,8 @@ import akka.testkit.AkkaSpec class SerializeCreatorsVerificationSpec extends AkkaSpec { - "serialize-creators must be on" in { - system.settings.SerializeAllCreators must be === true + "serialize-creators should be on" in { + system.settings.SerializeAllCreators should equal(true) } } \ No newline at end of file diff --git a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala index 0f216150e0..e15c15c527 100644 --- a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala @@ -156,7 +156,7 @@ abstract class Ticket1978CommunicationSpec(val cipherConfig: CipherConfig) exten } val f = for (i ← 1 to 1000) yield here ? (("ping", i)) mapTo classTag[((String, Int), ActorRef)] - Await.result(Future.sequence(f), timeout.duration).map(_._1._1).toSet must be(Set("pong")) + Await.result(Future.sequence(f), timeout.duration).map(_._1._1).toSet should be(Set("pong")) } } else { diff --git a/akka-remote/src/test/scala/akka/remote/Ticket1978ConfigSpec.scala b/akka-remote/src/test/scala/akka/remote/Ticket1978ConfigSpec.scala index 4bf3ca1680..92a44c1848 100644 --- a/akka-remote/src/test/scala/akka/remote/Ticket1978ConfigSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/Ticket1978ConfigSpec.scala @@ -18,14 +18,14 @@ class Ticket1978ConfigSpec extends AkkaSpec(""" "be able to parse these extra Netty config elements" in { val settings = new SSLSettings(system.settings.config.getConfig("akka.remote.netty.ssl.security")) - settings.SSLKeyStore must be(Some("keystore")) - settings.SSLKeyStorePassword must be(Some("changeme")) - settings.SSLKeyPassword must be(Some("changeme")) - settings.SSLTrustStore must be(Some("truststore")) - settings.SSLTrustStorePassword must be(Some("changeme")) - settings.SSLProtocol must be(Some("TLSv1")) - settings.SSLEnabledAlgorithms must be(Set("TLS_RSA_WITH_AES_128_CBC_SHA")) - settings.SSLRandomNumberGenerator must be(Some("AES128CounterSecureRNG")) + settings.SSLKeyStore should be(Some("keystore")) + settings.SSLKeyStorePassword should be(Some("changeme")) + settings.SSLKeyPassword should be(Some("changeme")) + settings.SSLTrustStore should be(Some("truststore")) + settings.SSLTrustStorePassword should be(Some("changeme")) + settings.SSLProtocol should be(Some("TLSv1")) + settings.SSLEnabledAlgorithms should be(Set("TLS_RSA_WITH_AES_128_CBC_SHA")) + settings.SSLRandomNumberGenerator should be(Some("AES128CounterSecureRNG")) } } } diff --git a/akka-remote/src/test/scala/akka/remote/TypedActorRemoteDeploySpec.scala b/akka-remote/src/test/scala/akka/remote/TypedActorRemoteDeploySpec.scala index dd6d424a58..ffeb7f318f 100644 --- a/akka-remote/src/test/scala/akka/remote/TypedActorRemoteDeploySpec.scala +++ b/akka-remote/src/test/scala/akka/remote/TypedActorRemoteDeploySpec.scala @@ -38,7 +38,7 @@ class TypedActorRemoteDeploySpec extends AkkaSpec(conf) { val ts = TypedActor(system) val echoService: RemoteNameService = ts.typedActorOf( TypedProps[RemoteNameServiceImpl].withDeploy(Deploy(scope = RemoteScope(remoteAddress)))) - Await.result(f(echoService), 3.seconds) must be(expected) + Await.result(f(echoService), 3.seconds) should be(expected) val actor = ts.getActorRefFor(echoService) system.stop(actor) verifyActorTermination(actor) diff --git a/akka-remote/src/test/scala/akka/remote/oldrouting/RemoteRouterSpec.scala b/akka-remote/src/test/scala/akka/remote/oldrouting/RemoteRouterSpec.scala index 058714ffcb..14f105022a 100644 --- a/akka-remote/src/test/scala/akka/remote/oldrouting/RemoteRouterSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/oldrouting/RemoteRouterSpec.scala @@ -87,9 +87,9 @@ class RemoteRouterSpec extends AkkaSpec(""" probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 - children.map(_.parent) must have size 1 - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + children should have size 2 + children.map(_.parent) should have size 1 + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -102,9 +102,9 @@ class RemoteRouterSpec extends AkkaSpec(""" probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 - children.map(_.parent) must have size 1 - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + children should have size 2 + children.map(_.parent) should have size 1 + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -116,26 +116,26 @@ class RemoteRouterSpec extends AkkaSpec(""" probe.expectMsgType[ActorRef].path } val children = replies.toSet - children.size must be >= 2 - children.map(_.parent) must have size 1 - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + children.size should be >= 2 + children.map(_.parent) should have size 1 + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } "deploy remote routers based on configuration" in { val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(Props[Echo].withRouter(FromConfig), "remote-blub") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 + children should have size 2 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -143,17 +143,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "remote-blub2") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 + children should have size 2 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -161,17 +161,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "local-blub") - router.path.address.toString must be("akka://MasterRemoteRouterSpec") + router.path.address.toString should be("akka://MasterRemoteRouterSpec") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 2 + children should have size 2 val parents = children.map(_.parent) - parents must have size 1 - parents.head.address must be(Address("akka.tcp", sysName, "localhost", port)) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head.address should be(Address("akka.tcp", sysName, "localhost", port)) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -179,17 +179,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "local-blub2") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 4 + children should have size 4 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } @@ -197,17 +197,17 @@ class RemoteRouterSpec extends AkkaSpec(""" val probe = TestProbe()(masterSystem) val router = masterSystem.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString(s"akka.tcp://${sysName}@localhost:${port}")))), "remote-override") - router.path.address.toString must be(s"akka.tcp://${sysName}@localhost:${port}") + router.path.address.toString should be(s"akka.tcp://${sysName}@localhost:${port}") val replies = for (i ← 1 to 5) yield { router.tell("", probe.ref) probe.expectMsgType[ActorRef].path } val children = replies.toSet - children must have size 4 + children should have size 4 val parents = children.map(_.parent) - parents must have size 1 - parents.head must be(router.path) - children foreach (_.address.toString must be === s"akka.tcp://${sysName}@localhost:${port}") + parents should have size 1 + parents.head should be(router.path) + children foreach (_.address.toString should equal(s"akka.tcp://${sysName}@localhost:${port}")) masterSystem.stop(router) } diff --git a/akka-remote/src/test/scala/akka/remote/serialization/DaemonMsgCreateSerializerSpec.scala b/akka-remote/src/test/scala/akka/remote/serialization/DaemonMsgCreateSerializerSpec.scala index 760753cd2b..ff82ae948b 100644 --- a/akka-remote/src/test/scala/akka/remote/serialization/DaemonMsgCreateSerializerSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/serialization/DaemonMsgCreateSerializerSpec.scala @@ -32,7 +32,7 @@ class DaemonMsgCreateSerializerSpec extends AkkaSpec { "Serialization" must { "resolve DaemonMsgCreateSerializer" in { - ser.serializerFor(classOf[DaemonMsgCreate]).getClass must be(classOf[DaemonMsgCreateSerializer]) + ser.serializerFor(classOf[DaemonMsgCreate]).getClass should be(classOf[DaemonMsgCreateSerializer]) } "serialize and de-serialize DaemonMsgCreate with FromClassCreator" in { diff --git a/akka-remote/src/test/scala/akka/remote/serialization/MessageContainerSerializerSpec.scala b/akka-remote/src/test/scala/akka/remote/serialization/MessageContainerSerializerSpec.scala index dcf0ce31f8..256ab18131 100644 --- a/akka-remote/src/test/scala/akka/remote/serialization/MessageContainerSerializerSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/serialization/MessageContainerSerializerSpec.scala @@ -21,7 +21,7 @@ class MessageContainerSerializerSpec extends AkkaSpec { "DaemonMsgCreateSerializer" must { "resolve serializer for ActorSelectionMessage" in { - ser.serializerFor(classOf[ActorSelectionMessage]).getClass must be(classOf[MessageContainerSerializer]) + ser.serializerFor(classOf[ActorSelectionMessage]).getClass should be(classOf[MessageContainerSerializer]) } "serialize and de-serialize ActorSelectionMessage" in { @@ -31,7 +31,7 @@ class MessageContainerSerializerSpec extends AkkaSpec { } def verifySerialization(msg: AnyRef): Unit = { - ser.deserialize(ser.serialize(msg).get, msg.getClass).get must be(msg) + ser.deserialize(ser.serialize(msg).get, msg.getClass).get should be(msg) } } diff --git a/akka-remote/src/test/scala/akka/remote/serialization/ProtobufSerializerSpec.scala b/akka-remote/src/test/scala/akka/remote/serialization/ProtobufSerializerSpec.scala index cbdc4e8e7d..37bd936a49 100644 --- a/akka-remote/src/test/scala/akka/remote/serialization/ProtobufSerializerSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/serialization/ProtobufSerializerSpec.scala @@ -17,8 +17,8 @@ class ProtobufSerializerSpec extends AkkaSpec { "Serialization" must { "resolve protobuf serializer" in { - ser.serializerFor(classOf[SerializedMessage]).getClass must be(classOf[ProtobufSerializer]) - ser.serializerFor(classOf[MyMessage]).getClass must be(classOf[ProtobufSerializer]) + ser.serializerFor(classOf[SerializedMessage]).getClass should be(classOf[ProtobufSerializer]) + ser.serializerFor(classOf[MyMessage]).getClass should be(classOf[ProtobufSerializer]) } } diff --git a/akka-remote/src/test/scala/akka/remote/transport/AkkaProtocolSpec.scala b/akka-remote/src/test/scala/akka/remote/transport/AkkaProtocolSpec.scala index d8ed939266..b657cd6455 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/AkkaProtocolSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/AkkaProtocolSpec.scala @@ -152,13 +152,13 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re val wrappedHandle = expectMsgPF() { case InboundAssociation(h: AkkaProtocolHandle) ⇒ - h.handshakeInfo.uid must be === 33 + h.handshakeInfo.uid should equal(33) h } wrappedHandle.readHandlerPromise.success(ActorHandleEventListener(testActor)) - failureDetector.called must be(true) + failureDetector.called should be(true) // Heartbeat was sent in response to Associate awaitCond(lastActivityIsHeartbeat(registry)) @@ -166,7 +166,7 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re reader ! testPayload expectMsgPF() { - case InboundPayload(p) ⇒ p must be === testEnvelope + case InboundPayload(p) ⇒ p should equal(testEnvelope) } } @@ -210,21 +210,21 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re refuseUid = None)) awaitCond(lastActivityIsAssociate(registry, 42, None)) - failureDetector.called must be(true) + failureDetector.called should be(true) // keeps sending heartbeats awaitCond(lastActivityIsHeartbeat(registry)) - statusPromise.isCompleted must be(false) + statusPromise.isCompleted should be(false) // finish connection by sending back an associate message reader ! testAssociate(33, None) Await.result(statusPromise.future, 3.seconds) match { case h: AkkaProtocolHandle ⇒ - h.remoteAddress must be === remoteAkkaAddress - h.localAddress must be === localAkkaAddress - h.handshakeInfo.uid must be === 33 + h.remoteAddress should equal(remoteAkkaAddress) + h.localAddress should equal(localAkkaAddress) + h.handshakeInfo.uid should equal(33) case _ ⇒ fail() } @@ -266,14 +266,14 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re val wrappedHandle = expectMsgPF() { case InboundAssociation(h: AkkaProtocolHandle) ⇒ - h.handshakeInfo.uid must be === 33 - h.handshakeInfo.cookie must be === Some("abcde") + h.handshakeInfo.uid should equal(33) + h.handshakeInfo.cookie should equal(Some("abcde")) h } wrappedHandle.readHandlerPromise.success(ActorHandleEventListener(testActor)) - failureDetector.called must be(true) + failureDetector.called should be(true) // Heartbeat was sent in response to Associate awaitCond(lastActivityIsHeartbeat(registry)) @@ -320,8 +320,8 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re val wrappedHandle = Await.result(statusPromise.future, 3.seconds) match { case h: AssociationHandle ⇒ - h.remoteAddress must be === remoteAkkaAddress - h.localAddress must be === localAkkaAddress + h.remoteAddress should equal(remoteAkkaAddress) + h.localAddress should equal(localAkkaAddress) h case _ ⇒ fail() @@ -356,8 +356,8 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re val wrappedHandle = Await.result(statusPromise.future, 3.seconds) match { case h: AssociationHandle ⇒ - h.remoteAddress must be === remoteAkkaAddress - h.localAddress must be === localAkkaAddress + h.remoteAddress should equal(remoteAkkaAddress) + h.localAddress should equal(localAkkaAddress) h case _ ⇒ fail() @@ -392,8 +392,8 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re val wrappedHandle = Await.result(statusPromise.future, 3.seconds) match { case h: AssociationHandle ⇒ - h.remoteAddress must be === remoteAkkaAddress - h.localAddress must be === localAkkaAddress + h.remoteAddress should equal(remoteAkkaAddress) + h.localAddress should equal(localAkkaAddress) h case _ ⇒ fail() @@ -431,8 +431,8 @@ class AkkaProtocolSpec extends AkkaSpec("""akka.actor.provider = "akka.remote.Re val wrappedHandle = Await.result(statusPromise.future, 3.seconds) match { case h: AssociationHandle ⇒ - h.remoteAddress must be === remoteAkkaAddress - h.localAddress must be === localAkkaAddress + h.remoteAddress should equal(remoteAkkaAddress) + h.localAddress should equal(localAkkaAddress) h case _ ⇒ fail() diff --git a/akka-remote/src/test/scala/akka/remote/transport/GenericTransportSpec.scala b/akka-remote/src/test/scala/akka/remote/transport/GenericTransportSpec.scala index 20813008d5..e603414f12 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/GenericTransportSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/GenericTransportSpec.scala @@ -44,13 +44,13 @@ abstract class GenericTransportSpec(withAkkaProtocol: Boolean = false) val result = Await.result(transportA.listen, timeout.duration) - result._1 must be(addressA) - result._2 must not be null + result._1 should be(addressA) + result._2 should not be null registry.logSnapshot.exists { case ListenAttempt(address) ⇒ address == addressATest case _ ⇒ false - } must be(true) + } should be(true) } "associate successfully with another transport of its kind" in { @@ -69,7 +69,7 @@ abstract class GenericTransportSpec(withAkkaProtocol: Boolean = false) case InboundAssociation(handle) if handle.remoteAddress == addressA ⇒ } - registry.logSnapshot.contains(AssociateAttempt(addressATest, addressBTest)) must be(true) + registry.logSnapshot.contains(AssociateAttempt(addressATest, addressBTest)) should be(true) awaitCond(registry.existsAssociation(addressATest, addressBTest)) } @@ -118,7 +118,7 @@ abstract class GenericTransportSpec(withAkkaProtocol: Boolean = false) registry.logSnapshot.exists { case WriteAttempt(`addressATest`, `addressBTest`, sentPdu) ⇒ sentPdu == pdu case _ ⇒ false - } must be(true) + } should be(true) } "successfully disassociate" in { diff --git a/akka-remote/src/test/scala/akka/remote/transport/SwitchableLoggedBehaviorSpec.scala b/akka-remote/src/test/scala/akka/remote/transport/SwitchableLoggedBehaviorSpec.scala index 25a696f131..ee980c85a5 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/SwitchableLoggedBehaviorSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/SwitchableLoggedBehaviorSpec.scala @@ -21,14 +21,14 @@ class SwitchableLoggedBehaviorSpec extends AkkaSpec with DefaultTimeout { "execute default behavior" in { val behavior = defaultBehavior - Await.result(behavior(()), timeout.duration) must be === 3 + Await.result(behavior(()), timeout.duration) should equal(3) } "be able to push generic behavior" in { val behavior = defaultBehavior behavior.push((_) ⇒ Promise.successful(4).future) - Await.result(behavior(()), timeout.duration) must be(4) + Await.result(behavior(()), timeout.duration) should be(4) behavior.push((_) ⇒ Promise.failed(TestException).future) behavior(()).value match { @@ -41,8 +41,8 @@ class SwitchableLoggedBehaviorSpec extends AkkaSpec with DefaultTimeout { val behavior = defaultBehavior behavior.pushConstant(5) - Await.result(behavior(()), timeout.duration) must be(5) - Await.result(behavior(()), timeout.duration) must be(5) + Await.result(behavior(()), timeout.duration) should be(5) + Await.result(behavior(()), timeout.duration) should be(5) } "be able to push failure behavior" in { @@ -59,16 +59,16 @@ class SwitchableLoggedBehaviorSpec extends AkkaSpec with DefaultTimeout { val behavior = defaultBehavior behavior.pushConstant(5) - Await.result(behavior(()), timeout.duration) must be(5) + Await.result(behavior(()), timeout.duration) should be(5) behavior.pushConstant(7) - Await.result(behavior(()), timeout.duration) must be(7) + Await.result(behavior(()), timeout.duration) should be(7) behavior.pop() - Await.result(behavior(()), timeout.duration) must be(5) + Await.result(behavior(()), timeout.duration) should be(5) behavior.pop() - Await.result(behavior(()), timeout.duration) must be(3) + Await.result(behavior(()), timeout.duration) should be(3) } @@ -78,7 +78,7 @@ class SwitchableLoggedBehaviorSpec extends AkkaSpec with DefaultTimeout { behavior.pop() behavior.pop() - Await.result(behavior(()), timeout.duration) must be(3) + Await.result(behavior(()), timeout.duration) should be(3) } "enable delayed completition" in { @@ -86,7 +86,7 @@ class SwitchableLoggedBehaviorSpec extends AkkaSpec with DefaultTimeout { val controlPromise = behavior.pushDelayed val f = behavior(()) - f.isCompleted must be(false) + f.isCompleted should be(false) controlPromise.success(()) awaitCond(f.isCompleted) @@ -97,7 +97,7 @@ class SwitchableLoggedBehaviorSpec extends AkkaSpec with DefaultTimeout { val behavior = new SwitchableLoggedBehavior[Int, Int]((i) ⇒ Promise.successful(3).future, (i) ⇒ logPromise.success(i)) behavior(11) - Await.result(logPromise.future, timeout.duration) must be(11) + Await.result(logPromise.future, timeout.duration) should be(11) } } diff --git a/akka-remote/src/test/scala/akka/remote/transport/SystemMessageDeliveryStressTest.scala b/akka-remote/src/test/scala/akka/remote/transport/SystemMessageDeliveryStressTest.scala index 225b91c8b8..a245d3ccd9 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/SystemMessageDeliveryStressTest.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/SystemMessageDeliveryStressTest.scala @@ -124,7 +124,7 @@ abstract class SystemMessageDeliveryStressTest(msg: String, cfg: String) val toSend = (0 until MsgCount).toList val received = expectMsgAllOf(45.seconds, toSend: _*) - received must be === toSend + received should equal(toSend) } } diff --git a/akka-remote/src/test/scala/akka/remote/transport/TestTransportSpec.scala b/akka-remote/src/test/scala/akka/remote/transport/TestTransportSpec.scala index 8312018738..8c8f7e0269 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/TestTransportSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/TestTransportSpec.scala @@ -22,13 +22,13 @@ class TestTransportSpec extends AkkaSpec with DefaultTimeout with ImplicitSender val result = Await.result(transportA.listen, timeout.duration) - result._1 must be(addressA) - result._2 must not be null + result._1 should be(addressA) + result._2 should not be null registry.logSnapshot.exists { case ListenAttempt(address) ⇒ address == addressA case _ ⇒ false - } must be(true) + } should be(true) } "associate successfully with another TestTransport and log" in { @@ -47,7 +47,7 @@ class TestTransportSpec extends AkkaSpec with DefaultTimeout with ImplicitSender case InboundAssociation(handle) if handle.remoteAddress == addressA ⇒ } - registry.logSnapshot.contains(AssociateAttempt(addressA, addressB)) must be(true) + registry.logSnapshot.contains(AssociateAttempt(addressA, addressB)) should be(true) } "fail to associate with nonexisting address" in { @@ -95,7 +95,7 @@ class TestTransportSpec extends AkkaSpec with DefaultTimeout with ImplicitSender case WriteAttempt(sender, recipient, payload) ⇒ sender == addressA && recipient == addressB && payload == akkaPDU case _ ⇒ false - } must be(true) + } should be(true) } "emulate disassociation and log it" in { @@ -132,7 +132,7 @@ class TestTransportSpec extends AkkaSpec with DefaultTimeout with ImplicitSender registry.logSnapshot exists { case DisassociateAttempt(requester, remote) if requester == addressA && remote == addressB ⇒ true case _ ⇒ false - } must be(true) + } should be(true) } } diff --git a/akka-remote/src/test/scala/akka/remote/transport/ThrottleModeSpec.scala b/akka-remote/src/test/scala/akka/remote/transport/ThrottleModeSpec.scala index bda2e0a517..5be02e8a0a 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/ThrottleModeSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/ThrottleModeSpec.scala @@ -12,85 +12,85 @@ class ThrottleModeSpec extends AkkaSpec { "allow consumption of infinite amount of tokens when untrhottled" in { val bucket = Unthrottled - bucket.tryConsumeTokens(0, 100) must be((Unthrottled, true)) - bucket.tryConsumeTokens(100000, 1000) must be((Unthrottled, true)) - bucket.tryConsumeTokens(1000000, 10000) must be((Unthrottled, true)) + bucket.tryConsumeTokens(0, 100) should be((Unthrottled, true)) + bucket.tryConsumeTokens(100000, 1000) should be((Unthrottled, true)) + bucket.tryConsumeTokens(1000000, 10000) should be((Unthrottled, true)) } "in tokenbucket mode allow consuming tokens up to capacity" in { val bucket = TokenBucket(capacity = 100, tokensPerSecond = 100, nanoTimeOfLastSend = 0L, availableTokens = 100) val (bucket1, success1) = bucket.tryConsumeTokens(nanoTimeOfSend = 0L, 10) - bucket1 must be(TokenBucket(100, 100, 0, 90)) - success1 must be(true) + bucket1 should be(TokenBucket(100, 100, 0, 90)) + success1 should be(true) val (bucket2, success2) = bucket1.tryConsumeTokens(nanoTimeOfSend = 0L, 40) - bucket2 must be(TokenBucket(100, 100, 0, 50)) - success2 must be(true) + bucket2 should be(TokenBucket(100, 100, 0, 50)) + success2 should be(true) val (bucket3, success3) = bucket2.tryConsumeTokens(nanoTimeOfSend = 0L, 50) - bucket3 must be(TokenBucket(100, 100, 0, 0)) - success3 must be(true) + bucket3 should be(TokenBucket(100, 100, 0, 0)) + success3 should be(true) val (bucket4, success4) = bucket3.tryConsumeTokens(nanoTimeOfSend = 0, 1) - bucket4 must be(TokenBucket(100, 100, 0, 0)) - success4 must be(false) + bucket4 should be(TokenBucket(100, 100, 0, 0)) + success4 should be(false) } "accurately replenish tokens" in { val bucket = TokenBucket(capacity = 100, tokensPerSecond = 100, nanoTimeOfLastSend = 0L, availableTokens = 0) val (bucket1, success1) = bucket.tryConsumeTokens(nanoTimeOfSend = 0L, 0) - bucket1 must be(TokenBucket(100, 100, 0, 0)) - success1 must be(true) + bucket1 should be(TokenBucket(100, 100, 0, 0)) + success1 should be(true) val (bucket2, success2) = bucket1.tryConsumeTokens(nanoTimeOfSend = halfSecond, 0) - bucket2 must be(TokenBucket(100, 100, halfSecond, 50)) - success2 must be(true) + bucket2 should be(TokenBucket(100, 100, halfSecond, 50)) + success2 should be(true) val (bucket3, success3) = bucket2.tryConsumeTokens(nanoTimeOfSend = 2 * halfSecond, 0) - bucket3 must be(TokenBucket(100, 100, 2 * halfSecond, 100)) - success3 must be(true) + bucket3 should be(TokenBucket(100, 100, 2 * halfSecond, 100)) + success3 should be(true) val (bucket4, success4) = bucket3.tryConsumeTokens(nanoTimeOfSend = 3 * halfSecond, 0) - bucket4 must be(TokenBucket(100, 100, 3 * halfSecond, 100)) - success4 must be(true) + bucket4 should be(TokenBucket(100, 100, 3 * halfSecond, 100)) + success4 should be(true) } "accurately interleave replenish and consume" in { val bucket = TokenBucket(capacity = 100, tokensPerSecond = 100, nanoTimeOfLastSend = 0L, availableTokens = 20) val (bucket1, success1) = bucket.tryConsumeTokens(nanoTimeOfSend = 0L, 10) - bucket1 must be(TokenBucket(100, 100, 0, 10)) - success1 must be(true) + bucket1 should be(TokenBucket(100, 100, 0, 10)) + success1 should be(true) val (bucket2, success2) = bucket1.tryConsumeTokens(nanoTimeOfSend = halfSecond, 60) - bucket2 must be(TokenBucket(100, 100, halfSecond, 0)) - success2 must be(true) + bucket2 should be(TokenBucket(100, 100, halfSecond, 0)) + success2 should be(true) val (bucket3, success3) = bucket2.tryConsumeTokens(nanoTimeOfSend = 2 * halfSecond, 40) - bucket3 must be(TokenBucket(100, 100, 2 * halfSecond, 10)) - success3 must be(true) + bucket3 should be(TokenBucket(100, 100, 2 * halfSecond, 10)) + success3 should be(true) val (bucket4, success4) = bucket3.tryConsumeTokens(nanoTimeOfSend = 3 * halfSecond, 70) - bucket4 must be(TokenBucket(100, 100, 2 * halfSecond, 10)) - success4 must be(false) + bucket4 should be(TokenBucket(100, 100, 2 * halfSecond, 10)) + success4 should be(false) } "allow oversized packets through by loaning" in { val bucket = TokenBucket(capacity = 100, tokensPerSecond = 100, nanoTimeOfLastSend = 0L, availableTokens = 20) val (bucket1, success1) = bucket.tryConsumeTokens(nanoTimeOfSend = 0L, 30) - bucket1 must be(TokenBucket(100, 100, 0, 20)) - success1 must be(false) + bucket1 should be(TokenBucket(100, 100, 0, 20)) + success1 should be(false) val (bucket2, success2) = bucket1.tryConsumeTokens(nanoTimeOfSend = halfSecond, 110) - bucket2 must be(TokenBucket(100, 100, halfSecond, -40)) - success2 must be(true) + bucket2 should be(TokenBucket(100, 100, halfSecond, -40)) + success2 should be(true) val (bucket3, success3) = bucket2.tryConsumeTokens(nanoTimeOfSend = 2 * halfSecond, 20) - bucket3 must be(TokenBucket(100, 100, halfSecond, -40)) - success3 must be(false) + bucket3 should be(TokenBucket(100, 100, halfSecond, -40)) + success3 should be(false) val (bucket4, success4) = bucket3.tryConsumeTokens(nanoTimeOfSend = 3 * halfSecond, 20) - bucket4 must be(TokenBucket(100, 100, 3 * halfSecond, 40)) - success4 must be(true) + bucket4 should be(TokenBucket(100, 100, 3 * halfSecond, 40)) + success4 should be(true) } } diff --git a/akka-remote/src/test/scala/akka/remote/transport/ThrottlerTransportAdapterSpec.scala b/akka-remote/src/test/scala/akka/remote/transport/ThrottlerTransportAdapterSpec.scala index 43322e0eb5..7b88de25a2 100644 --- a/akka-remote/src/test/scala/akka/remote/transport/ThrottlerTransportAdapterSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/transport/ThrottlerTransportAdapterSpec.scala @@ -83,27 +83,27 @@ class ThrottlerTransportAdapterSpec extends AkkaSpec(configA) with ImplicitSende "ThrottlerTransportAdapter" must { "maintain average message rate" taggedAs TimingTest in { - throttle(Direction.Send, TokenBucket(200, 500, 0, 0)) must be(true) + throttle(Direction.Send, TokenBucket(200, 500, 0, 0)) should be(true) val tester = system.actorOf(Props(classOf[ThrottlingTester], here, self)) ! "start" val time = NANOSECONDS.toSeconds(expectMsgType[Long]((TotalTime + 3).seconds)) log.warning("Total time of transmission: " + time) - time must be > (TotalTime - 3) - throttle(Direction.Send, Unthrottled) must be(true) + time should be > (TotalTime - 3) + throttle(Direction.Send, Unthrottled) should be(true) } "survive blackholing" taggedAs TimingTest in { here ! "Blackhole 1" expectMsg("Blackhole 1") - throttle(Direction.Both, Blackhole) must be(true) + throttle(Direction.Both, Blackhole) should be(true) here ! "Blackhole 2" expectNoMsg(1.seconds) - disassociate() must be(true) + disassociate() should be(true) expectNoMsg(1.seconds) - throttle(Direction.Both, Unthrottled) must be(true) + throttle(Direction.Both, Unthrottled) should be(true) // after we remove the Blackhole we can't be certain of the state // of the connection, repeat until success diff --git a/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala b/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala index 547a644db1..d387dfbcc6 100644 --- a/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala +++ b/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala @@ -5,7 +5,7 @@ import scala.concurrent.duration._ import com.typesafe.config.ConfigFactory import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.PoisonPill import akka.actor.Props import akka.actor.RootActorPath @@ -59,7 +59,7 @@ class StatsSampleSingleMasterSpecMultiJvmNode2 extends StatsSampleSingleMasterSp class StatsSampleSingleMasterSpecMultiJvmNode3 extends StatsSampleSingleMasterSpec abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSingleMasterSpecConfig) - with WordSpecLike with MustMatchers with BeforeAndAfterAll with ImplicitSender { + with WordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender { import StatsSampleSingleMasterSpecConfig._ @@ -80,7 +80,7 @@ abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSing Cluster(system) join firstAddress - receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be( + receiveN(3).collect { case MemberUp(m) => m.address }.toSet should be( Set(firstAddress, secondAddress, thirdAddress)) Cluster(system).unsubscribe(testActor) @@ -103,7 +103,7 @@ abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSing // service and worker nodes might not be up yet awaitAssert { facade ! new StatsJob("this is the text that will be analyzed") - expectMsgType[StatsResult](1.second).getMeanWordLength must be(3.875 plusOrMinus 0.001) + expectMsgType[StatsResult](1.second).getMeanWordLength should be(3.875 +- 0.001) } testConductor.enter("done") diff --git a/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala b/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala index a6953b77a5..3209bba838 100644 --- a/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala +++ b/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala @@ -15,7 +15,7 @@ import akka.remote.testkit.MultiNodeConfig import com.typesafe.config.ConfigFactory import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.remote.testkit.MultiNodeSpec import akka.testkit.ImplicitSender @@ -57,7 +57,7 @@ class StatsSampleSpecMultiJvmNode2 extends StatsSampleSpec class StatsSampleSpecMultiJvmNode3 extends StatsSampleSpec abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig) - with WordSpecLike with MustMatchers with BeforeAndAfterAll + with WordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender { import StatsSampleSpecConfig._ @@ -83,7 +83,7 @@ abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig) system.actorOf(Props[StatsWorker], "statsWorker") system.actorOf(Props[StatsService], "statsService") - receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be( + receiveN(3).collect { case MemberUp(m) => m.address }.toSet should be( Set(firstAddress, secondAddress, thirdAddress)) Cluster(system).unsubscribe(testActor) @@ -105,7 +105,7 @@ abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig) // first attempts might fail because worker actors not started yet awaitAssert { service ! new StatsJob("this is the text that will be analyzed") - expectMsgType[StatsResult](1.second).getMeanWordLength must be(3.875 plusOrMinus 0.001) + expectMsgType[StatsResult](1.second).getMeanWordLength should be(3.875 +- 0.001) } } //#test-statsService diff --git a/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala b/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala index 40cbed5c66..fc28771986 100644 --- a/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala +++ b/akka-samples/akka-sample-cluster-java/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala @@ -7,7 +7,7 @@ import com.typesafe.config.ConfigFactory import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Props import akka.cluster.Cluster @@ -49,7 +49,7 @@ class TransformationSampleSpecMultiJvmNode4 extends TransformationSampleSpec class TransformationSampleSpecMultiJvmNode5 extends TransformationSampleSpec abstract class TransformationSampleSpec extends MultiNodeSpec(TransformationSampleSpecConfig) - with WordSpecLike with MustMatchers with BeforeAndAfterAll with ImplicitSender { + with WordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender { import TransformationSampleSpecConfig._ @@ -120,7 +120,7 @@ abstract class TransformationSampleSpec extends MultiNodeSpec(TransformationSamp // backends might not have registered initially awaitAssert { transformationFrontend ! new TransformationJob("hello") - expectMsgType[TransformationResult](1.second).getText must be("HELLO") + expectMsgType[TransformationResult](1.second).getText should be("HELLO") } } diff --git a/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala b/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala index e9db531ae7..e4a3062c32 100644 --- a/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala +++ b/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala @@ -5,7 +5,7 @@ import scala.concurrent.duration._ import com.typesafe.config.ConfigFactory import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.PoisonPill import akka.actor.Props import akka.actor.RootActorPath @@ -58,7 +58,7 @@ class StatsSampleSingleMasterSpecMultiJvmNode2 extends StatsSampleSingleMasterSp class StatsSampleSingleMasterSpecMultiJvmNode3 extends StatsSampleSingleMasterSpec abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSingleMasterSpecConfig) - with WordSpecLike with MustMatchers with BeforeAndAfterAll with ImplicitSender { + with WordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender { import StatsSampleSingleMasterSpecConfig._ @@ -79,7 +79,7 @@ abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSing Cluster(system) join firstAddress - receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be( + receiveN(3).collect { case MemberUp(m) => m.address }.toSet should be( Set(firstAddress, secondAddress, thirdAddress)) Cluster(system).unsubscribe(testActor) @@ -100,8 +100,8 @@ abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSing // service and worker nodes might not be up yet awaitAssert { facade ! StatsJob("this is the text that will be analyzed") - expectMsgType[StatsResult](1.second).meanWordLength must be( - 3.875 plusOrMinus 0.001) + expectMsgType[StatsResult](1.second).meanWordLength should be( + 3.875 +- 0.001) } testConductor.enter("done") diff --git a/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala b/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala index fae44ea1fa..2ec1bdf71b 100644 --- a/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala +++ b/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala @@ -58,12 +58,12 @@ class StatsSampleSpecMultiJvmNode3 extends StatsSampleSpec //#abstract-test import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.remote.testkit.MultiNodeSpec import akka.testkit.ImplicitSender abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig) - with WordSpecLike with MustMatchers with BeforeAndAfterAll + with WordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender { import StatsSampleSpecConfig._ @@ -96,7 +96,7 @@ abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig) system.actorOf(Props[StatsWorker], "statsWorker") system.actorOf(Props[StatsService], "statsService") - receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be( + receiveN(3).collect { case MemberUp(m) => m.address }.toSet should be( Set(firstAddress, secondAddress, thirdAddress)) Cluster(system).unsubscribe(testActor) @@ -120,8 +120,8 @@ abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig) // first attempts might fail because worker actors not started yet awaitAssert { service ! StatsJob("this is the text that will be analyzed") - expectMsgType[StatsResult](1.second).meanWordLength must be( - 3.875 plusOrMinus 0.001) + expectMsgType[StatsResult](1.second).meanWordLength should be( + 3.875 +- 0.001) } } diff --git a/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala b/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala index 908ee67a1d..802bac7756 100644 --- a/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala +++ b/akka-samples/akka-sample-cluster-scala/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala @@ -7,7 +7,7 @@ import com.typesafe.config.ConfigFactory import org.scalatest.BeforeAndAfterAll import org.scalatest.WordSpecLike -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.Props import akka.cluster.Cluster @@ -47,7 +47,7 @@ class TransformationSampleSpecMultiJvmNode4 extends TransformationSampleSpec class TransformationSampleSpecMultiJvmNode5 extends TransformationSampleSpec abstract class TransformationSampleSpec extends MultiNodeSpec(TransformationSampleSpecConfig) - with WordSpecLike with MustMatchers with BeforeAndAfterAll with ImplicitSender { + with WordSpecLike with Matchers with BeforeAndAfterAll with ImplicitSender { import TransformationSampleSpecConfig._ @@ -119,7 +119,7 @@ abstract class TransformationSampleSpec extends MultiNodeSpec(TransformationSamp // backends might not have registered initially awaitAssert { transformationFrontend ! TransformationJob("hello") - expectMsgType[TransformationResult](1.second).text must be("HELLO") + expectMsgType[TransformationResult](1.second).text should be("HELLO") } } diff --git a/akka-samples/akka-sample-multi-node/src/test/scala/sample/multinode/STMultiNodeSpec.scala b/akka-samples/akka-sample-multi-node/src/test/scala/sample/multinode/STMultiNodeSpec.scala index 068d082141..6368a70c15 100644 --- a/akka-samples/akka-sample-multi-node/src/test/scala/sample/multinode/STMultiNodeSpec.scala +++ b/akka-samples/akka-sample-multi-node/src/test/scala/sample/multinode/STMultiNodeSpec.scala @@ -6,7 +6,7 @@ package sample.multinode //#imports import org.scalatest.{ BeforeAndAfterAll, WordSpecLike } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.remote.testkit.MultiNodeSpecCallbacks //#imports @@ -15,7 +15,7 @@ import akka.remote.testkit.MultiNodeSpecCallbacks * Hooks up MultiNodeSpec with ScalaTest */ trait STMultiNodeSpec extends MultiNodeSpecCallbacks - with WordSpecLike with MustMatchers with BeforeAndAfterAll { + with WordSpecLike with Matchers with BeforeAndAfterAll { override def beforeAll() = multiNodeSpecBeforeAll() diff --git a/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala b/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala index e3f1a1b113..f7eedc6869 100644 --- a/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala +++ b/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala @@ -20,7 +20,7 @@ import scala.Some * the OSGi environment and executing it, currently does not support ScalaTest directly. However, ScalaTest * provides a JUnit-compatible runner, so the test is defined to use that runner. Pax-Exam can then invoke * it as a normal JUnit test. Because Pax Exam is using the JUnitRunner and not one of the ScalaTest traits such - * as FunSuite, the test must be defined using the JUnit @Test annotation. + * as FunSuite, the test should be defined using the JUnit @Test annotation. * * This is a simple test demonstrating in-container integration testing. * @@ -30,7 +30,7 @@ import scala.Some * TODO attempt to use the Akka test probe */ @RunWith(classOf[JUnit4TestRunner]) -class HakkerStatusTest extends JUnitSuite with ShouldMatchersForJUnit { +class HakkerStatusTest extends JUnitSuite with MatchersForJUnit { @Inject @Filter(timeout = 30000) var actorSystem: ActorSystem = _ diff --git a/akka-slf4j/src/test/scala/akka/event/slf4j/Slf4jLoggerSpec.scala b/akka-slf4j/src/test/scala/akka/event/slf4j/Slf4jLoggerSpec.scala index bb525b0d8d..bf8fea89d0 100644 --- a/akka-slf4j/src/test/scala/akka/event/slf4j/Slf4jLoggerSpec.scala +++ b/akka-slf4j/src/test/scala/akka/event/slf4j/Slf4jLoggerSpec.scala @@ -74,13 +74,13 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") - s must include("level=[ERROR]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") - s must include regex (sourceThreadRegex) - s must include("msg=[Simulated error]") - s must include("java.lang.RuntimeException: Simulated error") - s must include("at akka.event.slf4j.Slf4jLoggerSpec") + s should include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") + s should include("level=[ERROR]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") + s should include regex (sourceThreadRegex) + s should include("msg=[Simulated error]") + s should include("java.lang.RuntimeException: Simulated error") + s should include("at akka.event.slf4j.Slf4jLoggerSpec") } "log info with parameters" in { @@ -88,11 +88,11 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") - s must include("level=[INFO]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") - s must include regex (sourceThreadRegex) - s must include("msg=[test x=3 y=17]") + s should include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") + s should include("level=[INFO]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") + s should include regex (sourceThreadRegex) + s should include("msg=[test x=3 y=17]") } "put custom MDC values when specified" in { @@ -100,12 +100,12 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") - s must include("level=[INFO]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") - s must include regex (sourceThreadRegex) - s must include("mdc=[ticket-#3671: Custom MDC Values]") - s must include("msg=[Message with custom MDC values]") + s should include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") + s should include("level=[INFO]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") + s should include regex (sourceThreadRegex) + s should include("mdc=[ticket-#3671: Custom MDC Values]") + s should include("msg=[Message with custom MDC values]") } "Support null values in custom MDC" in { @@ -113,12 +113,12 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") - s must include("level=[INFO]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") - s must include regex (sourceThreadRegex) - s must include("mdc=[ticket-#3671: null]") - s must include("msg=[Message with null custom MDC values]") + s should include("akkaSource=[akka://Slf4jLoggerSpec/user/logProducer]") + s should include("level=[INFO]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec$LogProducer]") + s should include regex (sourceThreadRegex) + s should include("mdc=[ticket-#3671: null]") + s should include("msg=[Message with null custom MDC values]") } "include system info in akkaSource when creating Logging with system" in { @@ -126,8 +126,8 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft log.info("test") awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource(akka://Slf4jLoggerSpec)]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource(akka://Slf4jLoggerSpec)]") + s should include("akkaSource=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource(akka://Slf4jLoggerSpec)]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource(akka://Slf4jLoggerSpec)]") } "not include system info in akkaSource when creating Logging with system.eventStream" in { @@ -135,8 +135,8 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft log.info("test") awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource]") + s should include("akkaSource=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec.MyLogSource]") } "use short class name and include system info in akkaSource when creating Logging with system and class" in { @@ -144,8 +144,8 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft log.info("test") awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[Slf4jLoggerSpec$MyLogSource(akka://Slf4jLoggerSpec)]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec$MyLogSource]") + s should include("akkaSource=[Slf4jLoggerSpec$MyLogSource(akka://Slf4jLoggerSpec)]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec$MyLogSource]") } "use short class name in akkaSource when creating Logging with system.eventStream and class" in { @@ -153,8 +153,8 @@ class Slf4jLoggerSpec extends AkkaSpec(Slf4jLoggerSpec.config) with BeforeAndAft log.info("test") awaitCond(outputString.contains("----"), 5 seconds) val s = outputString - s must include("akkaSource=[Slf4jLoggerSpec$MyLogSource]") - s must include("logger=[akka.event.slf4j.Slf4jLoggerSpec$MyLogSource]") + s should include("akkaSource=[Slf4jLoggerSpec$MyLogSource]") + s should include("logger=[akka.event.slf4j.Slf4jLoggerSpec$MyLogSource]") } } diff --git a/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala b/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala index bc57570427..a1b8dbef2b 100644 --- a/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala @@ -6,7 +6,7 @@ package akka.testkit import language.{ postfixOps, reflectiveCalls } import org.scalatest.{ WordSpecLike, BeforeAndAfterAll } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor.ActorSystem import akka.event.{ Logging, LoggingAdapter } import scala.concurrent.duration._ @@ -52,7 +52,7 @@ object AkkaSpec { } abstract class AkkaSpec(_system: ActorSystem) - extends TestKit(_system) with WordSpecLike with MustMatchers with BeforeAndAfterAll with WatchedByCoroner { + extends TestKit(_system) with WordSpecLike with Matchers with BeforeAndAfterAll with WatchedByCoroner { def this(config: Config) = this(ActorSystem(AkkaSpec.getCallerName(getClass), ConfigFactory.load(config.withFallback(AkkaSpec.testConf)))) diff --git a/akka-testkit/src/test/scala/akka/testkit/AkkaSpecSpec.scala b/akka-testkit/src/test/scala/akka/testkit/AkkaSpecSpec.scala index df7d280676..3489688e60 100644 --- a/akka-testkit/src/test/scala/akka/testkit/AkkaSpecSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/AkkaSpecSpec.scala @@ -7,7 +7,7 @@ import language.reflectiveCalls import language.postfixOps import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.actor._ import com.typesafe.config.ConfigFactory import scala.concurrent.Await @@ -16,7 +16,7 @@ import akka.actor.DeadLetter import akka.pattern.ask @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class AkkaSpecSpec extends WordSpec with MustMatchers { +class AkkaSpecSpec extends WordSpec with Matchers { "An AkkaSpec" must { @@ -42,7 +42,7 @@ class AkkaSpecSpec extends WordSpec with MustMatchers { val spec = new AkkaSpec(system) { val ref = Seq(testActor, system.actorOf(Props.empty, "name")) } - spec.ref foreach (_.isTerminated must not be true) + spec.ref foreach (_.isTerminated should not be true) TestKit.shutdownActorSystem(system) spec.awaitCond(spec.ref forall (_.isTerminated), 2 seconds) } @@ -88,10 +88,10 @@ class AkkaSpecSpec extends WordSpec with MustMatchers { system.registerOnTermination(latch.countDown()) TestKit.shutdownActorSystem(system) Await.ready(latch, 2 seconds) - Await.result(davyJones ? "Die!", timeout.duration) must be === "finally gone" + Await.result(davyJones ? "Die!", timeout.duration) should equal("finally gone") // this will typically also contain log messages which were sent after the logger shutdown - locker must contain(DeadLetter(42, davyJones, probe.ref)) + locker should contain(DeadLetter(42, davyJones, probe.ref)) } finally { TestKit.shutdownActorSystem(system) TestKit.shutdownActorSystem(otherSystem) diff --git a/akka-testkit/src/test/scala/akka/testkit/CoronerSpec.scala b/akka-testkit/src/test/scala/akka/testkit/CoronerSpec.scala index 09e99be16b..d78193f2c3 100644 --- a/akka-testkit/src/test/scala/akka/testkit/CoronerSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/CoronerSpec.scala @@ -8,12 +8,12 @@ import java.lang.management.ManagementFactory import java.util.concurrent.Semaphore import java.util.concurrent.locks.ReentrantLock import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import scala.concurrent.duration._ import scala.concurrent.Await @org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) -class CoronerSpec extends WordSpec with MustMatchers { +class CoronerSpec extends WordSpec with Matchers { private def captureOutput[A](f: PrintStream ⇒ A): (A, String) = { val bytes = new ByteArrayOutputStream() @@ -30,8 +30,8 @@ class CoronerSpec extends WordSpec with MustMatchers { Await.ready(coroner, 5.seconds) coroner.cancel() }) - report must include("Coroner's Report") - report must include("XXXX") + report should include("Coroner's Report") + report should include("XXXX") } "not generate a report if cancelled early" in { @@ -40,7 +40,7 @@ class CoronerSpec extends WordSpec with MustMatchers { coroner.cancel() Await.ready(coroner, 1.seconds) }) - report must be("") + report should be("") } "display thread counts if enabled" in { @@ -49,10 +49,10 @@ class CoronerSpec extends WordSpec with MustMatchers { coroner.cancel() Await.ready(coroner, 1.second) }) - report must include("Coroner Thread Count starts at ") - report must include("Coroner Thread Count started at ") - report must include("XXXX") - report must not include ("Coroner's Report") + report should include("Coroner Thread Count starts at ") + report should include("Coroner Thread Count started at ") + report should include("XXXX") + report should not include ("Coroner's Report") } "display deadlock information in its report" in { @@ -111,7 +111,7 @@ class CoronerSpec extends WordSpec with MustMatchers { a.thread.interrupt() b.thread.interrupt() - report must include("Coroner's Report") + report should include("Coroner's Report") // Split test based on JVM capabilities. Not all JVMs can detect // deadlock between ReentrantLocks. However, we need to use @@ -121,17 +121,17 @@ class CoronerSpec extends WordSpec with MustMatchers { val threadMx = ManagementFactory.getThreadMXBean() if (threadMx.isSynchronizerUsageSupported()) { val sectionHeading = "Deadlocks found for monitors and ownable synchronizers" - report must include(sectionHeading) + report should include(sectionHeading) val deadlockSection = report.split(sectionHeading)(1) - deadlockSection must include("deadlock-thread-a") - deadlockSection must include("deadlock-thread-b") + deadlockSection should include("deadlock-thread-a") + deadlockSection should include("deadlock-thread-b") } else { val sectionHeading = "Deadlocks found for monitors, but NOT ownable synchronizers" - report must include(sectionHeading) + report should include(sectionHeading) val deadlockSection = report.split(sectionHeading)(1) - deadlockSection must include("None") - deadlockSection must not include ("deadlock-thread-a") - deadlockSection must not include ("deadlock-thread-b") + deadlockSection should include("None") + deadlockSection should not include ("deadlock-thread-a") + deadlockSection should not include ("deadlock-thread-b") } } diff --git a/akka-testkit/src/test/scala/akka/testkit/JavaTestKitSpec.scala b/akka-testkit/src/test/scala/akka/testkit/JavaTestKitSpec.scala index 4e7bbd17b2..e187b7d59e 100644 --- a/akka-testkit/src/test/scala/akka/testkit/JavaTestKitSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/JavaTestKitSpec.scala @@ -3,7 +3,7 @@ package akka.testkit import language.postfixOps import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.{ BeforeAndAfterEach, WordSpec } import akka.actor._ import scala.concurrent.{ Future, Await } @@ -20,7 +20,7 @@ class JavaTestKitSpec extends AkkaSpec with DefaultTimeout { val sent = List(1, 2, 3, 4, 5) for (m ← sent) { getRef() ! m } val received = receiveN(sent.size, 5 seconds) - sent.toSet must be(received.toSet) + sent.toSet should be(received.toSet) } } @@ -29,7 +29,7 @@ class JavaTestKitSpec extends AkkaSpec with DefaultTimeout { val sent = List(1, 2, 3) for (m ← sent) { getRef() ! m } val received = receiveN(sent.size) - sent.toSet must be(received.toSet) + sent.toSet should be(received.toSet) } } @@ -39,10 +39,10 @@ class JavaTestKitSpec extends AkkaSpec with DefaultTimeout { watch(actor) system stop actor - expectTerminated(actor).existenceConfirmed must be === true + expectTerminated(actor).existenceConfirmed should equal(true) watch(actor) - expectTerminated(5 seconds, actor).actor must be === actor + expectTerminated(5 seconds, actor).actor should equal(actor) } } diff --git a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala index b1296711c2..b2183afc6c 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala @@ -4,7 +4,7 @@ package akka.testkit import language.{ postfixOps, reflectiveCalls } -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.{ BeforeAndAfterEach, WordSpec } import akka.actor._ import akka.event.Logging.Warning @@ -111,9 +111,9 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA override def beforeEach(): Unit = otherthread = null - private def assertThread(): Unit = otherthread must (be(null) or equal(thread)) + private def assertThread(): Unit = otherthread should (be(null) or equal(thread)) - "A TestActorRef must be an ActorRef, hence it" must { + "A TestActorRef should be an ActorRef, hence it" must { "support nested Actor creation" when { @@ -122,10 +122,10 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA val nested = TestActorRef(Props(new Actor { def receive = { case _ ⇒ } })) def receive = { case _ ⇒ sender ! nested } })) - a must not be (null) + a should not be (null) val nested = Await.result((a ? "any").mapTo[ActorRef], timeout.duration) - nested must not be (null) - a must not be theSameInstanceAs(nested) + nested should not be (null) + a should not be theSameInstanceAs(nested) } "used with ActorRef" in { @@ -133,10 +133,10 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA val nested = context.actorOf(Props(new Actor { def receive = { case _ ⇒ } })) def receive = { case _ ⇒ sender ! nested } })) - a must not be (null) + a should not be (null) val nested = Await.result((a ? "any").mapTo[ActorRef], timeout.duration) - nested must not be (null) - a must not be theSameInstanceAs(nested) + nested should not be (null) + a should not be theSameInstanceAs(nested) } } @@ -152,7 +152,7 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA clientRef ! "simple" clientRef ! "simple" - counter must be(0) + counter should be(0) counter = 4 @@ -161,7 +161,7 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA clientRef ! "simple" clientRef ! "simple" - counter must be(0) + counter should be(0) assertThread() } @@ -180,7 +180,7 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA expectMsgPF(5 seconds) { case WrappedTerminated(Terminated(`a`)) ⇒ true } - a.isTerminated must be(true) + a.isTerminated should be(true) assertThread() } } @@ -204,7 +204,7 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA boss ! "sendKill" - counter must be(0) + counter should be(0) assertThread() } } @@ -213,8 +213,8 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA val a = TestActorRef[WorkerActor] val f = a ? "work" // CallingThreadDispatcher means that there is no delay - f must be('completed) - Await.result(f, timeout.duration) must equal("workDone") + f should be('completed) + Await.result(f, timeout.duration) should equal("workDone") } "support receive timeout" in { @@ -235,34 +235,34 @@ class TestActorRefSpec extends AkkaSpec("disp1.type=Dispatcher") with BeforeAndA }) ref ! "hallo" val actor = ref.underlyingActor - actor.s must equal("hallo") + actor.s should equal("hallo") } "set receiveTimeout to None" in { val a = TestActorRef[WorkerActor] - a.underlyingActor.context.receiveTimeout must be theSameInstanceAs Duration.Undefined + a.underlyingActor.context.receiveTimeout should be theSameInstanceAs Duration.Undefined } "set CallingThreadDispatcher" in { val a = TestActorRef[WorkerActor] - a.underlying.dispatcher.getClass must be(classOf[CallingThreadDispatcher]) + a.underlying.dispatcher.getClass should be(classOf[CallingThreadDispatcher]) } "allow override of dispatcher" in { val a = TestActorRef(Props[WorkerActor].withDispatcher("disp1")) - a.underlying.dispatcher.getClass must be(classOf[Dispatcher]) + a.underlying.dispatcher.getClass should be(classOf[Dispatcher]) } "proxy receive for the underlying actor without sender" in { val ref = TestActorRef[WorkerActor] ref.receive("work") - ref.isTerminated must be(true) + ref.isTerminated should be(true) } "proxy receive for the underlying actor with sender" in { val ref = TestActorRef[WorkerActor] ref.receive("work", testActor) - ref.isTerminated must be(true) + ref.isTerminated should be(true) expectMsg("workDone") } diff --git a/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala index 423e500656..68ce757e82 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala @@ -6,7 +6,7 @@ package akka.testkit import language.postfixOps -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.{ BeforeAndAfterEach, WordSpec } import akka.actor._ import scala.concurrent.duration._ @@ -27,17 +27,17 @@ class TestFSMRefSpec extends AkkaSpec { case Event("back", _) ⇒ goto(1) using "back" } }, "test-fsm-ref-1") - fsm.stateName must be(1) - fsm.stateData must be("") + fsm.stateName should be(1) + fsm.stateData should be("") fsm ! "go" - fsm.stateName must be(2) - fsm.stateData must be("go") + fsm.stateName should be(2) + fsm.stateData should be("go") fsm.setState(stateName = 1) - fsm.stateName must be(1) - fsm.stateData must be("go") + fsm.stateName should be(1) + fsm.stateData should be("go") fsm.setState(stateData = "buh") - fsm.stateName must be(1) - fsm.stateData must be("buh") + fsm.stateName should be(1) + fsm.stateData should be("buh") fsm.setState(timeout = 100 millis) within(80 millis, 500 millis) { awaitCond(fsm.stateName == 2 && fsm.stateData == "timeout") @@ -51,11 +51,11 @@ class TestFSMRefSpec extends AkkaSpec { case x ⇒ stay } }, "test-fsm-ref-2") - fsm.isTimerActive("test") must be(false) + fsm.isTimerActive("test") should be(false) fsm.setTimer("test", 12, 10 millis, true) - fsm.isTimerActive("test") must be(true) + fsm.isTimerActive("test") should be(true) fsm.cancelTimer("test") - fsm.isTimerActive("test") must be(false) + fsm.isTimerActive("test") should be(false) } } } diff --git a/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala index 3b5d96f1be..b1c32894df 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala @@ -3,7 +3,7 @@ package akka.testkit import language.postfixOps import org.scalatest.WordSpec -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.{ BeforeAndAfterEach, WordSpec } import akka.actor._ import scala.concurrent.{ Future, Await } @@ -20,8 +20,8 @@ class TestProbeSpec extends AkkaSpec with DefaultTimeout { val future = tk.ref ? "hello" tk.expectMsg(0 millis, "hello") // TestActor runs on CallingThreadDispatcher tk.lastMessage.sender ! "world" - future must be('completed) - Await.result(future, timeout.duration) must equal("world") + future should be('completed) + Await.result(future, timeout.duration) should equal("world") } "reply to messages" in { @@ -69,13 +69,13 @@ class TestProbeSpec extends AkkaSpec with DefaultTimeout { "be able to expect primitive types" in { for (_ ← 1 to 7) testActor ! 42 - expectMsgType[Int] must be(42) - expectMsgAnyClassOf(classOf[Int]) must be(42) - expectMsgAllClassOf(classOf[Int]) must be(Seq(42)) - expectMsgAllConformingOf(classOf[Int]) must be(Seq(42)) - expectMsgAllConformingOf(5 seconds, classOf[Int]) must be(Seq(42)) - expectMsgAllClassOf(classOf[Int]) must be(Seq(42)) - expectMsgAllClassOf(5 seconds, classOf[Int]) must be(Seq(42)) + expectMsgType[Int] should be(42) + expectMsgAnyClassOf(classOf[Int]) should be(42) + expectMsgAllClassOf(classOf[Int]) should be(Seq(42)) + expectMsgAllConformingOf(classOf[Int]) should be(Seq(42)) + expectMsgAllConformingOf(5 seconds, classOf[Int]) should be(Seq(42)) + expectMsgAllClassOf(classOf[Int]) should be(Seq(42)) + expectMsgAllClassOf(5 seconds, classOf[Int]) should be(Seq(42)) } "be able to ignore primitive types" in { diff --git a/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala index e7642c1c29..7bc893ba96 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala @@ -1,6 +1,6 @@ package akka.testkit -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import org.scalatest.{ BeforeAndAfterEach, WordSpec } import scala.concurrent.duration._ import com.typesafe.config.Config @@ -12,22 +12,22 @@ class TestTimeSpec extends AkkaSpec(Map("akka.test.timefactor" -> 2.0)) with Bef "A TestKit" must { "correctly dilate times" taggedAs TimingTest in { - 1.second.dilated.toNanos must be(1000000000L * testKitSettings.TestTimeFactor) + 1.second.dilated.toNanos should be(1000000000L * testKitSettings.TestTimeFactor) val probe = TestProbe() val now = System.nanoTime intercept[AssertionError] { probe.awaitCond(false, Duration("1 second")) } val diff = System.nanoTime - now val target = (1000000000l * testKitSettings.TestTimeFactor).toLong - diff must be > (target - 500000000l) - diff must be < (target + 500000000l) + diff should be > (target - 500000000l) + diff should be < (target + 500000000l) } "awaitAssert must throw correctly" in { - awaitAssert("foo" must be("foo")) + awaitAssert("foo" should be("foo")) within(300.millis, 2.seconds) { intercept[TestFailedException] { - awaitAssert("foo" must be("bar"), 500.millis, 300.millis) + awaitAssert("foo" should be("bar"), 500.millis, 300.millis) } } } diff --git a/akka-transactor/src/test/scala/akka/transactor/CoordinatedIncrementSpec.scala b/akka-transactor/src/test/scala/akka/transactor/CoordinatedIncrementSpec.scala index 2000fba35a..b28e8375fe 100644 --- a/akka-transactor/src/test/scala/akka/transactor/CoordinatedIncrementSpec.scala +++ b/akka-transactor/src/test/scala/akka/transactor/CoordinatedIncrementSpec.scala @@ -86,7 +86,7 @@ class CoordinatedIncrementSpec extends AkkaSpec(CoordinatedIncrement.config) wit counters(0) ! coordinated(Increment(counters.tail)) coordinated.await for (counter ← counters) { - Await.result((counter ? GetCount).mapTo[Int], remaining) must be === 1 + Await.result((counter ? GetCount).mapTo[Int], remaining) should equal(1) } counters foreach (system.stop(_)) system.stop(failer) @@ -103,7 +103,7 @@ class CoordinatedIncrementSpec extends AkkaSpec(CoordinatedIncrement.config) wit counters(0) ! Coordinated(Increment(counters.tail :+ failer)) coordinated.await for (counter ← counters) { - Await.result(counter ? GetCount, remaining) must be === 0 + Await.result(counter ? GetCount, remaining) should equal(0) } counters foreach (system.stop(_)) system.stop(failer) diff --git a/akka-transactor/src/test/scala/akka/transactor/FickleFriendsSpec.scala b/akka-transactor/src/test/scala/akka/transactor/FickleFriendsSpec.scala index 32f1dca788..0f07ee7e53 100644 --- a/akka-transactor/src/test/scala/akka/transactor/FickleFriendsSpec.scala +++ b/akka-transactor/src/test/scala/akka/transactor/FickleFriendsSpec.scala @@ -130,9 +130,9 @@ class FickleFriendsSpec extends AkkaSpec with BeforeAndAfterAll { val latch = new CountDownLatch(1) coordinator ! FriendlyIncrement(counters, timeout, latch) latch.await // this could take a while - Await.result(coordinator ? GetCount, timeout.duration) must be === 1 + Await.result(coordinator ? GetCount, timeout.duration) should equal(1) for (counter ← counters) { - Await.result(counter ? GetCount, timeout.duration) must be === 1 + Await.result(counter ? GetCount, timeout.duration) should equal(1) } counters foreach (system.stop(_)) system.stop(coordinator) diff --git a/akka-transactor/src/test/scala/akka/transactor/TransactorSpec.scala b/akka-transactor/src/test/scala/akka/transactor/TransactorSpec.scala index a5dae078d3..e749a08000 100644 --- a/akka-transactor/src/test/scala/akka/transactor/TransactorSpec.scala +++ b/akka-transactor/src/test/scala/akka/transactor/TransactorSpec.scala @@ -98,7 +98,7 @@ class TransactorSpec extends AkkaSpec { counters(0) ! Increment(counters.tail, incrementLatch) Await.ready(incrementLatch, 5 seconds) for (counter ← counters) { - Await.result(counter ? GetCount, timeout.duration) must be === 1 + Await.result(counter ? GetCount, timeout.duration) should equal(1) } counters foreach (system.stop(_)) system.stop(failer) @@ -115,7 +115,7 @@ class TransactorSpec extends AkkaSpec { counters(0) ! Increment(counters.tail :+ failer, failLatch) Await.ready(failLatch, 5 seconds) for (counter ← counters) { - Await.result(counter ? GetCount, timeout.duration) must be === 0 + Await.result(counter ? GetCount, timeout.duration) should equal(0) } counters foreach (system.stop(_)) system.stop(failer) @@ -131,7 +131,7 @@ class TransactorSpec extends AkkaSpec { transactor ! Set(ref, 5, latch) Await.ready(latch, 5 seconds) val value = ref.single.get - value must be === 5 + value should equal(5) system.stop(transactor) } } diff --git a/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala b/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala index 2dcc9a623a..486039a30d 100644 --- a/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala +++ b/akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala @@ -5,7 +5,7 @@ package akka.zeromq import language.postfixOps -import org.scalatest.matchers.MustMatchers +import org.scalatest.Matchers import akka.testkit.{ TestProbe, DefaultTimeout, AkkaSpec } import scala.concurrent.duration._ import akka.actor.{ Cancellable, Actor, Props, ActorRef } @@ -66,18 +66,18 @@ class ConcurrentSocketActorSpec extends AkkaSpec { subscriberProbe.expectMsg(Connecting) val msgNumbers = subscriberProbe.receiveWhile(3 seconds) { case msg: ZMQMessage if msg.frames.size == 2 ⇒ - msg.frames(1).length must be(0) + msg.frames(1).length should be(0) msg }.map(m ⇒ m.frames(0).utf8String.toInt) - msgNumbers.length must be > 0 - msgNumbers must equal(for (i ← msgNumbers.head to msgNumbers.last) yield i) + msgNumbers.length should be > 0 + msgNumbers should equal(for (i ← msgNumbers.head to msgNumbers.last) yield i) } finally { msgGenerator.cancel() watch(subscriber) system stop subscriber subscriberProbe.receiveWhile(3 seconds) { case msg ⇒ msg - }.last must equal(Closed) + }.last should equal(Closed) expectTerminated(subscriber, 5.seconds) watch(publisher) system stop publisher