Packages

package javadsl

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. final class ActorTestKit extends AnyRef

    Java API: Test kit for asynchronous testing of typed actors.

    Java API: Test kit for asynchronous testing of typed actors. Provides a typed actor system started on creation, that can be used for multiple test cases and is shut down when shutdown is called.

    The actor system has a custom guardian that allows for spawning arbitrary actors using the spawn methods.

    Designed to work with any test framework, but framework glue code that calls shutdownTestKit after all tests has run needs to be provided by the user or with TestKitJunitResource.

    Use TestKit.create factories to construct manually or TestKitJunitResource to use together with JUnit tests

    For synchronous testing of a Behavior see BehaviorTestKit

  2. abstract class BehaviorTestKit[T] extends AnyRef

    Used for synchronous testing akka.actor.typed.Behaviors.

    Used for synchronous testing akka.actor.typed.Behaviors. Stores all effects e.g. Spawning of children, watching and offers access to what effects have taken place.

    Not for user extension or instantiation. See BehaviorTestKit.create factory methods

    For asynchronous testing of Behaviors running see ActorTestKit

    Annotations
    @DoNotInherit() @ApiMayChange()
  3. final class LogCapturing extends TestRule

    JUnit TestRule to make log lines appear only when the test failed.

    JUnit TestRule to make log lines appear only when the test failed.

    Use this in test by adding a public field annotated with @TestRule:

    @Rule public final LogCapturing logCapturing = new LogCapturing();

    Requires Logback and configuration like the following the logback-test.xml:

    <appender name="CapturingAppender" class="akka.actor.testkit.typed.internal.CapturingAppender" />
    
    <logger name="akka.actor.testkit.typed.internal.CapturingAppenderDelegate" >
      <appender-ref ref="STDOUT"/>
    </logger>
    
    <root level="DEBUG">
        <appender-ref ref="CapturingAppender"/>
    </root>
  4. abstract class LoggingTestKit extends AnyRef

    Facilities for verifying logs.

    Facilities for verifying logs.

    Requires Logback.

    See the static factory methods as starting point for creating LoggingTestKit.

    Not for user extension.

    Annotations
    @DoNotInherit()
  5. final class ManualTime extends AnyRef

    Not for user instantiation, see ManualTime#get

  6. trait ReplyInbox[T] extends AnyRef

    Similar to an akka.actor.testkit.typed.javadsl.TestInbox, but can only ever give access to a single message (a reply).

    Similar to an akka.actor.testkit.typed.javadsl.TestInbox, but can only ever give access to a single message (a reply).

    Not intended for user creation: the akka.actor.testkit.typed.javadsl.BehaviorTestKit will provide these to denote that at most a single reply is expected.

    Annotations
    @DoNotInherit() @ApiMayChange()
  7. class SerializationTestKit extends AnyRef

    Utilities to test serialization.

  8. trait StatusReplyInbox[T] extends AnyRef

    A akka.actor.testkit.typed.javadsl.ReplyInbox which specially handles akka.pattern.StatusReply.

    A akka.actor.testkit.typed.javadsl.ReplyInbox which specially handles akka.pattern.StatusReply.

    Note that there is no provided ability to expect a specific Throwable, as it's recommended to prefer a string error message or to enumerate failures with specific types.

    Not intended for user creation: the akka.actor.testkit.typed.javadsl.BehaviorTestKit will provide these to denote that at most a single reply is expected.

    Annotations
    @DoNotInherit() @ApiMayChange()
  9. abstract class TestInbox[T] extends AnyRef

    Utility for use as an ActorRef when *synchronously* testing akka.actor.typed.Behavior with akka.actor.testkit.typed.javadsl.BehaviorTestKit.

    Utility for use as an ActorRef when *synchronously* testing akka.actor.typed.Behavior with akka.actor.testkit.typed.javadsl.BehaviorTestKit.

    If you plan to use a real akka.actor.typed.ActorSystem then use akka.actor.testkit.typed.javadsl.TestProbe for asynchronous testing.

    Use TestInbox.create factory methods to create instances

    Not for user extension

    Annotations
    @DoNotInherit()
  10. final class TestKitJunitResource extends ExternalResource

    A Junit external resource for the ActorTestKit, making it possible to have Junit manage the lifecycle of the testkit.

    A Junit external resource for the ActorTestKit, making it possible to have Junit manage the lifecycle of the testkit. The testkit will be automatically shut down when the test completes or fails.

    Note that Junit is not provided as a transitive dependency of the testkit module but must be added explicitly to your project to use this.

    Example:

    public class MyActorTest {
      @ClassRule
      public static final TestKitResource testKit = new TestKitResource();
    
      @Test
      public void testBlah() throws Exception {
    	   // spawn actors etc using the testKit
    	   ActorRef<Message> ref = testKit.spawn(behavior);
      }
    }

    By default config is loaded from application-test.conf if that exists, otherwise using default configuration from the reference.conf resources that ship with the Akka libraries. The application.conf of your project is not used in this case. A specific configuration can be passed as constructor parameter.

  11. abstract class TestProbe[M] extends RecipientRef[M]

    Java API: * Create instances through the create factories in the TestProbe companion or via ActorTestKit#createTestProbe.

    Java API: * Create instances through the create factories in the TestProbe companion or via ActorTestKit#createTestProbe.

    A test probe is essentially a queryable mailbox which can be used in place of an actor and the received messages can then be asserted etc.

    Not for user extension

    Annotations
    @DoNotInherit()

Value Members

  1. object ActorTestKit
  2. object BehaviorTestKit
  3. object Effects

    Factories for behavior effects for BehaviorTestKit, each effect has a suitable equals and can be used to compare actual effects to expected ones.

  4. object FishingOutcomes
  5. object LoggingTestKit

    Facilities for selectively matching log messages.

    Facilities for selectively matching log messages.

    Requires Logback.

  6. object ManualTime

    Manual time allows you to do async tests while controlling the scheduler of the system.

    Manual time allows you to do async tests while controlling the scheduler of the system.

    To use it you need to configure the ActorSystem/ActorTestKit with ManualTime.config and access the scheduler control through ManualTime.get

  7. object TestInbox
  8. object TestProbe

Ungrouped