Another approach might be to use try/catch instead. It's a bit untidy but from what I understand this test is going to be short-lived anyway as it's for TDD:
@Test
public void testNPENotThrown{
Calling calling= Mock(Calling.class);
testClass.setInner(calling);
testClass.setThrow(true);
try{
testClass.testMethod();
fail("NPE not thrown");
}catch (NullPointerException e){
//expected behaviour
}
}
EDIT: I was in a hurry when I wrote this. What I mean by 'this test is going to be short-lived anyway as it's for TDD' is that you say you are going to write some code to fix this test straight away, so it will never throw a NullPointerException in the future. Then you might as well delete the test. Consequently it's probably not worth spending a lot of time writing a beautiful test (hence my suggestion :-))
More generally:
Starting off with a test to assert that (for example) the return value of a method is not null is an established TDD principle, and checking for a NullPointerException (NPE) is one possible way of going about this. However your production code is presumably not going to have a flow where a NPE is thrown. You are going to check for null and then do something sensible, I imagine. That would make this particular test redundant at that point as it will be checking an NPE is not thrown, when in fact it can never happen. You might then replace it with a test which verifies what does happen when a null is encountered: returns a NullObject for example, or throws some other type of exception, whatever is appropriate.
There is of course no requirement that you delete the redundant test, but if you don't, it will sit there making each build slightly slower, and causing each developer who reads the test to wonder; "Hmm, an NPE? Surely this code can't throw an NPE?". I have seen a lot of TDD code where the test classes have a lot of redundant tests like this. If time permits it pays to review your tests every so often.