### Question:
XPathParser { public XNode evalNode(String expression) { return evalNode(document, expression); } XPathParser(String xml);  XPathParser(Reader reader);  XPathParser(InputStream inputStream);  XPathParser(Document document);  XPathParser(String xml, boolean validation);  XPathParser(Reader reader, boolean validation);  XPathParser(InputStream inputStream, boolean validation);  XPathParser(Document document, boolean validation);  XPathParser(String xml, boolean validation, Properties variables);  XPathParser(Reader reader, boolean validation, Properties variables);  XPathParser(InputStream inputStream, boolean validation, Properties variables);  XPathParser(Document document, boolean validation, Properties variables);  XPathParser(String xml, boolean validation, Properties variables, EntityResolver entityResolver);  XPathParser(Reader reader, boolean validation, Properties variables, EntityResolver entityResolver);  XPathParser(InputStream inputStream, boolean validation, Properties variables, EntityResolver entityResolver);  XPathParser(Document document, boolean validation, Properties variables, EntityResolver entityResolver); void setVariables(Properties variables); String evalString(String expression); String evalString(Object root, String expression); Boolean evalBoolean(String expression); Boolean evalBoolean(Object root, String expression); Short evalShort(String expression); Short evalShort(Object root, String expression); Integer evalInteger(String expression); Integer evalInteger(Object root, String expression); Long evalLong(String expression); Long evalLong(Object root, String expression); Float evalFloat(String expression); Float evalFloat(Object root, String expression); Double evalDouble(String expression); Double evalDouble(Object root, String expression); List<XNode> evalNodes(String expression); List<XNode> evalNodes(Object root, String expression); XNode evalNode(String expression); XNode evalNode(Object root, String expression);  }### Answer:
@Test public void formatXNodeToString() { XPathParser parser = new XPathParser("<users><user><id>100</id><name>Tom</name><age>30</age><cars><car>BMW</car><car>Audi</car><car>Benz</car></cars></user></users>"); String usersNodeToString = parser.evalNode("/users").toString(); String userNodeToString = parser.evalNode("/users/user").toString(); String carsNodeToString = parser.evalNode("/users/user/cars").toString(); String usersNodeToStringExpect = "<users>\n" + " <user>\n" + " <id>100</id>\n" + " <name>Tom</name>\n" + " <age>30</age>\n" + " <cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + " </cars>\n" + " </user>\n" + "</users>\n"; String userNodeToStringExpect = "<user>\n" + " <id>100</id>\n" + " <name>Tom</name>\n" + " <age>30</age>\n" + " <cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + " </cars>\n" + "</user>\n"; String carsNodeToStringExpect = "<cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + "</cars>\n"; assertEquals(usersNodeToStringExpect, usersNodeToString); assertEquals(userNodeToStringExpect, userNodeToString); assertEquals(carsNodeToStringExpect, carsNodeToString); }