Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 16:11:35 GMT
  2. Package jalview.fts.service.pdb

File PDBFTSPanelTest.java

 

Code metrics

0
37
8
1
136
92
9
0.24
4.62
8
1.12

Classes

Class Line # Actions
PDBFTSPanelTest 36 37 9
0.666666766.7%
 

Contributing tests

This file is covered by 3 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.fts.service.pdb;
22   
23    import static org.testng.AssertJUnit.assertEquals;
24    import static org.testng.AssertJUnit.assertTrue;
25   
26    import javax.swing.JInternalFrame;
27   
28    import org.testng.annotations.AfterMethod;
29    import org.testng.annotations.BeforeClass;
30    import org.testng.annotations.BeforeMethod;
31    import org.testng.annotations.Test;
32   
33    import jalview.gui.JvOptionPane;
34    import junit.extensions.PA;
35   
 
36    public class PDBFTSPanelTest
37    {
38   
 
39  1 toggle @BeforeClass(alwaysRun = true)
40    public void setUpJvOptionPane()
41    {
42  1 JvOptionPane.setInteractiveMode(false);
43  1 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
44    }
45   
 
46  3 toggle @BeforeMethod(alwaysRun = true)
47    public void setUp() throws Exception
48    {
49    }
50   
 
51  3 toggle @AfterMethod(alwaysRun = true)
52    public void tearDown() throws Exception
53    {
54    }
55   
 
56  1 toggle @Test(groups = { "Functional" })
57    public void populateCmbSearchTargetOptionsTest()
58    {
59  1 PDBFTSPanel searchPanel = new PDBFTSPanel(null);
60  1 assertTrue(searchPanel.getCmbSearchTarget().getItemCount() > 0);
61  1 searchPanel.populateCmbSearchTargetOptions();
62    }
63   
 
64  1 toggle @Test(groups = { "Functional" })
65    public void testDecodeSearchTerm()
66    {
67  1 String expectedString = "1xyz OR text:2xyz OR text:3xyz";
68  1 String outcome = PDBFTSPanel.decodeSearchTerm("1xyz:A;2xyz;3xyz",
69    "text");
70  1 System.out.println("1 >>>>>>>>>>> " + outcome);
71  1 assertEquals(expectedString, outcome);
72   
73  1 expectedString = "1xyz";
74  1 outcome = PDBFTSPanel.decodeSearchTerm("1xyz", "text");
75    // System.out.println("2 >>>>>>>>>>> " + outcome);
76  1 assertEquals(expectedString, outcome);
77    }
78   
 
79  1 toggle @Test(groups = { "Functional" })
80    public void testgetPDBIdwithSpecifiedChain()
81    {
82   
83  1 String expectedString = "1xyz:A";
84  1 String outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("1xyz",
85    "2xyz;3xyz;1xyz:A");
86  1 System.out.println("1 >>>>>>>>>>> " + outcome);
87  1 assertEquals(expectedString, outcome);
88   
89  1 expectedString = "2xyz";
90  1 outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("2xyz",
91    "1xyz:A;2xyz;3xyz");
92  1 System.out.println("2 >>>>>>>>>>> " + outcome);
93  1 assertEquals(expectedString, outcome);
94   
95  1 expectedString = "2xyz:A";
96  1 outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("2xyz", "2xyz:A");
97  1 System.out.println("3 >>>>>>>>>>> " + outcome);
98  1 assertEquals(expectedString, outcome);
99    }
100   
 
101  0 toggle @Test(groups = { "External" }, timeOut = 8000)
102    public void txt_search_ActionPerformedTest()
103    {
104  0 PDBFTSPanel searchPanel = new PDBFTSPanel(null);
105  0 JInternalFrame mainFrame = searchPanel.getMainFrame();
106    // JComboBox<String> txt_search = PA.gsearchPanel.getTxtSearch();
107   
108  0 assertTrue(mainFrame.getTitle().length() == 20);
109  0 assertTrue(
110    mainFrame.getTitle().equalsIgnoreCase("PDB Sequence Fetcher"));
111  0 PA.invokeMethod(PA.getValue(searchPanel, "txt_search"),
112    "setSelectedItem(java.lang.String)", "ABC");
113    // txt_search.setSelectedItem("ABC");
114  0 try
115    {
116    // wait for web-service to handle response
117  0 Thread.sleep(3000);
118    } catch (InterruptedException e)
119    {
120  0 e.printStackTrace();
121    }
122  0 assertTrue(mainFrame.getTitle().length() > 20);
123  0 assertTrue(
124    !mainFrame.getTitle().equalsIgnoreCase("PDB Sequence Fetcher"));
125    }
126   
 
127  0 toggle @Test
128    public void getFTSframeTitleTest()
129    {
130  0 PDBFTSPanel searchPanel = new PDBFTSPanel(null);
131  0 String outcome = searchPanel.getFTSFrameTitle();
132    // System.out.println("FTS Frame title :" + outcome);
133  0 assertEquals(outcome, "PDB Sequence Fetcher");
134    }
135   
136    }