0

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

user_mda
  • 18,148
  • 27
  • 82
  • 145

1 Answers1

0

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....")

awagen
  • 236
  • 2
  • 8