diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java | 24 |
1 files changed, 24 insertions, 0 deletions
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<GitoriousProject> 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()); + } + } +} |