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.assertFalse; |
24 |
|
import static org.testng.Assert.assertTrue; |
25 |
|
import static org.testng.AssertJUnit.assertNotNull; |
26 |
|
|
27 |
|
import org.testng.annotations.BeforeClass; |
28 |
|
import org.testng.annotations.Test; |
29 |
|
|
30 |
|
import jalview.datamodel.AlignmentAnnotation; |
31 |
|
import jalview.gui.AlignFrame; |
32 |
|
import jalview.gui.AnnotationExporter; |
33 |
|
import jalview.gui.JvOptionPane; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
|
35 |
|
public class AnnotationExporterTest |
36 |
|
{ |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
38 |
0 |
@BeforeClass(alwaysRun = true)... |
39 |
|
public void setUpJvOptionPane() |
40 |
|
{ |
41 |
0 |
JvOptionPane.setInteractiveMode(false); |
42 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
43 |
|
} |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
4-
|
|
45 |
0 |
@Test(groups = "Functional")... |
46 |
|
public void testAnnotationExportAsCSV() |
47 |
|
{ |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
0 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( |
52 |
|
">Seq1\nQRSIL\n>Seq2\nFTHND\n>Seq3\nRPVSL\n", |
53 |
|
DataSourceType.PASTE); |
54 |
0 |
AlignmentAnnotation[] annots = af.alignPanel.getAlignment() |
55 |
|
.getAlignmentAnnotation(); |
56 |
|
|
57 |
0 |
assertTrue(annots.length > 1); |
58 |
|
|
59 |
0 |
AnnotationExporter ae = new AnnotationExporter(af.alignPanel); |
60 |
0 |
ae.exportAnnotations(); |
61 |
0 |
ae.setExportAsCSV(); |
62 |
|
|
63 |
0 |
String exported; |
64 |
0 |
exported = ae.getAnnotationsText(); |
65 |
0 |
assertNotNull(exported); |
66 |
0 |
assertTrue(exported.contains(annots[0].label)); |
67 |
0 |
assertTrue(exported.contains(annots[1].label)); |
68 |
|
|
69 |
|
|
70 |
0 |
ae.exportAnnotation(annots[1]); |
71 |
0 |
exported = ae.getAnnotationsText(); |
72 |
0 |
assertNotNull(exported); |
73 |
0 |
assertFalse(exported.contains(annots[0].label)); |
74 |
0 |
assertTrue(exported.contains(annots[1].label)); |
75 |
|
|
76 |
|
} |
77 |
|
} |