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

ASSERT.assertNotNull verhindert MayProduceNPE Warnung nicht #342

Open
tomg246 opened this issue Jul 17, 2023 · 1 comment
Open

ASSERT.assertNotNull verhindert MayProduceNPE Warnung nicht #342

tomg246 opened this issue Jul 17, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@tomg246
Copy link

tomg246 commented Jul 17, 2023

Is your feature request related to a problem? Please describe.
After checkong an object via AssertProvider.ASSERT.assertNotNull(Obj o) intelliJ nethertheless shows the "Method invocation may produce NullPointerException" warning

NPE warning after assertNotNull

Describe the solution you'd like
use @contract("null -> false") for assertNotNull

grafik

@tomg246 tomg246 added the enhancement New feature or request label Jul 17, 2023
@martingrossmann
Copy link
Contributor

The @Contract annotation belongs to the dependency org.jetbrains:annotations which is not part of Testerra. This could helpful if all Testerra users use IntelliJ. But Testerra is a common Java Framework. I'm not sure if we have to add special helpers for certain IDEs.
Of course we could provide some hints how to configure your IDE for best experience. Is there another solution for IntelliJ? Well, the IDE already knows the Assert methods of Junit and TestNG. Could we extend that rules?

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