@Test public void readsFileContents() throws Exception { try (InputStream input = provider.open(Resources.getResource("example.txt").getFile()); ByteArrayOutputStream output = new ByteArrayOutputStream()) { byte[] buffer = new byte[1024]; int length; while ((length = input.read(buffer)) != -1) { output.write(buffer, 0, length); } assertEquals("Grpc Java Express", new String(output.toByteArray(), StandardCharsets.UTF_8).trim()); } }
@Override public InputStream open(String path) throws IOException { final File file = new File(path); if (!file.exists()) { throw new FileNotFoundException("File " + file + " not found"); } return new FileInputStream(file); }
FileConfigurationSourceProvider implements ConfigurationSourceProvider { @Override public InputStream open(String path) throws IOException { final File file = new File(path); if (!file.exists()) { throw new FileNotFoundException("File " + file + " not found"); } return new FileInputStream(file); } }
FileConfigurationSourceProvider implements ConfigurationSourceProvider { @Override public InputStream open(String path) throws IOException { final File file = new File(path); if (!file.exists()) { throw new FileNotFoundException("File " + file + " not found"); } return new FileInputStream(file); }  }
FileConfigurationSourceProvider implements ConfigurationSourceProvider { @Override public InputStream open(String path) throws IOException { final File file = new File(path); if (!file.exists()) { throw new FileNotFoundException("File " + file + " not found"); } return new FileInputStream(file); }  @Override InputStream open(String path); }
FileConfigurationSourceProvider implements ConfigurationSourceProvider { @Override public InputStream open(String path) throws IOException { final File file = new File(path); if (!file.exists()) { throw new FileNotFoundException("File " + file + " not found"); } return new FileInputStream(file); }  @Override InputStream open(String path);  }