X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Futils%2FUrlDownloadClientTest.java;fp=test%2Fjalview%2Fws%2Futils%2FUrlDownloadClientTest.java;h=0000000000000000000000000000000000000000;hb=4f77328104498504339216829abf5ea87e2791ec;hp=2bd8dd0ae5a45489682c1fde6b9384e48145378c;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/test/jalview/ws/utils/UrlDownloadClientTest.java b/test/jalview/ws/utils/UrlDownloadClientTest.java deleted file mode 100644 index 2bd8dd0..0000000 --- a/test/jalview/ws/utils/UrlDownloadClientTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -package jalview.ws.utils; - -import java.io.File; -import java.io.IOException; - -import org.testng.Assert; -import org.testng.annotations.Test; - -public class UrlDownloadClientTest { - - /** - * Test that url is successfully loaded into download file - */ - @Test(groups = { "Network" }, enabled = true) - public void UrlDownloadTest() - { - UrlDownloadClient client = new UrlDownloadClient(); - String urlstring = "http://identifiers.org/rest/collections/"; - String outfile = "testfile.tmp"; - - try - { - client.download(urlstring, outfile); - } catch (IOException e) - { - Assert.fail("Exception was thrown from UrlDownloadClient download: " - + e.getMessage()); - File f = new File(outfile); - if (f.exists()) - { - f.delete(); - } - } - - // download file exists - File f = new File(outfile); - Assert.assertTrue(f.exists()); - - // download file has a believable size - // identifiers.org file typically at least 250K - Assert.assertTrue(f.length() > 250000); - - if (f.exists()) - { - f.delete(); - } - - } - - /** - * Test that garbage in results in IOException - */ - @Test( - groups = { "Network" }, - enabled = true, - expectedExceptions = { IOException.class }) - public void DownloadGarbageUrlTest() throws IOException - { - UrlDownloadClient client = new UrlDownloadClient(); - String urlstring = "identifiers.org/rest/collections/"; - String outfile = "testfile.tmp"; - - client.download(urlstring, outfile); - } -}