Quantcast
Channel: Akka Essentials
Viewing all articles
Browse latest Browse all 11

Using TestKit with Java

$
0
0
Unit testing toolkit is provided via TestKit in Akka. The scala side of unit testing is well covered. For java, TestKit provides limited constructs. The various examples implemented by Ray Roestenburg have been ported to Java world, with couple of more scenario's added. This can be good starting point for Java programmers to start unit testing their actors.

Let’s check out some testing code which tests out the following different set of actors
  • Echo Actor– responds back with whatever is passed to the actor
  • Forwarding Actor– forwards the message to another actor
  • Sequencing Actor– replies back in a series of messages but assuming we are interested in one
  • Filtering Actor– replies back for certain messages and ignores the others
  • Boom Actor– throws an exception when a message is send
  • Supervisor Actor– manages an another worker actor, and based on the exception thrown by the worker actor, applies the appropriate supervisor strategy


The code base for the program is available at the following location - https://github.com/write2munish/Akka-Essentials under the AkkaUnitTest

Viewing all articles
Browse latest Browse all 11

Trending Articles