Open niravmsh opened 7 years ago
Yes of course, that would be nice. I was thinking about passing method reference as parameter that would create object. But we can tell pojo-tester to use lombok builder so we can increase code coverage on lombok builder as requested in #197.
I imagine implementation as follows (or smth similar):
.create(A.class, ACreator::create)
- method reference,
.create(A.class, ACreator.class)
- class reference that implements some kind of Creator
interface,
.create(A.class).using(ACreator::Create)
- same as first,
.create(A.class).using(ACreator.class)
- same as second,
.create(A.class).using(Lombok.Builder)
- create using lombok builder,
Or we can introduce some kind of creator / generator and register them as follows:
.register(ACreator.class).register(BCreator::class)
We can also register creator automatically, similar to javax.persistence.Converter
with autoApply
option, but that might be not intuitive and cause global problems.
This topic is quite big and in the near future I won't have time to do this. @niravmsh, would you like to implement this?
@niravmsh please check https://github.com/sta-szek/pojo-tester/pull/222 if this satisfies issue reported by you. Thanks.
Does this support testing lombak @Builder
?
Can we enhance "Create class using selected constructor" to also support Builder Pattern Supplying the object itself or method to generate the object as input to "AbstractAssertion.create"