### Question:
ResourcesMappingParser { public ResourcesMapping parse() throws IOException { ResourcesMapping mapping = new ResourcesMapping(); FileReader fr = new FileReader(mappingPath.toFile()); BufferedReader br = new BufferedReader(fr); String line = br.readLine(); while (line != null) { if (line.length() <= 0) { line = br.readLine(); continue; } if (!line.contains(":")) { Matcher mat = MAP_DIR_PATTERN.matcher(line); if (mat.find()) { String rawName = mat.group(1).trim(); String obfuscateName = mat.group(2).trim(); if (!line.contains("/") || line.contains(".")) { throw new IllegalArgumentException("Unexpected resource dir: " + line); } mapping.putDirMapping(rawName, obfuscateName); } } else { Matcher mat = MAP_RES_PATTERN.matcher(line); if (mat.find()) { String rawName = mat.group(2).trim(); String obfuscateName = mat.group(3).trim(); if (line.contains("/")) { mapping.putEntryFileMapping(rawName, obfuscateName); } else { int packagePos = rawName.indexOf(".R."); if (packagePos == -1) { throw new IllegalArgumentException(String.format("the mapping file packageName is malformed, " + "it should be like com.bytedance.android.ugc.R.attr.test, yours %s\n", rawName )); } mapping.putResourceMapping(rawName, obfuscateName); } } } line = br.readLine(); } br.close(); fr.close(); return mapping; } ResourcesMappingParser(Path mappingPath); ResourcesMapping parse();  }### Answer:
@Test public void test() throws IOException { ResourcesMappingParser parser = new ResourcesMappingParser(loadResourceFile("demo/mapping.txt").toPath()); ResourcesMapping mapping = parser.parse(); assert !mapping.getDirMapping().isEmpty(); assert !mapping.getResourceMapping().isEmpty(); }