JAL-2520 unit test for improvement to download structure files from URL before parsing
[jalview.git] / test / jalview / io / FileLoaderTest.java
1 package jalview.io;
2
3 import org.junit.Assert;
4 import org.testng.annotations.Test;
5
6 public class FileLoaderTest
7 {
8
9   @Test(groups = { "Network" })
10   public void testDownloadStructuresIfInputFromURL()
11   {
12     String urlFile = "http://www.jalview.org/builds/develop/examples/3W5V.pdb";
13     FileLoader fileLoader = new FileLoader();
14     fileLoader.LoadFileWaitTillLoaded(urlFile, DataSourceType.URL,
15             FileFormat.PDB);
16     Assert.assertNotNull(fileLoader.file);
17     // The FileLoader's file is expected to a temporary file different from the
18     // original URL.
19     Assert.assertNotEquals(urlFile, fileLoader.file);
20     // Data source type expected to be updated from DataSourceType.URL to
21     // DataSourceType.FILE
22     Assert.assertEquals(DataSourceType.FILE, fileLoader.protocol);
23   }
24 }