Testing asynchronous systems is hard. Not only does it require handling threads, timeouts and concurrency issues, but the intent of the test code can be obscured by all these details.
Learn how to create true Java unit tests by mocking all external dependencies in your unit tests with the Spock testing framework.
Summary of unit test mocking capabilites and syntax of Spock test framework
Recently, in one of my pet projects, I decided to try writing tests using Spock framework. It was a great experience, I enjoyed it a lot. Except for the part of setting it up, which was somewhat annoying.
A mocking framework for PHP