Akka's Testkit is not meant to replace existing matcher libraries such as junit, testng, hamcrest or fest-assert. Simply use the existing testing libraries with the testkit. If you want better assertions simply val msg = expectMsgType... and apply your assertions on it then.
In short: Akka's testkit is by design only meant to provide help in those areas that the other libraries do not address – the async messaging / awaiting things. -- Konrad `ktoso` Malawski Akka <http://akka.io> @ Lightbend <http://lightbend.com> On 1 January 2017 at 22:54:17, Ross Duncan ([email protected]) wrote: Hi Akka List, Im new the JavaTestKit and trying to understand how to set up a slightly more complex assertion on the value of an expected message. I have created a Probe and supplied it to the actor that I am testing, and want to make assertions against the message that the actor under test sends to the probe. It seems trivial to make some very basic declarations about the message that I expect to be received by the probe by using the call: *myProbe*.expectMsgEquals(...) , or one of its similar expectMsg api calls that are available on JavaTestKit (the type of the probe). However I would like to make some more complex assertion/match against the value that I expect to be received. Ideally I would like to be able to pass a hamcrest matcher to the expectMsg method, but I dont see anything similar to that on the api. What I have seen in the documentation is usage of the ExpectMsg class, but not in the context of a probe. When creating and using ExpectMasg outside the probe, it isnt clear how to relate that to the probe itself. Am I barking up the wrong tree? Thanks, Ross -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
