This is the code I want to test. It's pretty straight forward

```
  class FileHandler {
    public boolean deleteFiles(String path) {
      // mock this to throw an exception
    }
    public static FileHandler instatiateNew(String location) {
      // creates a FileHandler
    }
  }

  class B {
    public void action {
      try {
        FileHandler x = FileHandler.instantiateNew("asd");
        x.deleteFiles();
      } catch (Exception e) {
        // untested code I want to reach
      }
    }
  }

```

I now want to test method `action` and see how it handles x.deleteFiles() throwing an exception. I have tried doThrow, thenThrow and ran into errors (NullPointerException, probably because I stubbed the method wrongly) or the method not throwing the exception in the end.

I am also confused whether I need Powermockito or not. I will now try an approach, where I mock the whole FileHandler class. As I need to mock the static instantiation method I will need PowerMock for that. But I would prefer a less heavy handed solution. Does it exist?

my partial class mock is now:

```
FileHandler mockHandler = Mockito.mock(FileHandler.class)
Mockito.mock(mockHandler.deleteFiles(Mockito.anyString()).thenThrow(Exception.class);
PowerMockito.mockStatic(FileHandler.class);
PowerMockito.when(FileHandler.instantiateNew(Mockito.anyString())).thenReturn(mockHandler())

```

Which is still causing issues, maybe becasue FileHandler is used elsewhere and mockStatic kills all other usages.