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

JUnit silently fails to resolve tests if they aren't of type void. This can be confusing, particularly in other JVM languages like Scala. #2659

Closed
GavinRay97 opened this issue Jul 5, 2021 · 3 comments

Comments

@GavinRay97
Copy link

Steps to reproduce

  1. Make class with a JUnit @Test that doesn't return void
  2. Try to run all tests
  3. Have it be reported that no tests were found

Context

Following a multi-day investigation and discussion with the Redhat/Quarkus team at:

The confusion

image

image

The resolution

  • (Add : Unit to function signature to have it generate void as return type in bytecode)

image

image

Deliverables

Please would it be possible to either:

  • Make JUnit tests accept @Test that return things beside void, potentially just disregarding the return type
  • Issue a VERY LARGE, blatant error/warning message when No tests were found that JUnit only resolves @Test methods of type void. Something like No tests returning type "void" were found. JUnit only resolves tests of type "void".
@marcphilipp
Copy link
Member

Thanks for raising the issue! This has come up before and is tracked in #242. Feel free to join the discussion there!

@GavinRay97
Copy link
Author

Thanks for raising the issue! This has come up before and is tracked in #242. Feel free to join the discussion there!

Sorry, wasn't aware of the existing issue -- my apologies!

@marcphilipp
Copy link
Member

Sorry, wasn't aware of the existing issue -- my apologies!

No worries at all!

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
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