String ext3_key = "hgext.two"; // check if found by "two" key
String hgrcContent = String.format("#comment\n[ui]\nusername = %s\n\n[paths]\n%s = %s\ndefault=%3$s\n\n[extensions]\n%s = \n%s = !\n%s=\n", username, path1_key, path1_value, ext1_key, ext2_key, ext3_key);
RepoUtils.createFile(hgrc, hgrcContent);
//
HgRepository repo = new HgLookup().detect(repoLoc);
final HgRepoConfig cfg = repo.getConfiguration();
assertNotNull(cfg.getPaths());
assertNotNull(cfg.getExtensions());
final Section dne = cfg.getSection("does-not-exist");
assertNotNull(dne);
assertFalse(dne.exists());
assertEquals(username, cfg.getSection("ui").getString("username", null));
final PathsSection p = cfg.getPaths();
assertTrue(p.getPathSymbolicNames().contains(path1_key));
assertEquals(path1_value, p.getString(path1_key, null));
assertTrue(p.hasDefault());
assertEquals(path1_value, p.getDefault());
assertFalse(p.hasDefault() ^ p.getDefault() != null);
assertFalse(p.hasDefaultPush() ^ p.getDefaultPush() != null);
final ExtensionsSection e = cfg.getExtensions();
assertTrue(e.isEnabled(ext1_key));
assertTrue(e.getString(ext2_key, null).length() > 0);
assertFalse(e.isEnabled(ext2_key));
assertNotNull(e.getString(ext3_key, null));
assertTrue(e.isEnabled(ext3_key.substring("hgext.".length())));