// Mock a DocumentFile that has the proper input stream.
DocumentFile<Local> file = mock(DocumentFile.class);
when(file.getStream()).thenReturn(inputStream);
// Mock the fileRepository and make it return the proper file name and our mocked DocumentFile
DocumentFileRepository fileRepository = mock(DocumentFileRepository.class);
when(fileRepository.getFileNames(any(DocumentID.class))).thenReturn(Arrays.asList(fileName));
when(fileRepository.getFile(anyString(), any(DocumentID.class))).thenReturn(file);
return fileRepository;
}