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 a79a3c9ab8..65ca5cfb6f 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/MailboxConfigSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/MailboxConfigSpec.scala @@ -19,6 +19,10 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn def factory: MailboxType ⇒ MessageQueue + def supportsBeingBounded = true + + def maxConsumers = 4 + name should { "create an unbounded mailbox" in { val config = UnboundedMailbox() @@ -122,7 +126,7 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn r } - val consumers = for (i ← (1 to 4).toList) yield createConsumer + val consumers = List.fill(maxConsumers)(createConsumer) val ps = producers.map(Await.result(_, within)) val cs = consumers.map(Await.result(_, within)) @@ -187,3 +191,12 @@ class CustomMailboxSpec extends AkkaSpec(CustomMailboxSpec.config) { } } } + +class SingleConsumerOnlyMailboxSpec extends MailboxSpec { + lazy val name = "The single-consumer-only mailbox implementation" + override def maxConsumers = 1 + def factory = { + case u: UnboundedMailbox ⇒ SingleConsumerOnlyUnboundedMailbox().create(None, None) + case b: BoundedMailbox ⇒ pending; null + } +}