add BehaviorTestKit.runOne and .ref (#25013)
This commit is contained in:
parent
8cdb3feb99
commit
0dab3eba92
3 changed files with 22 additions and 0 deletions
|
|
@ -123,6 +123,8 @@ private[akka] final class BehaviorTestKitImpl[T](_path: ActorPath, _initialBehav
|
||||||
} catch handleException
|
} catch handleException
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def runOne(): Unit = run(selfInbox.receiveMessage())
|
||||||
|
|
||||||
override def signal(signal: Signal): Unit = {
|
override def signal(signal: Signal): Unit = {
|
||||||
try {
|
try {
|
||||||
currentUncanonical = Behavior.interpretSignal(current, ctx, signal)
|
currentUncanonical = Behavior.interpretSignal(current, ctx, signal)
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,11 @@ abstract class BehaviorTestKit[T] {
|
||||||
*/
|
*/
|
||||||
def selfInbox(): TestInbox[T]
|
def selfInbox(): TestInbox[T]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The self reference of the actor living inside this testkit.
|
||||||
|
*/
|
||||||
|
def getRef(): ActorRef[T] = selfInbox.getRef()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests all the effects. The effects are consumed, subsequent calls will only
|
* Requests all the effects. The effects are consumed, subsequent calls will only
|
||||||
* see new effects.
|
* see new effects.
|
||||||
|
|
@ -107,6 +112,11 @@ abstract class BehaviorTestKit[T] {
|
||||||
*/
|
*/
|
||||||
def run(msg: T): Unit
|
def run(msg: T): Unit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send the first message in the selfInbox to the behavior and run it, recording [[Effect]]s.
|
||||||
|
*/
|
||||||
|
def runOne(): Unit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the signal to the beheavior and record any [[Effect]]s
|
* Send the signal to the beheavior and record any [[Effect]]s
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,11 @@ trait BehaviorTestKit[T] {
|
||||||
*/
|
*/
|
||||||
def selfInbox(): TestInbox[T]
|
def selfInbox(): TestInbox[T]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The self reference of the actor living inside this testkit.
|
||||||
|
*/
|
||||||
|
def ref: ActorRef[T] = selfInbox.ref
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests all the effects. The effects are consumed, subsequent calls will only
|
* Requests all the effects. The effects are consumed, subsequent calls will only
|
||||||
* see new effects.
|
* see new effects.
|
||||||
|
|
@ -113,6 +118,11 @@ trait BehaviorTestKit[T] {
|
||||||
*/
|
*/
|
||||||
def run(msg: T): Unit
|
def run(msg: T): Unit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send the first message in the selfInbox to the behavior and run it, recording [[Effect]]s.
|
||||||
|
*/
|
||||||
|
def runOne(): Unit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the signal to the beheavior and record any [[Effect]]s
|
* Send the signal to the beheavior and record any [[Effect]]s
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue