### Question:
Config { public static void loadDir (File dir) throws IOException { if (!dir.exists()) { throw new IllegalStateException("config directory doesn't exists: " + dir.getAbsolutePath()); } if (!dir.isDirectory()) { throw new IllegalArgumentException("dir isn't a directory!"); } File[] files = dir.listFiles(); for (File file : files) { if (!file.isFile()) { continue; } if (!file.getName().endsWith(".cfg") && !file.getName().endsWith(".ini")) { Log.v(LOG_TAG, "skip file: " + file.getAbsolutePath()); continue; } Config.load(file); } } protected  Config(); static void load(File file); static void load(File file, boolean skipExampleConfig); static void loadDir(File dir); static String get(String section, String key); static String getOrDefault(String section, String key, String defaultValue); static boolean getBool(String section, String key); static int getInt(String section, String key); static float getFloat(String section, String key); static void set(String section, String key, String value); static void reload(); static void clear(); static boolean forceExit; }### Answer:
@Test (expected = IllegalStateException.class) public void testLoadNotExistentDir () throws IOException { Config.loadDir(new File("../not-existent-dir/")); }
@Test (expected = IllegalArgumentException.class) public void testLoadDirWithFile () throws IOException { Config.loadDir(new File("../config/game.cfg")); }
@Test public void testLoadDir () throws IOException { Config.loadDir(new File("../config/")); }
@Test public void testLoadDir1 () throws IOException { new File("../data/junit/config/test/").mkdirs(); Config.loadDir(new File("../data/junit/config/")); }