summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java
blob: 701de3a3c5ab07db8ffb87c9027f8168d3aef49e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"));
    }
}