Made changes to use @Rule for exception.