| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.io; |
| 22 |
|
|
| 23 |
|
import static org.testng.Assert.assertEquals; |
| 24 |
|
|
| 25 |
|
import jalview.bin.Cache; |
| 26 |
|
|
| 27 |
|
import org.junit.Assert; |
| 28 |
|
import org.testng.annotations.Test; |
| 29 |
|
|
| |
|
| 68.2% |
Uncovered Elements: 7 (22) |
Complexity: 3 |
Complexity Density: 0.17 |
|
| 30 |
|
public class FileLoaderTest |
| 31 |
|
{ |
| 32 |
|
|
| |
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
4-
|
|
| 33 |
0 |
@Test(groups = { "Network" })... |
| 34 |
|
public void testDownloadStructuresIfInputFromURL() |
| 35 |
|
{ |
| 36 |
0 |
String urlFile = "http://www.jalview.org/builds/develop/examples/3W5V.pdb"; |
| 37 |
0 |
FileLoader fileLoader = new FileLoader(); |
| 38 |
0 |
fileLoader.LoadFileWaitTillLoaded(urlFile, DataSourceType.URL, |
| 39 |
|
FileFormat.PDB); |
| 40 |
0 |
Assert.assertNotNull(fileLoader.file); |
| 41 |
|
|
| 42 |
0 |
Assert.assertEquals(urlFile, fileLoader.file); |
| 43 |
|
|
| 44 |
0 |
Assert.assertEquals(DataSourceType.URL, fileLoader.protocol); |
| 45 |
|
} |
| 46 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
1PASS
|
|
| 47 |
1 |
@Test(groups = "Functional")... |
| 48 |
|
public void testUpdateRecentlyOpened() |
| 49 |
|
{ |
| 50 |
|
|
| 51 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
| 52 |
|
|
| 53 |
1 |
String recent = "RECENT_FILE"; |
| 54 |
1 |
Cache.removeProperty(recent); |
| 55 |
|
|
| 56 |
1 |
String prop = FileLoader.updateRecentlyOpened("a/b/c", |
| 57 |
|
DataSourceType.FILE); |
| 58 |
1 |
assertEquals(prop, "a/b/c"); |
| 59 |
|
|
| 60 |
1 |
prop = FileLoader.updateRecentlyOpened("d/e/f", DataSourceType.FILE); |
| 61 |
1 |
assertEquals(prop, "d/e/f\ta/b/c"); |
| 62 |
|
|
| 63 |
|
|
| 64 |
1 |
prop = FileLoader.updateRecentlyOpened("a/b/c", DataSourceType.FILE); |
| 65 |
1 |
assertEquals(prop, "a/b/c\td/e/f"); |
| 66 |
|
|
| 67 |
|
|
| 68 |
21 |
for (int i = 0; i < 20; i++) |
| 69 |
|
{ |
| 70 |
20 |
prop = FileLoader.updateRecentlyOpened(String.format("%d.fa", i), |
| 71 |
|
DataSourceType.FILE); |
| 72 |
|
} |
| 73 |
1 |
assertEquals(prop, |
| 74 |
|
"19.fa\t18.fa\t17.fa\t16.fa\t15.fa\t14.fa\t13.fa\t12.fa\t11.fa\t10.fa\t9.fa"); |
| 75 |
|
} |
| 76 |
|
} |