2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import static org.testng.AssertJUnit.assertEquals;
24 import static org.testng.AssertJUnit.assertTrue;
26 import jalview.datamodel.DBRefEntry;
27 import jalview.datamodel.PDBEntry;
28 import jalview.datamodel.Sequence;
29 import jalview.datamodel.SequenceI;
31 import java.util.Vector;
33 import org.testng.annotations.AfterMethod;
34 import org.testng.annotations.BeforeMethod;
35 import org.testng.annotations.Test;
37 public class StructureChooserTest
41 @BeforeMethod(alwaysRun = true)
42 public void setUp() throws Exception
44 seq = new Sequence("PDB|4kqy|4KQY|A", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1,
46 seq.setDatasetSequence(seq);
47 for (int x = 1; x < 5; x++)
49 DBRefEntry dbRef = new DBRefEntry();
50 dbRef.setAccessionId("XYZ_" + x);
54 PDBEntry dbRef = new PDBEntry();
57 Vector<PDBEntry> pdbIds = new Vector<PDBEntry>();
64 public void tearDown() throws Exception
69 @Test(groups = { "Functional" })
70 public void buildQueryTest()
72 String query = StructureChooser.buildQuery(seq);
73 System.out.println(">>>>>>>>>> query : " + query);
75 "4kqy OR text:1tim OR text:XYZ_1 OR text:XYZ_2 OR text:XYZ_3 OR text:XYZ_4",
79 @Test(groups = { "Functional" })
80 public void populateFilterComboBoxTest()
82 SequenceI[] selectedSeqs = new SequenceI[] { seq };
83 StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
84 sc.populateFilterComboBox();
85 int optionsSize = sc.getCmbFilterOption().getItemCount();
86 assertEquals(3, optionsSize); // if structures are not discovered then don't
87 // populate filter options
89 sc.setStructuresDiscovered(true);
90 sc.populateFilterComboBox();
91 optionsSize = sc.getCmbFilterOption().getItemCount();
92 assertTrue(optionsSize > 3); // if structures are found, filter options
93 // should be populated
96 @Test(groups = { "Functional" })
97 public void fetchStructuresInfoTest()
99 SequenceI[] selectedSeqs = new SequenceI[] { seq };
100 StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
101 sc.fetchStructuresMetaData();
102 assertTrue(sc.getDiscoveredStructuresSet() != null);
103 assertTrue(sc.getDiscoveredStructuresSet().size() > 0);