FileStreamFactory implements InputStreamFactory { @Override public long getExpectedSize() { return file.length(); } FileStreamFactory(File file); @Override InputStream openStream(); @Override long getExpectedSize();  }
@Test public void reportsFileSize() throws Exception { File file = folder.newFile(); FileUtils.writeByteArrayToFile(file, new byte[3000]); long expectedSize = new FileStreamFactory(file).getExpectedSize(); assertThat(expectedSize, is(3000L)); }