I have an AKKA actor that currently throws an exception when receved n unhandled message. How do I write a test case to prove that this exception is thrown ?

The following assertion fails

expectMessageClass(MyException.class)

I do see the exception being thrown

I also tried using Junit's (expectException = MyException.class) which also fails. What is the correct way of testing unhandled messages for AKKA actors

1 Answers

0
awagen On

expectMessageClass is not valid since exceptions are bit different from messages, and thus the handling here differs. An example of exception testing can be seen here: https://doc.akka.io/docs/akka/current/testing.html (section "The Way In-Between....")