From d6a532c420a93b211a9747c5fb807a3f2767fa22 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 8 Nov 2012 13:20:47 +0100 Subject: o Slurping down the entire list of projects. --- .../esper/testing/gitorious/TestXmlParsing.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java (limited to 'src/test/java/io/trygvis/esper') diff --git a/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java b/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java new file mode 100644 index 0000000..63ae319 --- /dev/null +++ b/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java @@ -0,0 +1,24 @@ +package io.trygvis.esper.testing.gitorious; + +import junit.framework.*; +import org.dom4j.*; + +import java.io.*; +import java.util.*; + +public class TestXmlParsing extends TestCase { + public void testProjectParsing() throws Exception { + try (InputStream stream = getClass().getResourceAsStream("/gitorious/projects-2.xml")) { + Document document = GitoriousClient.xmlReader.readDocument(stream); + + List projects = GitoriousProject.projectsFromXml("http://gitorious.org", document.getRootElement()); + + assertNotNull(projects); + assertEquals(20, projects.size()); + + GitoriousProject project = projects.get(3); + assertEquals("aed-ii", project.slug); + assertEquals(2, project.repositories.size()); + } + } +} -- cgit v1.2.3