it was not working for me when method param which was sent is null.
doThrow(Exception.class).when(mockedObj).method(anyString())
mockedObj.method(name); //value of name = null.
So, i had to change test as below
doThrow(Exception.class).when(mockedObj).method(eq(null))