In the last article we learned how to generate objects with Java 8 in a functional way and implemented a small API based around the
Gen monad. Although already powerful on its own, generators really shine when we use them in combination with property-based testing. A property-based test verifies a statement about the output of your code based on some given input. The same statement - or property - is verified for many different possible inputs to find one that falsifies the property. This article builds upon the implementation of
Gen and discusses a simple API that enables us to write property-based tests.