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

WireMockExtension.stopServerIfRunning() produces NPE when Unit Test aborts unexpectedly #2627

Open
bertramn opened this issue Mar 5, 2024 · 0 comments
Labels

Comments

@bertramn
Copy link

bertramn commented Mar 5, 2024

Proposal

When using WiremockExtension with other JUnit5 extensions, another extension could unexpectedly fail. A failure would lead to wiremock server never to be started BUT JUnit will attempt to clean up all extensions with a call to extension.afterAll(extensionContext). this will trigger WiremockExtension.stopServerIfRunning() and produces a NullPointerException because the wireMockServer has never been initialised. To prevent this from happening a null check should be added like here.

Reproduction steps

Create a test that loads multiple extensions and make sure another extension loaded after the wiremock one fails.

References

No response

@bertramn bertramn added the bug label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant