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

Add @ApplicationScoped to generated api to allow mocking api for testing #87

Merged
merged 1 commit into from Jun 23, 2022
Merged

Conversation

miguelchico
Copy link
Contributor

PR to fix issue #86.
Adding @ApplicationScoped annotation to generated API will allow us to mock it in unit test according to official Quarkus guidelines https://quarkus.io/blog/mocking/#using-injectmock

@ricardozanini ricardozanini self-requested a review June 23, 2022 14:13
@ricardozanini ricardozanini added the enhancement New feature or request label Jun 23, 2022
@ricardozanini
Copy link
Member

@miguelchico were you able to test this approach in your application? I mean, with this PR you're able to mock the generated stub?

Another way to achieve mocking is to use Wiremock and change the endpoint to the mocked server.

I'm just wondering if this annotation won't bring any side effects to the user's project.

@ricardozanini ricardozanini linked an issue Jun 23, 2022 that may be closed by this pull request
@miguelchico
Copy link
Contributor Author

Hi @ricardozanini
I tested my application with the extra annotation and I couldn't find any side effects.
The idea here is to be able to mock that client in a more pure unit test rather than an integration test with a real webserver (mocked with wiremock)

@ricardozanini ricardozanini merged commit 980cbbe into quarkiverse:main Jun 23, 2022
@ricardozanini
Copy link
Member

@miguelchico I'll prepare a new release since I understand this is quite important for you?

@miguelchico
Copy link
Contributor Author

@ricardozanini
It would be great if you do so!
I'm also working on a PR for #85 but I don't think I'll be able to get it done this week I'm afraid. I'll keep you posted!

@ricardozanini
Copy link
Member

@all-contributors please add @miguelchico for code

@allcontributors
Copy link
Contributor

@ricardozanini

I've put up a pull request to add @miguelchico! 🎉

@ricardozanini
Copy link
Member

@miguelchico do you think we can wait for #85 then?

@miguelchico
Copy link
Contributor Author

@ricardozanini give me some time in order to do just one new release with both if you are ok, I'll need both anyway so it might be easier for both

@ricardozanini
Copy link
Member

Yes, that's what I was thinking. Let's include both in the new release. Take your time, please. Thanks for the contribution!

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

Successfully merging this pull request may close these issues.

@ApplicationScoped required for mocking api and missing
2 participants