Thomas Sundberg

November 20, 2015

Expected exceptions

Filed under: Java, Programming, TDD — Tags: , , , , — Thomas Sundberg @ 11:27

This post is available at


  1. Hi Thomas!
    There is also a nice little helper library called catch-exception which is here
    It allows to check for an exception in a single line,

    verifyException(myList, IndexOutOfBoundsException.class).get(1);

    But then you need an extra library to add.

    Comment by Peter Kofler — November 20, 2015 @ 22:51

    • Hi Peter!

      I don’t see adding a dependency as a bad thing. Not if it allows you to write readable and understandable code.
      I wasn’t aware of the one you mention.


      Comment by Thomas Sundberg — November 21, 2015 @ 10:16

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: