### Question:
MySQLConfig implements ConfigLoader { public void load (File file) throws IOException { if (file == null) { throw new NullPointerException("file cannot be null."); } if (!file.exists()) { throw new IllegalStateException("mysql config file doesnt exists: " + file.getAbsolutePath()); } LocalLogger.print("load mysql configuration " + file.getName()); Ini ini = new Ini(file); Profile.Section section = ini.get("MySQL"); this.host = section.getOrDefault("host", "locahost"); this.port = getInt(section, "port"); this.database = section.get("database"); this.user = section.getOrDefault("user", ""); this.password = section.get("password"); this.prefix = section.getOrDefault("prefix", ""); this.maxPoolSize = Integer.parseInt(section.getOrDefault("max_pool_size", "30")); this.prepStmtCacheSize = Integer.parseInt(section.getOrDefault("prepStmtCacheSize", "250")); this.prepStmtCacheSqlLimit = Integer.parseInt(section.getOrDefault("prepStmtCacheSqlLimit", "2048")); } MySQLConfig(); void load(File file); String getHost(); int getPort(); String getDatabase(); String getUser(); String getPassword(); String getPrefix(); void setPrefix(String prefix); int getMaxPoolSize(); String getJDBCUrl(); int getPrepStmtCacheSize(); int getPrepStmtCacheSqlLimit();  }### Answer:
@Test (expected = NullPointerException.class) public void testLoadNullFile () throws IOException { new MySQLConfig().load(null); }
@Test (expected = IllegalStateException.class) public void testLoadNotExistentFile () throws IOException { new MySQLConfig().load(new File("not-existent-file.cfg")); }
@Test public void testLoad () throws IOException { MySQLConfig mySQLConfig = new MySQLConfig(); mySQLConfig.load(new File("../config/mysql.example.cfg")); assertEquals("localhost", mySQLConfig.getHost()); assertEquals(3306, mySQLConfig.getPort()); assertEquals("db1", mySQLConfig.getDatabase()); assertEquals("root", mySQLConfig.getUser()); assertEquals("testpass", mySQLConfig.getPassword()); assertEquals("mmo_", mySQLConfig.getPrefix()); assertEquals(30, mySQLConfig.getMaxPoolSize()); assertEquals(true, mySQLConfig.getJDBCUrl().startsWith("jdbc:mysql: assertEquals(250, mySQLConfig.getPrepStmtCacheSize()); assertEquals(2048, mySQLConfig.getPrepStmtCacheSqlLimit()); }