Hey folks,
I'm trying to
test out some code that is wrapped in a try block. I'd really like to test out the two exception cases that could potentially happen but I'm not sure how because I don't have an easy way to create the error cases.
The method in question is included below. Basically it makes a call on another class to resolve an XPath query. The two catch blocks are used to wrap any XPath exceptions we get with a global exception (so the end-user doesn't have to know we're using XPath). Problem is the XPath query is a private final variable (i.e. not something passed in that I could change).
Does anyone have any ideas how you could test something like this?