diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-06-27 13:35:39 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-06-27 13:35:39 +0100 |
commit | 16d0b5c228dd8d981a0d79944c70248ea813d63b (patch) | |
tree | b76e6966bfc2b4b9b668b89b13e30307e0b81988 /EssentialsUpdate/test/com/ess3/update | |
parent | c1230bd6ae4e17539e1f6f2c82691fa7a8395e8c (diff) | |
download | Essentials-16d0b5c228dd8d981a0d79944c70248ea813d63b.tar Essentials-16d0b5c228dd8d981a0d79944c70248ea813d63b.tar.gz Essentials-16d0b5c228dd8d981a0d79944c70248ea813d63b.tar.lz Essentials-16d0b5c228dd8d981a0d79944c70248ea813d63b.tar.xz Essentials-16d0b5c228dd8d981a0d79944c70248ea813d63b.zip |
package name change to net.ess3
Diffstat (limited to 'EssentialsUpdate/test/com/ess3/update')
-rw-r--r-- | EssentialsUpdate/test/com/ess3/update/UploadTest.java | 28 | ||||
-rw-r--r-- | EssentialsUpdate/test/com/ess3/update/VersionTest.java | 87 |
2 files changed, 115 insertions, 0 deletions
diff --git a/EssentialsUpdate/test/com/ess3/update/UploadTest.java b/EssentialsUpdate/test/com/ess3/update/UploadTest.java new file mode 100644 index 000000000..4b26e644a --- /dev/null +++ b/EssentialsUpdate/test/com/ess3/update/UploadTest.java @@ -0,0 +1,28 @@ +package com.ess3.update; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import junit.framework.TestCase; +import net.ess3.update.PastieUpload; +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/ess3/update/VersionTest.java b/EssentialsUpdate/test/com/ess3/update/VersionTest.java new file mode 100644 index 000000000..af35dc2dd --- /dev/null +++ b/EssentialsUpdate/test/com/ess3/update/VersionTest.java @@ -0,0 +1,87 @@ +package com.ess3.update; + +import net.ess3.update.Version.Type; +import java.util.TreeSet; +import junit.framework.TestCase; +import net.ess3.update.Version; +import org.junit.Test; + + +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("Unknown"); + 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() + { + final Version verA = new Version("1.1.1"); + final Version verB = new Version("Dev1.1.2"); + final Version verC = new Version("1.1.2"); + final Version verD = new Version("1.2.0"); + final Version verE = new Version("2.0.0"); + final Version verF = new Version("Pre1.1.1.1"); + final Version verG = new Version("Dev1.2.2"); + assertTrue("Testing dev", verA.compareTo(verB) < 0); + assertTrue("Testing dev", verB.compareTo(verA) > 0); + assertTrue("Testing build", verA.compareTo(verC) < 0); + assertTrue("Testing build", verC.compareTo(verA) > 0); + assertTrue("Testing minor", verA.compareTo(verD) < 0); + assertTrue("Testing minor", verD.compareTo(verA) > 0); + assertTrue("Testing major", verA.compareTo(verE) < 0); + assertTrue("Testing major", verE.compareTo(verA) > 0); + assertTrue("Testing pre", verF.compareTo(verA) < 0); + assertTrue("Testing pre", verA.compareTo(verF) > 0); + assertTrue("Testing dev vs dev", verB.compareTo(verG) < 0); + assertTrue("Testing dev vs dev", verG.compareTo(verB) > 0); + final TreeSet<Version> set = new TreeSet<Version>(); + set.add(verA); + set.add(verB); + set.add(verC); + set.add(verD); + set.add(verE); + set.add(verF); + set.add(verG); + assertEquals("Testing sorting", verF, set.pollFirst()); + assertEquals("Testing sorting", verA, set.pollFirst()); + assertEquals("Testing sorting", verC, set.pollFirst()); + assertEquals("Testing sorting", verD, set.pollFirst()); + assertEquals("Testing sorting", verE, set.pollFirst()); + assertEquals("Testing sorting", verB, set.pollFirst()); + assertEquals("Testing sorting", verG, set.pollFirst()); + } +} |