Package akka.testkit
Class JavaTestKit.ExpectMsg<T>
- java.lang.Object
-
- akka.testkit.JavaTestKit.ExpectMsg<T>
-
- Enclosing class:
- JavaTestKit
public abstract class JavaTestKit.ExpectMsg<T> extends java.lang.Object
Receive one message from the test actor and assert that the given matching function accepts it. Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout.The received object as transformed by the matching function can be retrieved with the
get
method.Use this variant to implement more complicated or conditional processing.
final String out = new ExpectMsg<String>("match hint") { protected String match(Object in) { if (in instanceof Integer) return "match"; else throw noMatch(); } }.get(); // this extracts the received message
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
get()
protected abstract T
match(java.lang.Object msg)
protected java.lang.RuntimeException
noMatch()
-