-
Notifications
You must be signed in to change notification settings - Fork 468
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
Assertions in Switch Expressions lead to compiler error #1845
Comments
FWIW implicit assertions in In general I'd consider conditional logic in tests a code smell. |
It is the opposite. So as long as there is only one condition in each of the branches, it works as might be expected. The The problem is the second example that does not compile properly. If the compilation is fixed, then you could use explicit assertion even with only one condition in the branch and then get the power assertion output properly. A simple work-around is not to use a |
Describe the bug
Version: 2.4-M1-groovy-4.0
I have a test case where I need to get content form a map and assert its value. I first tried it with a switch expression and build a example I can share:
When I ant to run this test I get the following build output:
To Reproduce
Expected behavior
assertion is executed in the matching case
Actual behavior
compiler error
Java version
java version "21" 2023-09-19 LTS
Buildtool version
Apache Maven 3.8.5
What operating system are you using
Windows
Dependencies
Additional context
No response
The text was updated successfully, but these errors were encountered: