Class BehaviorTestKitImpl<T>
- java.lang.Object
-
- akka.actor.testkit.typed.javadsl.BehaviorTestKit<T>
-
- akka.actor.testkit.typed.internal.BehaviorTestKitImpl<T>
-
- All Implemented Interfaces:
BehaviorTestKit<T>
public final class BehaviorTestKitImpl<T> extends BehaviorTestKit<T> implements BehaviorTestKit<T>
INTERNAL API
-
-
Constructor Summary
Constructors Constructor Description BehaviorTestKitImpl(ActorPath _path, Behavior<T> _initialBehavior)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <U> BehaviorTestKitImpl<U>
as()
<U> TestInboxImpl<U>
childInbox(ActorRef<U> ref)
Get the child inbox for the child with the given name, or fail if there is no child with the given name spawned<U> TestInboxImpl<U>
childInbox(java.lang.String name)
Get the child inbox for the child with the given name, or fail if there is no child with the given name spawned<U> BehaviorTestKitImpl<U>
childTestKit(ActorRef<U> child)
void
clearLog()
Clear the log entriesEffectfulActorContext<T>
context()
Behavior<T>
currentBehavior()
The current behavior, can change any timerun
is calledvoid
expectEffect(Effect expectedEffect)
Asserts that the oldest effect is the expectedEffect.<E extends Effect>
EexpectEffectClass(java.lang.Class<E> effectClass)
Asserts that the oldest effect is an instance of of class T.<R> R
expectEffectPF(scala.PartialFunction<Effect,R> f)
Asserts that the oldest effect matches the given partial function.<E extends Effect>
EexpectEffectType(scala.reflect.ClassTag<E> classTag)
Asserts that the oldest effect is of type T.java.util.List<Effect>
getAllEffects()
Requests all the effects.java.util.List<CapturedLogEvent>
getAllLogEntries()
Returns all theCapturedLogEvent
issued by this behavior(s)Effect
getEffect()
boolean
hasEffects()
Returns if there have been any effects.boolean
isAlive()
Is the current behavior alive or stoppedscala.collection.immutable.Seq<CapturedLogEvent>
logEntries()
Returns all theCapturedLogEvent
issued by this behavior(s)scala.collection.immutable.Seq<Effect>
retrieveAllEffects()
Requests all the effects.Effect
retrieveEffect()
Requests the oldestEffect
orEffect.NoEffects
if no effects have taken place.Behavior<T>
returnedBehavior()
Returns the current behavior as it was returned from processing the previous message.void
run(T message)
Send the message to the behavior and record anyEffect
svoid
runOne()
Send the first message in the selfInbox to the behavior and run it, recordingEffect
s.TestInboxImpl<T>
selfInbox()
The self inbox contains messages the behavior sent tocontext.self
void
signal(Signal signal)
Send the signal to the beheavior and record anyEffect
s-
Methods inherited from class akka.actor.testkit.typed.javadsl.BehaviorTestKit
create, create, getRef
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.testkit.typed.scaladsl.BehaviorTestKit
ref
-
-
-
-
Method Detail
-
as
public <U> BehaviorTestKitImpl<U> as()
-
childInbox
public <U> TestInboxImpl<U> childInbox(java.lang.String name)
Description copied from class:BehaviorTestKit
Get the child inbox for the child with the given name, or fail if there is no child with the given name spawned- Specified by:
childInbox
in interfaceBehaviorTestKit<T>
- Specified by:
childInbox
in classBehaviorTestKit<T>
- Parameters:
name
- (undocumented)- Returns:
- (undocumented)
-
childInbox
public <U> TestInboxImpl<U> childInbox(ActorRef<U> ref)
Description copied from class:BehaviorTestKit
Get the child inbox for the child with the given name, or fail if there is no child with the given name spawned- Specified by:
childInbox
in interfaceBehaviorTestKit<T>
- Specified by:
childInbox
in classBehaviorTestKit<T>
- Parameters:
ref
- (undocumented)- Returns:
- (undocumented)
-
childTestKit
public <U> BehaviorTestKitImpl<U> childTestKit(ActorRef<U> child)
Description copied from class:BehaviorTestKit
- Specified by:
childTestKit
in interfaceBehaviorTestKit<T>
- Specified by:
childTestKit
in classBehaviorTestKit<T>
- Parameters:
child
- (undocumented)- Returns:
- (undocumented)
-
clearLog
public void clearLog()
Description copied from class:BehaviorTestKit
Clear the log entries- Specified by:
clearLog
in interfaceBehaviorTestKit<T>
- Specified by:
clearLog
in classBehaviorTestKit<T>
-
context
public EffectfulActorContext<T> context()
- Specified by:
context
in interfaceBehaviorTestKit<T>
-
currentBehavior
public Behavior<T> currentBehavior()
Description copied from class:BehaviorTestKit
The current behavior, can change any timerun
is called- Specified by:
currentBehavior
in interfaceBehaviorTestKit<T>
- Specified by:
currentBehavior
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
expectEffect
public void expectEffect(Effect expectedEffect)
Description copied from class:BehaviorTestKit
Asserts that the oldest effect is the expectedEffect. Removing it from further assertions.- Specified by:
expectEffect
in interfaceBehaviorTestKit<T>
- Specified by:
expectEffect
in classBehaviorTestKit<T>
- Parameters:
expectedEffect
- (undocumented)
-
expectEffectClass
public <E extends Effect> E expectEffectClass(java.lang.Class<E> effectClass)
Description copied from class:BehaviorTestKit
Asserts that the oldest effect is an instance of of class T. Consumes and returns the concrete effect for further direct assertions.- Specified by:
expectEffectClass
in classBehaviorTestKit<T>
- Parameters:
effectClass
- (undocumented)- Returns:
- (undocumented)
-
expectEffectPF
public <R> R expectEffectPF(scala.PartialFunction<Effect,R> f)
Description copied from interface:BehaviorTestKit
Asserts that the oldest effect matches the given partial function.- Specified by:
expectEffectPF
in interfaceBehaviorTestKit<T>
- Parameters:
f
- (undocumented)- Returns:
- (undocumented)
-
expectEffectType
public <E extends Effect> E expectEffectType(scala.reflect.ClassTag<E> classTag)
Description copied from interface:BehaviorTestKit
Asserts that the oldest effect is of type T. Consumes and returns the concrete effect for further direct assertions.- Specified by:
expectEffectType
in interfaceBehaviorTestKit<T>
- Parameters:
classTag
- (undocumented)- Returns:
- (undocumented)
-
getAllEffects
public java.util.List<Effect> getAllEffects()
Description copied from class:BehaviorTestKit
Requests all the effects. The effects are consumed, subsequent calls will only see new effects.- Specified by:
getAllEffects
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
getAllLogEntries
public java.util.List<CapturedLogEvent> getAllLogEntries()
Description copied from class:BehaviorTestKit
Returns all theCapturedLogEvent
issued by this behavior(s)- Specified by:
getAllLogEntries
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
getEffect
public Effect getEffect()
- Specified by:
getEffect
in classBehaviorTestKit<T>
-
hasEffects
public boolean hasEffects()
Description copied from class:BehaviorTestKit
Returns if there have been any effects.- Specified by:
hasEffects
in interfaceBehaviorTestKit<T>
- Specified by:
hasEffects
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
isAlive
public boolean isAlive()
Description copied from class:BehaviorTestKit
Is the current behavior alive or stopped- Specified by:
isAlive
in interfaceBehaviorTestKit<T>
- Specified by:
isAlive
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
logEntries
public scala.collection.immutable.Seq<CapturedLogEvent> logEntries()
Description copied from interface:BehaviorTestKit
Returns all theCapturedLogEvent
issued by this behavior(s)- Specified by:
logEntries
in interfaceBehaviorTestKit<T>
- Returns:
- (undocumented)
-
retrieveAllEffects
public scala.collection.immutable.Seq<Effect> retrieveAllEffects()
Description copied from interface:BehaviorTestKit
Requests all the effects. The effects are consumed, subsequent calls will only see new effects.- Specified by:
retrieveAllEffects
in interfaceBehaviorTestKit<T>
- Returns:
- (undocumented)
-
retrieveEffect
public Effect retrieveEffect()
Description copied from interface:BehaviorTestKit
Requests the oldestEffect
orEffect.NoEffects
if no effects have taken place. The effect is consumed, subsequent calls won't will not include this effect.- Specified by:
retrieveEffect
in interfaceBehaviorTestKit<T>
- Returns:
- (undocumented)
-
returnedBehavior
public Behavior<T> returnedBehavior()
Description copied from class:BehaviorTestKit
Returns the current behavior as it was returned from processing the previous message. For example ifBehavior.unhandled
is returned it will be kept here, but not inBehaviorTestKit.currentBehavior()
.- Specified by:
returnedBehavior
in interfaceBehaviorTestKit<T>
- Specified by:
returnedBehavior
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
run
public void run(T message)
Description copied from class:BehaviorTestKit
Send the message to the behavior and record anyEffect
s- Specified by:
run
in interfaceBehaviorTestKit<T>
- Specified by:
run
in classBehaviorTestKit<T>
- Parameters:
message
- (undocumented)
-
runOne
public void runOne()
Description copied from class:BehaviorTestKit
Send the first message in the selfInbox to the behavior and run it, recordingEffect
s.- Specified by:
runOne
in interfaceBehaviorTestKit<T>
- Specified by:
runOne
in classBehaviorTestKit<T>
-
selfInbox
public TestInboxImpl<T> selfInbox()
Description copied from class:BehaviorTestKit
The self inbox contains messages the behavior sent tocontext.self
- Specified by:
selfInbox
in interfaceBehaviorTestKit<T>
- Specified by:
selfInbox
in classBehaviorTestKit<T>
- Returns:
- (undocumented)
-
signal
public void signal(Signal signal)
Description copied from class:BehaviorTestKit
Send the signal to the beheavior and record anyEffect
s- Specified by:
signal
in interfaceBehaviorTestKit<T>
- Specified by:
signal
in classBehaviorTestKit<T>
- Parameters:
signal
- (undocumented)
-
-