XmlConfigurationStreamProvider implements ConfigurationStreamProvider { @Override public InputStream getConfigurationStream() throws ConfigurationException { return ofNullable(getConfiguration()) .orElseThrow(() -> new ConfigurationException("Unable to find xml configuration file")); }  @Override InputStream getConfigurationStream();  }
@Test public void testCustomConfiguration() throws ConfigurationException { System.setProperty("sejda.config.file", "custom-sejda.xml"); ConfigurationStreamProvider provider = new XmlConfigurationStreamProvider(); assertNotNull(provider.getConfigurationStream()); }
@Test(expected = ConfigurationException.class) public void testNotExistingCustomConfiguration() throws ConfigurationException { System.setProperty("sejda.config.file", "not-existing-sejda.xml"); ConfigurationStreamProvider provider = new XmlConfigurationStreamProvider(); assertNotNull(provider.getConfigurationStream()); }