almondtools / testrecorder

Create Test Fixtures from Runnable Java Code
http://testrecorder.amygdalum.net/
GNU Lesser General Public License v3.0
51 stars 5 forks source link

@PreferFactories #28

Closed almondtools closed 5 years ago

almondtools commented 7 years ago

By annotating values with @PreferFactories we could point the generator to put the creation of this value in its own factory method - rather than into the test.

This annotation may be extended by an attribute that holds a builder/factory class, that should be used to construct an object.

almondtools commented 7 years ago

The value of this feature increases if factory methods could be reused in all tests using the same object. Yet this requires the test generator to recognize the variable parts of the factory. A generic approach gets harder in this case.

almondtools commented 5 years ago

I will downsize the problem to:

It should be possible to point the generator to use a given factory (with @Factory) similar to @Builder: