### Question:
BukkitDLUpdaterService { public ArtifactDetails fetchArtifact(String slug) throws IOException { URL url = new URL("http", host, API_PREFIX_ARTIFACT + slug + "/"); InputStreamReader reader = null; try { URLConnection connection = url.openConnection(); connection.setRequestProperty("User-Agent", getUserAgent()); reader = new InputStreamReader(connection.getInputStream()); Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, dateDeserializer).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); return gson.fromJson(reader, ArtifactDetails.class); } finally { if (reader != null) { reader.close(); } } } BukkitDLUpdaterService(String host); ArtifactDetails getArtifact(String slug, String name); ArtifactDetails fetchArtifact(String slug); ArtifactDetails.ChannelDetails getChannel(String slug, String name); ArtifactDetails.ChannelDetails fetchChannel(String slug);  }### Answer:
@Test(expected=IOException.class) public void testHostNotFound() throws IOException { BukkitDLUpdaterService service = new BukkitDLUpdaterService("404.example.org"); service.fetchArtifact("rb"); }
@Test(expected=FileNotFoundException.class) public void testArtifactNotFound() throws IOException { BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org"); service.fetchArtifact("meep"); }
@Test public void testArtifactExists() throws IOException { BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org"); assertThat(service.fetchArtifact("latest-dev"), is(not(nullValue()))); }