mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-13 07:24:53 +00:00
separating test classes, but keeping them in one file
This commit is contained in:
parent
02ee06fd97
commit
5a453b6bb8
1 changed files with 13 additions and 1 deletions
|
|
@ -15,11 +15,13 @@ import org.specs2.specification.Scope
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
import scala.util.Success
|
import scala.util.Success
|
||||||
|
|
||||||
class NumberPoolActorTest extends TestKit(ActorSystem("test")) with Scope with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
|
abstract class ActorTest(sys : ActorSystem) extends TestKit(sys) with Scope with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll {
|
||||||
override def afterAll {
|
override def afterAll {
|
||||||
TestKit.shutdownActorSystem(system)
|
TestKit.shutdownActorSystem(system)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NumberPoolActorTest extends ActorTest(ActorSystem("test")) {
|
||||||
"NumberPoolActor" should {
|
"NumberPoolActor" should {
|
||||||
"GetAnyNumber" in {
|
"GetAnyNumber" in {
|
||||||
val pool = new ExclusivePool((25 to 50).toList)
|
val pool = new ExclusivePool((25 to 50).toList)
|
||||||
|
|
@ -29,7 +31,11 @@ class NumberPoolActorTest extends TestKit(ActorSystem("test")) with Scope with I
|
||||||
val msg = receiveOne(Duration.create(100, "ms"))
|
val msg = receiveOne(Duration.create(100, "ms"))
|
||||||
assert(msg.isInstanceOf[NumberPoolActor.GiveNumber])
|
assert(msg.isInstanceOf[NumberPoolActor.GiveNumber])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NumberPoolActorTest1 extends ActorTest(ActorSystem("test")) {
|
||||||
|
"NumberPoolActor" should {
|
||||||
"GetSpecificNumber" in {
|
"GetSpecificNumber" in {
|
||||||
val pool = new ExclusivePool((25 to 50).toList)
|
val pool = new ExclusivePool((25 to 50).toList)
|
||||||
pool.Selector = new RandomSelector
|
pool.Selector = new RandomSelector
|
||||||
|
|
@ -37,7 +43,11 @@ class NumberPoolActorTest extends TestKit(ActorSystem("test")) with Scope with I
|
||||||
poolActor ! NumberPoolActor.GetSpecificNumber(37)
|
poolActor ! NumberPoolActor.GetSpecificNumber(37)
|
||||||
expectMsg(NumberPoolActor.GiveNumber(37, None))
|
expectMsg(NumberPoolActor.GiveNumber(37, None))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NumberPoolActorTest2 extends ActorTest(ActorSystem("test")) {
|
||||||
|
"NumberPoolActor" should {
|
||||||
"NoNumber" in {
|
"NoNumber" in {
|
||||||
val pool = new ExclusivePool((25 to 25).toList) //pool only has one number - 25
|
val pool = new ExclusivePool((25 to 25).toList) //pool only has one number - 25
|
||||||
pool.Selector = new RandomSelector
|
pool.Selector = new RandomSelector
|
||||||
|
|
@ -50,7 +60,9 @@ class NumberPoolActorTest extends TestKit(ActorSystem("test")) with Scope with I
|
||||||
assert(msg.isInstanceOf[NumberPoolActor.NoNumber])
|
assert(msg.isInstanceOf[NumberPoolActor.NoNumber])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NumberPoolActorTest3 extends ActorTest(ActorSystem("test")) {
|
||||||
"NumberPoolAccessorActor" should {
|
"NumberPoolAccessorActor" should {
|
||||||
class TestEntity extends IdentifiableEntity
|
class TestEntity extends IdentifiableEntity
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue