JAL-2520 unit test for improvement to download structure files from URL before parsing
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 9 May 2017 15:56:14 +0000 (16:56 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 9 May 2017 15:56:14 +0000 (16:56 +0100)
test/jalview/io/FileLoaderTest.java [new file with mode: 0644]

diff --git a/test/jalview/io/FileLoaderTest.java b/test/jalview/io/FileLoaderTest.java
new file mode 100644 (file)
index 0000000..0e21f6e
--- /dev/null
@@ -0,0 +1,24 @@
+package jalview.io;
+
+import org.junit.Assert;
+import org.testng.annotations.Test;
+
+public class FileLoaderTest
+{
+
+  @Test(groups = { "Network" })
+  public void testDownloadStructuresIfInputFromURL()
+  {
+    String urlFile = "http://www.jalview.org/builds/develop/examples/3W5V.pdb";
+    FileLoader fileLoader = new FileLoader();
+    fileLoader.LoadFileWaitTillLoaded(urlFile, DataSourceType.URL,
+            FileFormat.PDB);
+    Assert.assertNotNull(fileLoader.file);
+    // The FileLoader's file is expected to a temporary file different from the
+    // original URL.
+    Assert.assertNotEquals(urlFile, fileLoader.file);
+    // Data source type expected to be updated from DataSourceType.URL to
+    // DataSourceType.FILE
+    Assert.assertEquals(DataSourceType.FILE, fileLoader.protocol);
+  }
+}