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 java.io.File; |
24 |
|
import java.io.IOException; |
25 |
|
import java.nio.file.Files; |
26 |
|
import java.nio.file.StandardCopyOption; |
27 |
|
|
28 |
|
import org.testng.Assert; |
29 |
|
import org.testng.annotations.AfterClass; |
30 |
|
import org.testng.annotations.BeforeClass; |
31 |
|
import org.testng.annotations.Test; |
32 |
|
|
33 |
|
import jalview.datamodel.AlignmentI; |
34 |
|
import jalview.gui.AlignFrame; |
35 |
|
import jalview.gui.JvOptionPane; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 3 |
Complexity Density: 0.25 |
|
48 |
|
public class WindowsFileLoadAndSaveTest |
49 |
|
{ |
50 |
|
|
51 |
|
private final static String fileName = "examples" + File.separator |
52 |
|
+ "uniref50.fa"; |
53 |
|
|
54 |
|
private final static String testFileName = fileName + "-TEST"; |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
56 |
1 |
@BeforeClass(alwaysRun = true)... |
57 |
|
public void setUpJvOptionPane() |
58 |
|
{ |
59 |
1 |
JvOptionPane.setInteractiveMode(false); |
60 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
@throws |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
68 |
1 |
@Test(groups = { "Functional" })... |
69 |
|
public void loadAndSaveAlignment() throws IOException |
70 |
|
{ |
71 |
1 |
File file = new File(fileName); |
72 |
1 |
File testFile = new File(testFileName); |
73 |
1 |
Files.copy(file.toPath(), testFile.toPath(), |
74 |
|
StandardCopyOption.REPLACE_EXISTING); |
75 |
1 |
FormatAdapter fa = new FormatAdapter(); |
76 |
1 |
AlignmentI a = fa.readFile(testFile, DataSourceType.FILE, |
77 |
|
FileFormat.Fasta); |
78 |
|
|
79 |
1 |
AlignFrame af = new AlignFrame(a, 500, 500); |
80 |
1 |
af.saveAlignment(testFileName, FileFormat.Fasta); |
81 |
|
|
82 |
1 |
Assert.assertTrue(af.isSaveAlignmentSuccessful()); |
83 |
|
} |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
85 |
1 |
@AfterClass(alwaysRun = true)... |
86 |
|
private void cleanupTmpFiles() |
87 |
|
{ |
88 |
1 |
BackupFilesPresetEntry bfpe = BackupFilesPresetEntry |
89 |
|
.getSavedBackupEntry(); |
90 |
1 |
BackupFilesTest.cleanupTmpFiles(testFileName, bfpe.suffix, bfpe.digits); |
91 |
|
} |
92 |
|
|
93 |
|
} |