Remove `ExpectedException` from internal test suite
See original GitHub issueThe rule is not ideal, as it will trigger even if the test fails for a completely different reason. Instead, we should use assertj
with assertThatThrownBy
to denote which specific line should trigger the exception.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
After hitting expectedexception test ends - Stack Overflow
After hitting expectedexception test ends ... I'm testing the delete method of an abstract base repository class which is inherited by several ...
Read more >How To Cause DmlException - Delete
static testMethod void testDmlException_Delete() { List<Case> records ... delete records; DmlException expectedException; Test.
Read more >JUnit Test Exception Examples - How to assert an exception is ...
In this JUnit tutorial, you will learn how to assert an exception is thrown by the code under test. Suppose that we want...
Read more >Java static code analysis: Exception testing via JUnit ...
ExpectedException any code after the raised exception will not be executed, so adding subsequent assertions is wrong and misleading. This rule raises an...
Read more >8 ways of handling exceptions in JUnit. Which one to choose?
Please note that the "thrown" rule may be reused in many tests. @Rule public ExpectedException thrown = ExpectedException.none(); @Test public ...
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
@temp-droid I don’t think we need a dedication cleanup for that, but if you are changing a test that has runnables, then yes let’s convert them to lambdas instead. Do you want to take on this task? Thanks in advance!
Yes to both of these, thanks!