forAll(a: A) takes Shrink[A] instance as an implicit parameter, Shrink[A] is essentially a A => Stream[A], where the stream is a finite list of "smaller" examples derived from the failing example which may also fail. If forAll finds an example of an A which causes a test failure, it will use the Shrink instance to generate a stream of more possible test cases, and test those.

For example, if it finds that "asdf" cases a test failure, it will generate a Stream("sdf",'adf", "asf" , "asd") and if any of those fail, it will recurse on the failed case.

There is a default Shrink instance for Any which will just genrate an empty stream.

This test ensures that a Shrink instance other than this default was found for our Product type. It ensures that this shrink instance works by eventually finding the smallest possible case (the product of two empty strings), and ensures the the streams generated don't contain the seed element, which would cause an infinite stream to be generated.

I had originally written a more complex product involving a List that we could expect to be shrunk to Nil, but this was combinatorially too complex, and made the test take 90 seconds to successfully complete.