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