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 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (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 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
56 |
0 |
@BeforeClass(alwaysRun = true)... |
57 |
|
public void setUpJvOptionPane() |
58 |
|
{ |
59 |
0 |
JvOptionPane.setInteractiveMode(false); |
60 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
@throws |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
4-
|
|
68 |
0 |
@Test(groups = { "Functional" })... |
69 |
|
public void loadAndSaveAlignment() throws IOException |
70 |
|
{ |
71 |
0 |
File file = new File(fileName); |
72 |
0 |
File testFile = new File(testFileName); |
73 |
0 |
Files.copy(file.toPath(), testFile.toPath(), |
74 |
|
StandardCopyOption.REPLACE_EXISTING); |
75 |
0 |
FormatAdapter fa = new FormatAdapter(); |
76 |
0 |
AlignmentI a = fa.readFile(testFile, DataSourceType.FILE, |
77 |
|
FileFormat.Fasta); |
78 |
|
|
79 |
0 |
AlignFrame af = new AlignFrame(a, 500, 500); |
80 |
0 |
af.saveAlignment(testFileName, FileFormat.Fasta); |
81 |
|
|
82 |
0 |
Assert.assertTrue(af.isSaveAlignmentSuccessful()); |
83 |
|
} |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
85 |
0 |
@AfterClass(alwaysRun = true)... |
86 |
|
private void cleanupTmpFiles() |
87 |
|
{ |
88 |
0 |
BackupFilesPresetEntry bfpe = BackupFilesPresetEntry |
89 |
|
.getSavedBackupEntry(); |
90 |
0 |
BackupFilesTest.cleanupTmpFiles(testFileName, bfpe.suffix, bfpe.digits); |
91 |
|
} |
92 |
|
|
93 |
|
} |