### Question:
XmlTool { public static Optional<String> modifyElement(String xml, String elementTag, String newValue) throws IOException, TransformerException, ParserConfigurationException, SAXException { if (xml == null || xml.isEmpty()) { return Optional.empty(); } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); dbFactory.setFeature("http: dbFactory.setFeature("http: DocumentBuilder db = dbFactory.newDocumentBuilder(); InputSource source = new InputSource(new StringReader(xml)); Document doc = db.parse(source); Node modNode = doc.getElementsByTagName(elementTag).item(0); if (modNode == null) { return Optional.empty(); } else { modNode.setTextContent(newValue); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); StringWriter writer = new StringWriter(); transformer.transform(new DOMSource(doc), new StreamResult(writer)); return Optional.of(writer.toString().trim()); } private  XmlTool(); static String normalize(Object xml); static String encode(Object value); static String removePreamble(Object xml); static String removeNamespaces(Object xml); static Optional<String> modifyElement(String xml, String elementTag, String newValue);  }### Answer:
@Test public void modifyElementTest() throws Exception { String response = XmlTool.modifyElement(content, "event-type", "uCPE-VMS").get(); assertNotNull(response); }