@Test public void load() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Method loadMethod = Loader.class.getDeclaredMethod("load", File.class, PropFile.Loc.class, Map.class); loadMethod.setAccessible(true); File base; if (FileUtil.getCanonicalPath(new File("./")).contains("ply-util")) { base = new File("./"); } else { base = new File("ply-util/"); } File configurationDirectory = FileUtil.fromParts(base.getPath(), "src/test/resources/mock-prop-loader-files"); PropFile.Loc local = PropFile.Loc.Local; Map<Scope, Map<Context, PropFile>> propFiles = new ConcurrentHashMap<Scope, Map<Context, PropFile>>(); loadMethod.invoke(null, configurationDirectory, local, propFiles); assertTrue(propFiles.containsKey(Scope.Default)); assertTrue(propFiles.containsKey(Scope.named("test"))); assertEquals(2, propFiles.size()); Map<Context, PropFile> defaultContexts = propFiles.get(Scope.Default); assertEquals(1, defaultContexts.size()); PropFile loadedFiles = defaultContexts.get(Context.named("loader")); assertEquals("mock_value", loadedFiles.get("mock_key").value()); assertEquals("mock_value_2", loadedFiles.get("mock_key_2").value()); Map<Context, PropFile> testContexts = propFiles.get(Scope.named("test")); assertEquals(1, testContexts.size()); loadedFiles = testContexts.get(Context.named("loader")); assertEquals("mock_value_test", loadedFiles.get("mock_key").value()); assertEquals("mock_value_test_2", loadedFiles.get("mock_key_2").value()); propFiles.clear(); PropFile defaultFile = new PropFile(Context.named("loader"), PropFile.Loc.System); defaultFile.add("mock_key", "system_mock_value"); defaultFile.add("mock_key_2", "system_mock_value_2"); defaultFile.add("mock_key_3", "system_mock_value_3"); PropFile testFile = new PropFile(Context.named("loader"), Scope.named("test"), PropFile.Loc.System); testFile.add("mock_key", "system_mock_value_test"); testFile.add("mock_key_2", "system_mock_value_test_2"); testFile.add("mock_key_3", "system_mock_value_test_3"); Map<Context, PropFile> defaultSystemContexts = new ConcurrentHashMap<Context, PropFile>(2, 1.0f); defaultSystemContexts.put(Context.named("loader"), defaultFile); Map<Context, PropFile> testSystemContexts = new ConcurrentHashMap<Context, PropFile>(2, 1.0f); testSystemContexts.put(Context.named("loader"), testFile); propFiles.put(Scope.Default, defaultSystemContexts); propFiles.put(Scope.named("test"), testSystemContexts); loadMethod.invoke(null, configurationDirectory, local, propFiles); assertTrue(propFiles.containsKey(Scope.Default)); assertTrue(propFiles.containsKey(Scope.named("test"))); assertEquals(2, propFiles.size()); defaultSystemContexts = propFiles.get(Scope.Default); assertEquals(1, defaultSystemContexts.size()); assertTrue(defaultSystemContexts.containsKey(Context.named("loader"))); loadedFiles = defaultSystemContexts.get(Context.named("loader")); assertEquals("mock_value", loadedFiles.get("mock_key").value()); assertEquals("mock_value_2", loadedFiles.get("mock_key_2").value()); assertEquals("", loadedFiles.get("mock_key_3").value()); testSystemContexts = propFiles.get(Scope.named("test")); assertEquals(1, testSystemContexts.size()); assertTrue(testSystemContexts.containsKey(Context.named("loader"))); loadedFiles = testSystemContexts.get(Context.named("loader")); assertEquals("mock_value_test", loadedFiles.get("mock_key").value()); assertEquals("mock_value_test_2", loadedFiles.get("mock_key_2").value()); assertEquals("", loadedFiles.get("mock_key_3").value()); }
static Map<Scope, Map<Context, PropFileChain>> load(File configurationDirectory) { return load(configurationDirectory, false); }
Loader { static Map<Scope, Map<Context, PropFileChain>> load(File configurationDirectory) { return load(configurationDirectory, false); } }
Loader { static Map<Scope, Map<Context, PropFileChain>> load(File configurationDirectory) { return load(configurationDirectory, false); } private  Loader(); }
Loader { static Map<Scope, Map<Context, PropFileChain>> load(File configurationDirectory) { return load(configurationDirectory, false); } private  Loader();  }
Loader { static Map<Scope, Map<Context, PropFileChain>> load(File configurationDirectory) { return load(configurationDirectory, false); } private  Loader();   }