From 236cfed61631352e9394632d80409cac62f31cc3 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 16 Feb 2012 22:31:40 +0000 Subject: Added a built-in update checker. See http://wiki.bukkit.org/Bukkit.yml#auto-updater for new bukkit.yml options. --- .../updater/BukkitDLUpdaterServiceTest.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java (limited to 'src/test/java/org/bukkit') diff --git a/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java b/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java new file mode 100644 index 00000000..701de3a3 --- /dev/null +++ b/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java @@ -0,0 +1,30 @@ +package org.bukkit.craftbukkit.updater; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import static org.junit.Assert.assertNotNull; +import org.junit.Test; + +public class BukkitDLUpdaterServiceTest { + @Test(expected=IOException.class) + public void testHostNotFound() throws UnsupportedEncodingException, IOException { + BukkitDLUpdaterService service = new BukkitDLUpdaterService("404.example.org"); + + service.fetchArtifact("rb"); + } + + @Test(expected=FileNotFoundException.class) + public void testArtifactNotFound() throws UnsupportedEncodingException, IOException { + BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org"); + + service.fetchArtifact("meep"); + } + + @Test + public void testArtifactExists() throws UnsupportedEncodingException, IOException { + BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org"); + + assertNotNull(service.fetchArtifact("latest-dev")); + } +} -- cgit v1.2.3