Remove redundant should/must in tests, see #3272
This commit is contained in:
parent
23e76c35d5
commit
53728312e9
10 changed files with 21 additions and 20 deletions
|
|
@ -79,7 +79,7 @@ class ActorFireForgetRequestReplySpec extends AkkaSpec with BeforeAndAfterEach w
|
|||
state.s must be("ReplyImplicit")
|
||||
}
|
||||
|
||||
"should shutdown crashed temporary actor" in {
|
||||
"shutdown crashed temporary actor" in {
|
||||
filterEvents(EventFilter[Exception]("Expected exception")) {
|
||||
val supervisor = system.actorOf(Props(new Supervisor(
|
||||
OneForOneStrategy(maxNrOfRetries = 0)(List(classOf[Exception])))))
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
|
|||
" Use 'akka.serialization.Serialization.currentSystem.withValue(system) { ... }'"
|
||||
}
|
||||
|
||||
"must return EmptyLocalActorRef on deserialize if not present in actor hierarchy (and remoting is not enabled)" in {
|
||||
"return EmptyLocalActorRef on deserialize if not present in actor hierarchy (and remoting is not enabled)" in {
|
||||
import java.io._
|
||||
|
||||
val baos = new ByteArrayOutputStream(8192 * 32)
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ class SupervisorSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitSende
|
|||
ping(actor3)
|
||||
}
|
||||
|
||||
"must attempt restart when exception during restart" in {
|
||||
"attempt restart when exception during restart" in {
|
||||
val inits = new AtomicInteger(0)
|
||||
val supervisor = system.actorOf(Props(new Supervisor(
|
||||
OneForOneStrategy(maxNrOfRetries = 3, withinTimeRange = 10 seconds)(classOf[Exception] :: Nil))))
|
||||
|
|
@ -376,7 +376,7 @@ class SupervisorSpec extends AkkaSpec with BeforeAndAfterEach with ImplicitSende
|
|||
system.stop(supervisor)
|
||||
}
|
||||
|
||||
"must not lose system messages when a NonFatal exception occurs when processing a system message" in {
|
||||
"not lose system messages when a NonFatal exception occurs when processing a system message" in {
|
||||
val parent = system.actorOf(Props(new Actor {
|
||||
override val supervisorStrategy = OneForOneStrategy()({
|
||||
case e: IllegalStateException if e.getMessage == "OHNOES" ⇒ throw e
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ abstract class ActorModelSpec(config: String) extends AkkaSpec(config) with Defa
|
|||
|
||||
"A " + dispatcherType must {
|
||||
|
||||
"must dynamically handle its own life cycle" in {
|
||||
"dynamically handle its own life cycle" in {
|
||||
implicit val dispatcher = interceptedDispatcher()
|
||||
assertDispatcher(dispatcher)(stops = 0)
|
||||
val a = newTestActor(dispatcher.id)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
|
|||
sec.isEmpty must be === true
|
||||
}
|
||||
|
||||
"should relinquish thread when suspended" in {
|
||||
"relinquish thread when suspended" in {
|
||||
val submissions = new AtomicInteger(0)
|
||||
val counter = new AtomicInteger(0)
|
||||
val underlying = new ExecutionContext {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ object FutureSpec {
|
|||
|
||||
class TestDelayActor(await: TestLatch) extends Actor {
|
||||
def receive = {
|
||||
case "Hello" ⇒ FutureSpec.ready(await, TestLatch.DefaultTimeout); sender ! "World"
|
||||
case "Hello" ⇒
|
||||
FutureSpec.ready(await, TestLatch.DefaultTimeout); sender ! "World"
|
||||
case "NoReply" ⇒ FutureSpec.ready(await, TestLatch.DefaultTimeout)
|
||||
case "Failure" ⇒
|
||||
FutureSpec.ready(await, TestLatch.DefaultTimeout)
|
||||
|
|
@ -439,12 +440,12 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
|
|||
Await.result(Future.fold(List[Future[Int]]())(0)(_ + _), timeout.duration) must be(0)
|
||||
}
|
||||
|
||||
"shouldReduceResults" in {
|
||||
"reduce results" in {
|
||||
val futures = (1 to 10).toList map { i ⇒ Future(i) }
|
||||
assert(Await.result(Future.reduce(futures)(_ + _), remaining) === 55)
|
||||
}
|
||||
|
||||
"shouldReduceResultsWithException" in {
|
||||
"reduce results with Exception" in {
|
||||
filterException[IllegalArgumentException] {
|
||||
val futures = (1 to 10).toList map {
|
||||
case 6 ⇒ Future(throw new IllegalArgumentException("shouldReduceResultsWithException: expected"))
|
||||
|
|
@ -454,13 +455,13 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
|
|||
}
|
||||
}
|
||||
|
||||
"shouldReduceThrowIAEOnEmptyInput" in {
|
||||
"throw IllegalArgumentException on empty input to reduce" in {
|
||||
filterException[IllegalArgumentException] {
|
||||
intercept[java.util.NoSuchElementException] { Await.result(Future.reduce(List[Future[Int]]())(_ + _), timeout.duration) }
|
||||
}
|
||||
}
|
||||
|
||||
"receiveShouldExecuteOnComplete" in {
|
||||
"execute onSuccess when received ask reply" in {
|
||||
val latch = new TestLatch
|
||||
val actor = system.actorOf(Props[TestActor])
|
||||
actor ? "Hello" onSuccess { case "World" ⇒ latch.open() }
|
||||
|
|
@ -468,7 +469,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
|
|||
system.stop(actor)
|
||||
}
|
||||
|
||||
"shouldTraverseFutures" in {
|
||||
"traverse Futures" in {
|
||||
val oddActor = system.actorOf(Props(new Actor {
|
||||
var counter = 1
|
||||
def receive = {
|
||||
|
|
@ -487,7 +488,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
|
|||
assert(Await.result(Future.traverse(list)(x ⇒ Future(x * 2 - 1)), timeout.duration).sum === 10000)
|
||||
}
|
||||
|
||||
"shouldHandleThrowables" in {
|
||||
"handle Throwables" in {
|
||||
class ThrowableTest(m: String) extends Throwable(m)
|
||||
|
||||
EventFilter[ThrowableTest](occurrences = 4) intercept {
|
||||
|
|
@ -507,7 +508,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
|
|||
}
|
||||
}
|
||||
|
||||
"shouldBlockUntilResult" in {
|
||||
"block until result" in {
|
||||
val latch = new TestLatch
|
||||
|
||||
val f = Future { FutureSpec.ready(latch, 5 seconds); 5 }
|
||||
|
|
@ -572,7 +573,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
|
|||
FutureSpec.ready(f4, timeout.duration) must be('completed)
|
||||
}
|
||||
|
||||
"should not deadlock with nested await (ticket 1313)" in {
|
||||
"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)
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
|
|||
expectMsg("restarted")
|
||||
}
|
||||
|
||||
"must start in-line for context.actorOf()" in {
|
||||
"start in-line for context.actorOf()" in {
|
||||
system.actorOf(Props(new Actor {
|
||||
def receive = {
|
||||
case "start" ⇒
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class TimerBasedThrottlerSpec extends TestKit(ActorSystem("TimerBasedThrottlerSp
|
|||
|
||||
"A throttler" must {
|
||||
def println(a: Any) = ()
|
||||
"must pass the ScalaDoc class documentation example program" in {
|
||||
"pass the ScalaDoc class documentation example program" in {
|
||||
//#demo-code
|
||||
// A simple actor that prints whatever it receives
|
||||
val printer = system.actorOf(Props(new Actor {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class ThrottlerTransportAdapterSpec extends AkkaSpec(configA) with ImplicitSende
|
|||
throttle(Direction.Send, Unthrottled) must be(true)
|
||||
}
|
||||
|
||||
"must survive blackholing" taggedAs TimingTest in {
|
||||
"survive blackholing" taggedAs TimingTest in {
|
||||
here ! "Blackhole 1"
|
||||
expectMsg("Blackhole 1")
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class AkkaSpecSpec extends WordSpec with MustMatchers {
|
|||
spec.awaitCond(spec.ref forall (_.isTerminated), 2 seconds)
|
||||
}
|
||||
|
||||
"must stop correctly when sending PoisonPill to rootGuardian" in {
|
||||
"stop correctly when sending PoisonPill to rootGuardian" in {
|
||||
val system = ActorSystem("AkkaSpec2", AkkaSpec.testConf)
|
||||
val spec = new AkkaSpec(system) {}
|
||||
val latch = new TestLatch(1)(system)
|
||||
|
|
@ -58,7 +58,7 @@ class AkkaSpecSpec extends WordSpec with MustMatchers {
|
|||
Await.ready(latch, 2 seconds)
|
||||
}
|
||||
|
||||
"must enqueue unread messages from testActor to deadLetters" in {
|
||||
"enqueue unread messages from testActor to deadLetters" in {
|
||||
val system, otherSystem = ActorSystem("AkkaSpec3", AkkaSpec.testConf)
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue