DashManifestParser extends DefaultHandler implements ParsingLoadable.Parser<DashManifest> { protected String parseLabel(XmlPullParser xpp) throws XmlPullParserException, IOException { return parseText(xpp, "Label"); } DashManifestParser(); @Override DashManifest parse(Uri uri, InputStream inputStream); static void maybeSkipTag(XmlPullParser xpp);  }
@Test public void parseLabel() throws Exception { DashManifestParser parser = new DashManifestParser(); XmlPullParser xpp = XmlPullParserFactory.newInstance().newPullParser(); xpp.setInput(new StringReader("<Label>test label</Label>" + NEXT_TAG)); xpp.next(); String label = parser.parseLabel(xpp); assertThat(label).isEqualTo("test label"); assertNextTag(xpp); }
@Test public void parseLabel_noText() throws Exception { DashManifestParser parser = new DashManifestParser(); XmlPullParser xpp = XmlPullParserFactory.newInstance().newPullParser(); xpp.setInput(new StringReader("<Label/>" + NEXT_TAG)); xpp.next(); String label = parser.parseLabel(xpp); assertThat(label).isEqualTo(""); assertNextTag(xpp); }