@Test(expectedExceptions = CannotUploadExternalResourceException.class)
public void testWriteWhenCannotWriteShouldThrowException() throws IOException {

    //GIVEN
    given(file.getParent()).willReturn(DIRECTORIES);
    given(fileOutputStreamFactory.createFileOutputStream(file)).willThrow(new FileNotFoundException());
    //WHEN
    underTest.write(inputStream, FILE_NAME, EXCEPTION_MESSAGE);
    //THEN it should throw exception
}