add TestFSMRefSpec and make TestFSMRef better accessible

- add address argument to TestFSMRef factory
- set address of TestKit.testActor to "testActor#" with monotonically
  increasing number #
This commit is contained in:
Roland 2011-06-05 10:45:27 +02:00
parent b1533cb3d8
commit 3d40a0f529
5 changed files with 132 additions and 49 deletions

View file

@ -8,7 +8,8 @@ import Actor._
import akka.util.Duration
import akka.util.duration._
import java.util.concurrent.{ BlockingDeque, LinkedBlockingDeque, TimeUnit }
import java.util.concurrent.{ BlockingDeque, LinkedBlockingDeque, TimeUnit, atomic }
import atomic.AtomicInteger
import scala.annotation.tailrec
@ -99,7 +100,7 @@ trait TestKitLight {
* ActorRef of the test actor. Access is provided to enable e.g.
* registration as message target.
*/
val testActor = actorOf(new TestActor(queue)).start()
val testActor = actorOf(new TestActor(queue), "testActor" + TestKit.testActorId.incrementAndGet()).start()
/**
* Implicit sender reference so that replies are possible for messages sent
@ -555,6 +556,10 @@ trait TestKitLight {
private def format(u: TimeUnit, d: Duration) = "%.3f %s".format(d.toUnit(u), u.toString.toLowerCase)
}
object TestKit {
private[testkit] val testActorId = new AtomicInteger(0)
}
trait TestKit extends TestKitLight {
implicit val self = testActor
}