FileSource extends AbstractSource<File> { public static FileSource newInstance(File file) { if (file == null || !file.isFile()) { throw new IllegalArgumentException("A not null File instance that isFile is expected. Path: " + file); } return new FileSource(file); } FileSource(File file); @Override File getSource(); @Override String toString(); @Override R dispatch(SourceDispatcher<R> dispatcher); @Override SeekableSource initializeSeekableSource(); static FileSource newInstance(File file);  }
@Test(expected = IllegalArgumentException.class) public void testNullFile() { FileSource.newInstance(null); }
@Test(expected = IllegalArgumentException.class) public void testDirectory() { File file = mock(File.class); when(file.isFile()).thenReturn(Boolean.FALSE); FileSource.newInstance(file); }