I regard that as a bad practice, especially if the exception is ignored. With this code, the test fails without any reason. If the exception is simply thrown (so without the try-catch), the test will fail with an error, and the exception will be available.
The other way around is more interesting:
I've used this quite a lot in the past. However, since JUnit 4.13 and JUnit 5, this is no longer needed. Instead, assertThrows can be used:
There are some warnings about that though - the code inside assertThrows should preferably have only one method call. That way, you know which method triggers the exception. (I've had Sonar complain many times if I used more than one method call).
Yes, anything that throws away an Exception message when it doesn't even know what the Exception is is VERY bad practice regardless of whether it's in test code or mainline code. And those who do it where I can catch them should be prepared to face dire consequences.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"