diff options
author | snowleo <schneeleo@gmail.com> | 2011-10-12 03:14:07 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-10-12 03:14:26 +0200 |
commit | 860d446d28776ec842fa53e8e08538d4e093d6e9 (patch) | |
tree | 0c4598eae4eb8c59fd36e8312eab1b27a8018794 /EssentialsUpdate/test/com/earth2me | |
parent | 9ec398b39b0f48392a9d635041b392c7dba2ca0c (diff) | |
download | Essentials-860d446d28776ec842fa53e8e08538d4e093d6e9.tar Essentials-860d446d28776ec842fa53e8e08538d4e093d6e9.tar.gz Essentials-860d446d28776ec842fa53e8e08538d4e093d6e9.tar.lz Essentials-860d446d28776ec842fa53e8e08538d4e093d6e9.tar.xz Essentials-860d446d28776ec842fa53e8e08538d4e093d6e9.zip |
EssentialsUpdate WIP
Diffstat (limited to 'EssentialsUpdate/test/com/earth2me')
-rw-r--r-- | EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java | 27 | ||||
-rw-r--r-- | EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java | 87 |
2 files changed, 114 insertions, 0 deletions
diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java b/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java new file mode 100644 index 000000000..a51f03bd7 --- /dev/null +++ b/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java @@ -0,0 +1,27 @@ +package com.earth2me.essentials.update; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import junit.framework.TestCase; +import org.junit.Test; + + +public class UploadTest extends TestCase +{ + @Test + public void testPastieUpload() + { + try + { + final PastieUpload pastie = new PastieUpload(); + assertNotNull(pastie); + //final String url = pastie.send("test"); + //System.out.println(url); + } + catch (IOException ex) + { + Logger.getLogger(UploadTest.class.getName()).log(Level.SEVERE, null, ex); + } + } +} diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java b/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java new file mode 100644 index 000000000..901a8f9dc --- /dev/null +++ b/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java @@ -0,0 +1,87 @@ +package com.earth2me.essentials.update; + +import com.earth2me.essentials.update.Version.Type; +import java.util.TreeSet; +import junit.framework.TestCase; +import org.junit.Test; +import static org.junit.Assert.*; + + +public class VersionTest extends TestCase +{ + @Test + public void testStable() + { + final Version instance = new Version("1.2.3"); + assertEquals("Testing Major", 1, instance.getMajor()); + assertEquals("Testing Minor", 2, instance.getMinor()); + assertEquals("Testing Build", 3, instance.getBuild()); + assertEquals("Testing Type", Type.STABLE, instance.getType()); + } + + @Test + public void testDev() + { + final Version instance = new Version("Dev2.3.4"); + assertEquals("Testing Major", 2, instance.getMajor()); + assertEquals("Testing Minor", 3, instance.getMinor()); + assertEquals("Testing Build", 4, instance.getBuild()); + assertEquals("Testing Type", Type.DEVELOPER, instance.getType()); + } + + @Test + public void testTeamCity() + { + final Version instance = new Version("Teamcity"); + assertEquals("Testing Type", Type.DEVELOPER, instance.getType()); + } + + @Test + public void testPre() + { + final Version instance = new Version("Pre5.7.400.2"); + assertEquals("Testing Major", 5, instance.getMajor()); + assertEquals("Testing Minor", 7, instance.getMinor()); + assertEquals("Testing Build", 400, instance.getBuild()); + assertEquals("Testing Type", Type.PREVIEW, instance.getType()); + } + + @Test + public void testCompareTo() + { + Version a = new Version("1.1.1"); + Version b = new Version("Dev1.1.2"); + Version c = new Version("1.1.2"); + Version d = new Version("1.2.0"); + Version e = new Version("2.0.0"); + Version f = new Version("Pre1.1.1.1"); + Version g = new Version("Dev1.2.2"); + assertTrue("Testing dev", a.compareTo(b) < 0); + assertTrue("Testing dev", b.compareTo(a) > 0); + assertTrue("Testing build", a.compareTo(c) < 0); + assertTrue("Testing build", c.compareTo(a) > 0); + assertTrue("Testing minor", a.compareTo(d) < 0); + assertTrue("Testing minor", d.compareTo(a) > 0); + assertTrue("Testing major", a.compareTo(e) < 0); + assertTrue("Testing major", e.compareTo(a) > 0); + assertTrue("Testing pre", f.compareTo(a) < 0); + assertTrue("Testing pre", a.compareTo(f) > 0); + assertTrue("Testing dev vs dev", b.compareTo(g) < 0); + assertTrue("Testing dev vs dev", g.compareTo(b) > 0); + final TreeSet<Version> set = new TreeSet<Version>(); + set.add(a); + set.add(b); + set.add(c); + set.add(d); + set.add(e); + set.add(f); + set.add(g); + assertEquals("Testing sorting", f, set.pollFirst()); + assertEquals("Testing sorting", a, set.pollFirst()); + assertEquals("Testing sorting", c, set.pollFirst()); + assertEquals("Testing sorting", d, set.pollFirst()); + assertEquals("Testing sorting", e, set.pollFirst()); + assertEquals("Testing sorting", b, set.pollFirst()); + assertEquals("Testing sorting", g, set.pollFirst()); + } +} |