Clean up factory tests to better address returning subclasses and superclasses of requested objects.