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.

Remove `ExpectedException` from internal test suite

See original GitHub issue

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

github_iconTop GitHub Comments

1reaction
TimvdLippecommented, Dec 14, 2021

@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!

0reactions
TimvdLippecommented, Dec 14, 2021

Yes to both of these, thanks!

Read more comments on GitHub >

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

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