Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Builder Pattern based class constrution #217

Open
niravmsh opened this issue Oct 31, 2017 · 3 comments
Open

Support for Builder Pattern based class constrution #217

niravmsh opened this issue Oct 31, 2017 · 3 comments

Comments

@niravmsh
Copy link

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"

@sta-szek
Copy link
Owner

sta-szek commented Nov 1, 2017

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?

@sta-szek
Copy link
Owner

@niravmsh please check #222 if this satisfies issue reported by you. Thanks.

@dkirrane
Copy link

dkirrane commented Oct 8, 2019

Does this support testing lombak @Builder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants