### Question:
MathMLUtils { public static Multiset<String> extractIdentifiersFromMathML(String mathML, Boolean useTeXIdentifiers, boolean useBlacklist) { try { return tryParseWithXpath(mathML, useTeXIdentifiers, useBlacklist); } catch (Exception e) { LOGGER.warn("exception occurred while trying to parse mathML with xpath... " + "backing off to the regexp parser.", e); return parseWithRegex(mathML); } }  static String getEngine(); static void setEngine(String engine); static Multiset<String> extractIdentifiers(MathTag math, Boolean useTeXIdentifiers, String url); static Multiset<String> extractIdentifiersFromTex(String tex, boolean useTeX, String url); static Multiset<String> extractIdentifiersFromMathML(String mathML, Boolean useTeXIdentifiers, boolean useBlacklist); static boolean isNumeric(String id); static String texToMathML(String tex); static String cleanTexString(String tex); final static Set<String> BLACKLIST; }### Answer:
@Test public void extractFromMathML_notParsable() throws Exception { String mathML = readResource("math-xmlparsingerror.xml"); Set<String> identifiers = MathMLUtils.extractIdentifiersFromMathML(mathML, false, false).elementSet(); Set<String> expected = ImmutableSet.of("x", "b", "c"); assertEquals(expected, identifiers); }
@Test public void extractFromMathML_complextMsub_noSubCaptured() throws Exception { String mathML = readResource("complex_msub.xml"); Set<String> identifiers = MathMLUtils.extractIdentifiersFromMathML(mathML, false, false).elementSet(); identifiers.forEach(id -> assertFalse(id.contains("_"))); }
@Test public void extractFromMathMl_identifiersFromMSub_notCaptured() throws Exception { String mathML = readResource("math-R_specific.xml"); Set<String> identifiers = MathMLUtils.extractIdentifiersFromMathML(mathML, false, false).elementSet(); Set<String> expected = ImmutableSet.of("R_specific", "R", "M"); assertFalse(identifiers.contains("specific")); assertEquals(expected, identifiers); }