cushon / issues-import

0 stars 0 forks source link

Matchers should not throw an exception for unexpected input. #201

Open cushon opened 9 years ago

cushon commented 9 years ago

Original issue created by dbeaumont@google.com on 2013-10-14 at 05:19 PM


Matchers should not throw an exception for unexpected input.

Currently the Matchers.staticMethod(className, methodName) matcher throws IllegalArgumentException when not given a method invocation to match. It should just fail to match and return false.

Currently I had to wrap usage with a 'safe' matcher to catch exceptions and return false - which works, but isn't nice.

This philosophy of never throwing exceptions applies to every matcher in general.