### Question:
FeatureParser { public ParsedFeature parse(Uri parent, String xml) throws GadgetException { Element doc; try { doc = XmlUtil.parse(xml); } catch (XmlException e) { throw new GadgetException(GadgetException.Code.MALFORMED_XML_DOCUMENT, e); } String name = null; List<String> deps = Lists.newArrayList(); List<ParsedFeature.Bundle> bundles = Lists.newArrayList(); NodeList children = doc.getChildNodes(); for (int i = 0, j = children.getLength(); i < j; ++i) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element)child; if (element.getTagName().equals("name")) { name = element.getTextContent(); } else if (element.getTagName().equals("dependency")) { deps.add(element.getTextContent()); } else { String type = element.getTagName().toLowerCase(); List<ParsedFeature.Resource> resources = Lists.newArrayList(); NodeList resourceKids = element.getElementsByTagName("script"); for (int x = 0, y = resourceKids.getLength(); x < y; ++x) { Element resourceChild = (Element)resourceKids.item(x); String src = resourceChild.getAttribute("src"); String content = resourceChild.getTextContent(); Map<String, String> attribs = getAttribs(resourceChild); Uri source = null; if (src != null && src.length() > 0) { if (!"false".equals(attribs.get("inline"))) { source = parent.resolve(FeatureRegistry.getComponentUri(src)); } else { source = Uri.parse(src); } } resources.add(new ParsedFeature.Resource( source, src != null && src.length() != 0 ? null : content, getAttribs(resourceChild))); } bundles.add(new ParsedFeature.Bundle(type, getAttribs(element), resources)); } } } return new ParsedFeature(name, deps, bundles); }  ParsedFeature parse(Uri parent, String xml);  }### Answer:
@Test(expected=GadgetException.class) public void parseInvalidXml() throws GadgetException { new FeatureParser().parse(Uri.parse(""), "This is not valid XML."); }