StreamUtils { public static InputStream toInputStream(File file) { return WrappedFileInputStream.create(file); }  static void closeQuietly(InputStream stream); static InputStream toInputStream(File file); static ByteArrayInputStream createByteArrayInputStream(byte[] buffer);  }
@Test(expected = IllegalArgumentException.class) public void fileToInputStream_invalidFile() { StreamUtils.toInputStream(new File("/asdfjkl")); }
@Test public void fileToInputStream() throws IOException { File file = File.createTempFile("StreamUtilsTest", null); file.deleteOnExit(); try (InputStream stream = StreamUtils.toInputStream(file)) { assertNotNull(stream); } file.delete(); }