Testing for an error using exception handling - the stupid way


/ Published in: Java
Save to your folder(s)

I was refactoring code lately, changed a method to return null instead of throwing an error - yet this test kept working. I did not get why for quite some time.

Lesson learned: Never rely on Eclipse generating a try-catch-block without actually looking what kind of exception or error it catches.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.