BlobStoreFixtureProvider { static Properties loadConfig(String cfgPath) throws IOException { String extension = FilenameUtils.getExtension(cfgPath); Properties props; if ("config".equals(extension)){ props = loadAndTransformProps(cfgPath); } else { props = new Properties(); try(InputStream is = FileUtils.openInputStream(new File(cfgPath))){ props.load(is); } } return props; }  @Nullable static BlobStoreFixture create(Options options);  }
@Test public void configLoading() throws Exception { Properties p = new Properties(); p.put("foo", "bar"); p.put("a", "b"); File config = new File(temporaryFolder.getRoot(), "test.cfg"); try (OutputStream os = FileUtils.openOutputStream(config)) { p.store(os, null); } Properties p2 = BlobStoreFixtureProvider.loadConfig(config.getAbsolutePath()); assertEquals("bar", p2.getProperty("foo")); }
@Test public void configLoading_OSGi() throws Exception { Dictionary<String, Object> p = new Hashtable<String, Object>(); p.put("foo", "bar"); p.put("a", 1); p.put("b", new int[]{1, 2}); File config = new File(temporaryFolder.getRoot(), "test.config"); try (OutputStream os = FileUtils.openOutputStream(config)) { ConfigurationHandler.write(os, p); } Properties p2 = BlobStoreFixtureProvider.loadConfig(config.getAbsolutePath()); assertEquals("bar", p2.getProperty("foo")); assertEquals(1, p2.get("a")); assertArrayEquals(new int[]{1, 2}, (int[]) p2.get("b")); }