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

Make the API to use a javaGetter neater #849

Open
esfomeado opened this issue Dec 20, 2023 · 2 comments
Open

Make the API to use a javaGetter neater #849

esfomeado opened this issue Dec 20, 2023 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@esfomeado
Copy link
Contributor

Describe the feature you request

As of now in Java you can use getters to set a value as specified on the documentation.

    Order actual = sut.giveMeBuilder(Order.class)
            .set(javaGetter(Order::getOrderNo), "1")
            .set(javaGetter(Order::getProductName), "Line Sally")
            .minSize(javaGetter(Order::getItems), 1)
            .sample();

I think that it´s to verbose and not as neat as Kotlin where you can just do .setExp(Order::orderNo, "1").

I suggest to be a similar syntax as well for Java users.

@esfomeado esfomeado added the enhancement New feature or request label Dec 20, 2023
@seongahjo
Copy link
Contributor

@esfomeado
Thanks for the suggestion. Do you have any good ideas?

Do you want an API that looks like this?

Order actual = sut.giveMeBuilder(Order.class)
    .setExpGetter(Order::getOrderNo, 1)
    .sample();

@esfomeado
Copy link
Contributor Author

That looks good to me.

@seongahjo seongahjo added this to the 1.1.0 milestone Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants