view src/test/scala/IncrementSampleSpec.scala @ 4:a0d72969e6b4

init test
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 29 Jan 2018 18:01:05 +0900
parents
children 230a3627b7d7
line wrap: on
line source

package IncrementSampleSpec

import IncrementSample.Incrementer
import IncrementSample.Incrementer._
import IncrementSample.Incrementer.SetActor

import akka.actor.ActorSystem
import akka.testkit.{TestKit, TestProbe}
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}


class IncrementSampleSpec(_system: ActorSystem)
  extends TestKit(_system) with WordSpecLike with Matchers with BeforeAndAfterAll {

  def this() = this(ActorSystem("IncrementSampleSpec"))

  override def afterAll(): Unit = {
    shutdown(system)
  }

  " Increment 1 to 10" in {
    val testProbe = TestProbe()

    val actorOne = system.actorOf(Incrementer.props(testProbe.ref),"ActorOne")
    val actorTwo = system.actorOf(Incrementer.props(testProbe.ref),"ActorTwo")

    actorOne ! SetActor(actorTwo)
    actorTwo ! SetActor(actorOne)


  }
}