question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PiranhaJava // Remove meaningless "assert" and "expect" from JUnits

See original GitHub issue

Piranha 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ketkarameyacommented, Aug 7, 2022

This has been resolved in #156.

1reaction
mkr-plsecommented, Jun 15, 2020

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.

  1. In the first pass, determine the various Piranha refactorings and their locations, but do no rewrite the code.
  2. In the second pass, use the information from the previous pass along with standard Piranha refactoring to rewrite.

For the second pass to succeed in the case given above, methods expect, andReturn and anyTimes can be given as empty methodTypes as part of methodProperties.

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found