@Test public void nonExistentResourceThrowsExceptionWhenTryingToGetInputStream() throws IOException { FileResource resource = new FileResource("foobar"); Exception e = assertThrows(FileNotFoundException.class, () -> resource.inputStream()); assertThat(e.getMessage(), matchesPattern("foobar.*")); }
@Override public InputStream inputStream() throws IOException { return new FileInputStream(file); }
FileResource implements Resource { @Override public InputStream inputStream() throws IOException { return new FileInputStream(file); } }
FileResource implements Resource { @Override public InputStream inputStream() throws IOException { return new FileInputStream(file); } FileResource(File file);  FileResource(File root, File file);  FileResource(String path); }
FileResource implements Resource { @Override public InputStream inputStream() throws IOException { return new FileInputStream(file); } FileResource(File file);  FileResource(File root, File file);  FileResource(String path); @Override String path(); @Override URL url(); @Override String absolutePath(); @Override InputStream inputStream(); @Override ClassLoader classLoader(); File getFile(); @Override String toString(); }
FileResource implements Resource { @Override public InputStream inputStream() throws IOException { return new FileInputStream(file); } FileResource(File file);  FileResource(File root, File file);  FileResource(String path); @Override String path(); @Override URL url(); @Override String absolutePath(); @Override InputStream inputStream(); @Override ClassLoader classLoader(); File getFile(); @Override String toString(); static final String FILE_SCHEME; }