ParsedPage { public ParsedPage(){ this.superSection = new SectionContainer(null,0); } ParsedPage(); void setName( String name ); String getName(); void setPageId( int pageId ); int getPageId(); void setCategoryElement( ContentElement categories ); ContentElement getCategoryElement(); List<Link> getCategories(); void setFirstParagraphNr(int nr); int getFirstParagraphNr(); Paragraph getFirstParagraph(); void setLanguagesElement( ContentElement languages ); ContentElement getLanguagesElement(); List<Link> getLanguages(); void setSections( List<Section> sections ); void setSections( SectionContainer s ); Section getSection(int i); List<Section> getSections(); String toString(); int nrOfParagraphs(); Paragraph getParagraph(int i); List<Paragraph> getParagraphs(); int nrOfTables(); Table getTable(int i); List<Table> getTables(); int nrOfNestedLists(); NestedList getNestedList(int i); List<NestedListContainer> getNestedLists(); int nrOfDefinitionLists(); DefinitionList getDefinitionList(int i); List<DefinitionList> getDefinitionLists(); String getText(); int length(); List<FormatType> getFormats(); List<Span> getFormatSpans(FormatType t); List<Link> getLinks(); List<Template> getTemplates();  }
@Test public void testParsedPage(){ String title = "Wikipedia API"; Page p = null; try { p = wiki.getPage(title); } catch (WikiApiException e) { e.printStackTrace(); fail("A WikiApiException occurred while getting the page " + title); } String text = "Wikipedia API ist die wichtigste Software überhaupt." + LF + "Wikipedia API. Nicht zu übertreffen. Unglaublich http: MediaWikiParserFactory pf = new MediaWikiParserFactory(Language.english); MediaWikiParser parser = pf.createParser(); ParsedPage pp = parser.parse(p.getText()); assertNotNull(pp); int i=0; for (Link link : pp.getSection(0).getLinks()) { if (i==0) { assertEquals("Software", link.getText()); } else if (i==1) { assertEquals("Wikipedia API", link.getText()); assertEquals("JWPL", link.getTarget()); } i++; } String parsedPageText = pp.getText(); assertNotNull(parsedPageText); assertEquals(text, parsedPageText); }