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 javax.swing.JInternalFrame;
27 import javax.swing.JTextField;
29 import org.testng.annotations.AfterMethod;
30 import org.testng.annotations.BeforeMethod;
31 import org.testng.annotations.Test;
33 public class PDBSearchPanelTest
36 @BeforeMethod(alwaysRun = true)
37 public void setUp() throws Exception
42 public void tearDown() throws Exception
46 @Test(groups = { "Functional" })
47 public void populateCmbSearchTargetOptionsTest()
49 PDBSearchPanel searchPanel = new PDBSearchPanel(null);
50 assertTrue(searchPanel.getCmbSearchTarget().getItemCount() > 0);
51 searchPanel.populateCmbSearchTargetOptions();
54 @Test(groups = { "Functional" })
55 public void testDecodeSearchTerm()
57 String expectedString = "1xyz OR text:2xyz OR text:3xyz";
58 String outcome = PDBSearchPanel.decodeSearchTerm("1xyz:A;2xyz;3xyz",
60 // System.out.println("1 >>>>>>>>>>> " + outcome);
61 assertEquals(expectedString, outcome);
63 expectedString = "1xyz";
64 outcome = PDBSearchPanel.decodeSearchTerm("1xyz", "text");
65 // System.out.println("2 >>>>>>>>>>> " + outcome);
66 assertEquals(expectedString, outcome);
69 @Test(groups = { "Functional" })
70 public void testgetPDBIdwithSpecifiedChain()
73 String expectedString = "1xyz:A";
74 String outcome = PDBSearchPanel.getPDBIdwithSpecifiedChain("1xyz",
76 System.out.println("1 >>>>>>>>>>> " + outcome);
77 assertEquals(expectedString, outcome);
79 expectedString = "2xyz";
80 outcome = PDBSearchPanel.getPDBIdwithSpecifiedChain("2xyz",
82 System.out.println("2 >>>>>>>>>>> " + outcome);
83 assertEquals(expectedString, outcome);
85 expectedString = "2xyz:A";
86 outcome = PDBSearchPanel.getPDBIdwithSpecifiedChain("2xyz", "2xyz:A");
87 System.out.println("3 >>>>>>>>>>> " + outcome);
88 assertEquals(expectedString, outcome);
91 @Test(groups = { "Network", "External" }, timeOut = 5000)
92 public void txt_search_ActionPerformedTest()
94 PDBSearchPanel searchPanel = new PDBSearchPanel(null);
95 JInternalFrame mainFrame = searchPanel.getMainFrame();
96 JTextField txt_search = searchPanel.getTxtSearch();
98 assertTrue(mainFrame.getTitle().length() == 20);
99 assertTrue(mainFrame.getTitle()
100 .equalsIgnoreCase("PDB Sequence Fetcher"));
102 txt_search.setText("ABC");
104 assertTrue(mainFrame.getTitle().length() > 20);
105 assertTrue(!mainFrame.getTitle().equalsIgnoreCase(
106 "PDB Sequence Fetcher"));