Skip to content

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 as not planned
@GavinRay97

Description

@GavinRay97

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".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions