diff options
Diffstat (limited to 'src/test/java/io/trygvis')
-rw-r--r-- | src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java | 26 |
1 files changed, 26 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 index 2d5945e..a6ba2f7 100644 --- a/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java +++ b/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java @@ -1,10 +1,12 @@ package io.trygvis.esper.testing.gitorious; +import fj.data.*; import junit.framework.*; import org.dom4j.*; import java.io.*; import java.util.*; +import java.util.List; public class TestXmlParsing extends TestCase { public void testProjectParsing() throws Exception { @@ -21,4 +23,28 @@ public class TestXmlParsing extends TestCase { assertEquals(2, project.repositories.size()); } } + + public void testEventParsing() throws Exception { + GitoriousAtomFeedParser parser = new GitoriousAtomFeedParser(); + try (InputStream stream = getClass().getResourceAsStream("/gitorious/esper-test-project.atom")) { + + List<GitoriousEvent> events = parser.parseStream(stream, Option.<Date>none(), "esper-test-project", "esper-test-project"); + + assertEquals(5, events.size()); + + GitoriousPush p0 = (GitoriousPush) events.get(0); + assertEquals("tag:gitorious.org,2005:Event/43390557", p0.entryId); + assertEquals("trygvis", p0.who); + assertEquals("dd6f41a45587f3f4d81ba7c0a874fcaf94e67365", p0.from); + assertEquals("0d3de9c126c6f84e46e3f92244b4d99a4a3a3aa5", p0.to); + assertEquals("my-branch", p0.branch); + + GitoriousPush p3 = (GitoriousPush) events.get(3); + assertEquals("tag:gitorious.org,2005:Event/43390409", p3.entryId); + assertEquals("trygvis", p3.who); + assertEquals("7054468bc18ae6e66aeccecc87896a90b21f2101", p3.from); + assertEquals("4aa8a70c00a9527035e3f9b2fb69bbc4779aa090", p3.to); + assertEquals("master", p3.branch); + } + } } |