XmlFeedReader { public List parse(InputStream in) throws XmlPullParserException, IOException { try { XmlPullParser parser = Xml.newPullParser(); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false); parser.setInput(in, null); parser.nextTag(); return readFeed(parser); } finally { in.close(); } }  List parse(InputStream in);  }
@Test public void parse_HasTwoProject_ConvertToPOJO() throws Exception { InputStream stream = new ByteArrayInputStream(PROJECT_XML_2.getBytes()); List projects = new XmlFeedReader().parse(stream); assertThat(projects).hasSize(2).hasOnlyElementsOfType(Project.class); assertThatProjectParsedCorrectly((Project) projects.get(0)); }
@Test public void parse_HasSkipableTag_SkipOver() throws Exception { InputStream stream = new ByteArrayInputStream(PROJECT_XML_1_WITH_SKIP.getBytes()); List projects = new XmlFeedReader().parse(stream); assertThat(projects).hasSize(1).hasOnlyElementsOfType(Project.class); assertThatProjectParsedCorrectly((Project) projects.get(0)); }