Delegate stop method on TestKitJunitResource #27007
This commit is contained in:
parent
e7672a9802
commit
e6cdb01aa1
2 changed files with 14 additions and 0 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
package akka.actor.testkit.typed.javadsl
|
package akka.actor.testkit.typed.javadsl
|
||||||
|
|
||||||
|
import java.time.Duration
|
||||||
|
|
||||||
import akka.actor.testkit.typed.TestKitSettings
|
import akka.actor.testkit.typed.TestKitSettings
|
||||||
import akka.actor.testkit.typed.internal.TestKitUtils
|
import akka.actor.testkit.typed.internal.TestKitUtils
|
||||||
import akka.actor.typed.ActorRef
|
import akka.actor.typed.ActorRef
|
||||||
|
|
@ -127,6 +129,16 @@ final class TestKitJunitResource(_kit: ActorTestKit) extends ExternalResource {
|
||||||
*/
|
*/
|
||||||
def createTestProbe[M](name: String): TestProbe[M] = testKit.createTestProbe(name)
|
def createTestProbe[M](name: String): TestProbe[M] = testKit.createTestProbe(name)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See corresponding method on [[ActorTestKit]]
|
||||||
|
*/
|
||||||
|
def stop[T](ref: ActorRef[T], max: Duration): Unit = testKit.stop(ref, max)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See corresponding method on [[ActorTestKit]]
|
||||||
|
*/
|
||||||
|
def stop[T](ref: ActorRef[T]): Unit = testKit.stop(ref)
|
||||||
|
|
||||||
override def after(): Unit = {
|
override def after(): Unit = {
|
||||||
testKit.shutdownTestKit()
|
testKit.shutdownTestKit()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public class BehaviorTestKitTest extends JUnitSuite {
|
||||||
private final Class<Object> clazz;
|
private final Class<Object> clazz;
|
||||||
private final Function<Object, Command> f;
|
private final Function<Object, Command> f;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public CreateMessageAdapter(Class clazz, Function<Object, Command> f) {
|
public CreateMessageAdapter(Class clazz, Function<Object, Command> f) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
this.f = f;
|
this.f = f;
|
||||||
|
|
@ -314,6 +315,7 @@ public class BehaviorTestKitTest extends JUnitSuite {
|
||||||
BehaviorTestKit<Command> test = BehaviorTestKit.create(behavior);
|
BehaviorTestKit<Command> test = BehaviorTestKit.create(behavior);
|
||||||
SpawnChildren adaptedMessage = new SpawnChildren(1);
|
SpawnChildren adaptedMessage = new SpawnChildren(1);
|
||||||
test.run(new CreateMessageAdapter(String.class, o -> adaptedMessage));
|
test.run(new CreateMessageAdapter(String.class, o -> adaptedMessage));
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Effect.MessageAdapter<String, SpawnChildren> mAdapter =
|
Effect.MessageAdapter<String, SpawnChildren> mAdapter =
|
||||||
test.<Effect.MessageAdapter>expectEffectClass(Effect.MessageAdapter.class);
|
test.<Effect.MessageAdapter>expectEffectClass(Effect.MessageAdapter.class);
|
||||||
assertEquals(String.class, mAdapter.messageClass());
|
assertEquals(String.class, mAdapter.messageClass());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue