26 lines
No EOL
748 B
Scala
26 lines
No EOL
748 B
Scala
/**
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
*/
|
|
package akka.tutorial.first.scala
|
|
|
|
import org.junit.runner.RunWith
|
|
import org.scalatest.matchers.MustMatchers
|
|
import org.scalatest.WordSpec
|
|
import akka.testkit.TestActorRef
|
|
import akka.tutorial.first.scala.Pi.Worker
|
|
import akka.actor.ActorSystem
|
|
|
|
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
|
|
class WorkerSpec extends WordSpec with MustMatchers {
|
|
|
|
implicit def system = ActorSystem()
|
|
|
|
"Worker" must {
|
|
"calculate pi correctly" in {
|
|
val testActor = TestActorRef[Worker]
|
|
val actor = testActor.underlyingActor
|
|
actor.calculatePiFor(0, 0) must equal(0.0)
|
|
actor.calculatePiFor(1, 1) must equal(-1.3333333333333333)
|
|
}
|
|
}
|
|
} |