mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-28 00:09:13 +00:00
Interim 2 (#477)
* changed DefaultCancellable.obj with Default.Cancellable and deleted the former (as unnecessary) * changed ActorRef.noSender with Default.Actor for PlanetSideServerObject entities * Actor.noSender -> ActorRef.noSender, for consistency * player name in log messages; zoneLoaded and zoneReload flags; upstream message count * Default object tests; expanded the set current avatar loop * fallback cases for unsuccessful zone/avatar load process * completing the trials of the god Travis * forgot to reactivate kamon
This commit is contained in:
parent
765816a4d2
commit
d6397d54a1
64 changed files with 523 additions and 302 deletions
49
common/src/test/scala/objects/DefaultTest.scala
Normal file
49
common/src/test/scala/objects/DefaultTest.scala
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2020 PSForever
|
||||
package objects
|
||||
|
||||
import akka.actor.DeadLetter
|
||||
import akka.testkit.TestProbe
|
||||
import base.ActorTest
|
||||
import net.psforever.objects.Default
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
class DefaultTest extends Specification {
|
||||
"Default.Cancellable" should {
|
||||
"always act like it can be cancelled successfully" in {
|
||||
Default.Cancellable.cancel mustEqual true
|
||||
}
|
||||
|
||||
"always act like it was cancelled successfully" in {
|
||||
Default.Cancellable.isCancelled mustEqual true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DefaultActorStartedTest extends ActorTest {
|
||||
"Default.Actor" should {
|
||||
"send messages to deadLetters" in {
|
||||
//after being started
|
||||
Default(system)
|
||||
val probe = new TestProbe(system)
|
||||
system.eventStream.subscribe(probe.ref, classOf[DeadLetter])
|
||||
Default.Actor ! "hello world"
|
||||
val msg1 = probe.receiveOne(250 milliseconds)
|
||||
assert(msg1.isInstanceOf[DeadLetter])
|
||||
assert(msg1.asInstanceOf[DeadLetter].message equals "hello world")
|
||||
|
||||
//if it was stopped
|
||||
system.stop(Default.Actor)
|
||||
Default.Actor ! "hello world"
|
||||
val msg2 = probe.receiveOne(250 milliseconds)
|
||||
assert(msg2.isInstanceOf[DeadLetter])
|
||||
assert(msg2.asInstanceOf[DeadLetter].message equals "hello world")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object DefaultActorTest {
|
||||
//due to being a singleton, the original original value of the Default.Actor is cached here
|
||||
val Original = Default.Actor
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue