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.
21 package jalview.fts.service.pdb;
23 import static org.testng.AssertJUnit.assertEquals;
24 import static org.testng.AssertJUnit.assertTrue;
26 import jalview.fts.service.pdb.PDBFTSPanel;
28 import javax.swing.JInternalFrame;
29 import javax.swing.JTextField;
31 import org.testng.annotations.AfterMethod;
32 import org.testng.annotations.BeforeMethod;
33 import org.testng.annotations.Test;
35 public class PDBFTSPanelTest
38 @BeforeMethod(alwaysRun = true)
39 public void setUp() throws Exception
44 public void tearDown() throws Exception
48 @Test(groups = { "Functional" })
49 public void populateCmbSearchTargetOptionsTest()
51 PDBFTSPanel searchPanel = new PDBFTSPanel(null);
52 assertTrue(searchPanel.getCmbSearchTarget().getItemCount() > 0);
53 searchPanel.populateCmbSearchTargetOptions();
56 @Test(groups = { "Functional" })
57 public void testDecodeSearchTerm()
59 String expectedString = "1xyz OR text:2xyz OR text:3xyz";
60 String outcome = PDBFTSPanel.decodeSearchTerm("1xyz:A;2xyz;3xyz",
62 // System.out.println("1 >>>>>>>>>>> " + outcome);
63 assertEquals(expectedString, outcome);
65 expectedString = "1xyz";
66 outcome = PDBFTSPanel.decodeSearchTerm("1xyz", "text");
67 // System.out.println("2 >>>>>>>>>>> " + outcome);
68 assertEquals(expectedString, outcome);
71 @Test(groups = { "Functional" })
72 public void testgetPDBIdwithSpecifiedChain()
75 String expectedString = "1xyz:A";
76 String outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("1xyz",
78 System.out.println("1 >>>>>>>>>>> " + outcome);
79 assertEquals(expectedString, outcome);
81 expectedString = "2xyz";
82 outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("2xyz",
84 System.out.println("2 >>>>>>>>>>> " + outcome);
85 assertEquals(expectedString, outcome);
87 expectedString = "2xyz:A";
88 outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("2xyz", "2xyz:A");
89 System.out.println("3 >>>>>>>>>>> " + outcome);
90 assertEquals(expectedString, outcome);
93 @Test(groups = { "External" }, timeOut = 7000)
94 public void txt_search_ActionPerformedTest()
96 PDBFTSPanel searchPanel = new PDBFTSPanel(null);
97 JInternalFrame mainFrame = searchPanel.getMainFrame();
98 JTextField txt_search = searchPanel.getTxtSearch();
100 assertTrue(mainFrame.getTitle().length() == 20);
101 assertTrue(mainFrame.getTitle()
102 .equalsIgnoreCase("PDB Sequence Fetcher"));
103 txt_search.setText("ABC");
106 // wait for web-service to handle response
108 } catch (InterruptedException e)
112 assertTrue(mainFrame.getTitle().length() > 20);
113 assertTrue(!mainFrame.getTitle().equalsIgnoreCase(
114 "PDB Sequence Fetcher"));