1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
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 jalview.gui.JvOptionPane; |
27 |
|
|
28 |
|
import javax.swing.JComboBox; |
29 |
|
import javax.swing.JInternalFrame; |
30 |
|
|
31 |
|
import org.testng.annotations.AfterMethod; |
32 |
|
import org.testng.annotations.BeforeClass; |
33 |
|
import org.testng.annotations.BeforeMethod; |
34 |
|
import org.testng.annotations.Test; |
35 |
|
|
36 |
|
import junit.extensions.PA; |
37 |
|
|
|
|
| 66.7% |
Uncovered Elements: 15 (45) |
Complexity: 9 |
Complexity Density: 0.24 |
|
38 |
|
public class PDBFTSPanelTest |
39 |
|
{ |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
41 |
1 |
@BeforeClass(alwaysRun = true)... |
42 |
|
public void setUpJvOptionPane() |
43 |
|
{ |
44 |
1 |
JvOptionPane.setInteractiveMode(false); |
45 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
46 |
|
} |
47 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
48 |
3 |
@BeforeMethod(alwaysRun = true)... |
49 |
|
public void setUp() throws Exception |
50 |
|
{ |
51 |
|
} |
52 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
53 |
3 |
@AfterMethod(alwaysRun = true)... |
54 |
|
public void tearDown() throws Exception |
55 |
|
{ |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
58 |
1 |
@Test(groups = { "Functional" })... |
59 |
|
public void populateCmbSearchTargetOptionsTest() |
60 |
|
{ |
61 |
1 |
PDBFTSPanel searchPanel = new PDBFTSPanel(null); |
62 |
1 |
assertTrue(searchPanel.getCmbSearchTarget().getItemCount() > 0); |
63 |
1 |
searchPanel.populateCmbSearchTargetOptions(); |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
66 |
1 |
@Test(groups = { "Functional" })... |
67 |
|
public void testDecodeSearchTerm() |
68 |
|
{ |
69 |
1 |
String expectedString = "1xyz OR text:2xyz OR text:3xyz"; |
70 |
1 |
String outcome = PDBFTSPanel.decodeSearchTerm("1xyz:A;2xyz;3xyz", |
71 |
|
"text"); |
72 |
1 |
System.out.println("1 >>>>>>>>>>> " + outcome); |
73 |
1 |
assertEquals(expectedString, outcome); |
74 |
|
|
75 |
1 |
expectedString = "1xyz"; |
76 |
1 |
outcome = PDBFTSPanel.decodeSearchTerm("1xyz", "text"); |
77 |
|
|
78 |
1 |
assertEquals(expectedString, outcome); |
79 |
|
} |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
81 |
1 |
@Test(groups = { "Functional" })... |
82 |
|
public void testgetPDBIdwithSpecifiedChain() |
83 |
|
{ |
84 |
|
|
85 |
1 |
String expectedString = "1xyz:A"; |
86 |
1 |
String outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("1xyz", |
87 |
|
"2xyz;3xyz;1xyz:A"); |
88 |
1 |
System.out.println("1 >>>>>>>>>>> " + outcome); |
89 |
1 |
assertEquals(expectedString, outcome); |
90 |
|
|
91 |
1 |
expectedString = "2xyz"; |
92 |
1 |
outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("2xyz", |
93 |
|
"1xyz:A;2xyz;3xyz"); |
94 |
1 |
System.out.println("2 >>>>>>>>>>> " + outcome); |
95 |
1 |
assertEquals(expectedString, outcome); |
96 |
|
|
97 |
1 |
expectedString = "2xyz:A"; |
98 |
1 |
outcome = PDBFTSPanel.getPDBIdwithSpecifiedChain("2xyz", "2xyz:A"); |
99 |
1 |
System.out.println("3 >>>>>>>>>>> " + outcome); |
100 |
1 |
assertEquals(expectedString, outcome); |
101 |
|
} |
102 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1PASS
|
|
103 |
0 |
@Test(groups = { "External" }, timeOut = 8000)... |
104 |
|
public void txt_search_ActionPerformedTest() |
105 |
|
{ |
106 |
0 |
PDBFTSPanel searchPanel = new PDBFTSPanel(null); |
107 |
0 |
JInternalFrame mainFrame = searchPanel.getMainFrame(); |
108 |
|
|
109 |
|
|
110 |
0 |
assertTrue(mainFrame.getTitle().length() == 20); |
111 |
0 |
assertTrue( |
112 |
|
mainFrame.getTitle().equalsIgnoreCase("PDB Sequence Fetcher")); |
113 |
0 |
PA.invokeMethod(PA.getValue(searchPanel, "txt_search"), |
114 |
|
"setSelectedItem(java.lang.String)", "ABC"); |
115 |
|
|
116 |
0 |
try |
117 |
|
{ |
118 |
|
|
119 |
0 |
Thread.sleep(3000); |
120 |
|
} catch (InterruptedException e) |
121 |
|
{ |
122 |
0 |
e.printStackTrace(); |
123 |
|
} |
124 |
0 |
assertTrue(mainFrame.getTitle().length() > 20); |
125 |
0 |
assertTrue( |
126 |
|
!mainFrame.getTitle().equalsIgnoreCase("PDB Sequence Fetcher")); |
127 |
|
} |
128 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
129 |
0 |
@Test... |
130 |
|
public void getFTSframeTitleTest() |
131 |
|
{ |
132 |
0 |
PDBFTSPanel searchPanel = new PDBFTSPanel(null); |
133 |
0 |
String outcome = searchPanel.getFTSFrameTitle(); |
134 |
|
|
135 |
0 |
assertEquals(outcome, "PDB Sequence Fetcher"); |
136 |
|
} |
137 |
|
|
138 |
|
} |