PiranhaJava // Remove meaningless "assert" and "expect" from JUnits
See original GitHub issuePiranha simplification will need manual review and fixing of testcases, but I think it’s useful to delete lines like:
expect(true).andReturn(true);
assertFalse(true);
which Piranha leaves behind in test classes after simplifying toggle expressions.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How do I assert my exception message with JUnit Test ...
If my test method throws a checked exception and if I want to assert the message along with the exception, is there a...
Read more >Assertions in JUnit 4 and JUnit 5 - Baeldung
A look at assertions in both JUnit 4 and 5. ... The assertEquals assertion verifies that the expected and the actual values are...
Read more >Assert (JUnit API)
Class Assert. A set of assertion methods useful for writing tests. Only failed assertions are recorded. These methods can be used directly: Assert....
Read more >Writing Assertions With JUnit 5 Assertion API - Petri Kainulainen
This blog post describes how you can write assertions by using the JUnit 5 assertion API.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has been resolved in #156.
This may be a slightly involved fix and it is better to avoid special casing. We will need to implement multi-pass analysis on the code to get this correct.
For the second pass to succeed in the case given above, methods
expect
,andReturn
andanyTimes
can be given asempty
methodTypes as part ofmethodProperties
.Another option is to determine the code range that is updated by Piranha and re-run the standard Piranha analysis and restrict the refactorings to those regions.
Let us discuss more on the gitter channel before finalizing a solution.