2

I have a problem with throw InterruptedException. Part of my source:

    Future<Object> future = mock(Future.class);
    when(future.get(any(), any())).thenThrow(new InterruptedException());

But I get java.lang.NullPointerException on the second line, What's wrong with my code? I want to throw InterruptedException when I call get method

mystdeim
  • 4,802
  • 11
  • 49
  • 77

0 Answers0