X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Ffts%2Fservice%2Fpdb%2FPDBFTSPanelTest.java;h=f02b00a0a6117555de120fd012245ebe85b3658f;hb=HEAD;hp=69792bb2041b394d171d06cbd210fe5e2b92357d;hpb=37de9310bec3501cbc6381e0c3dcb282fcaad812;p=jalview.git diff --git a/test/jalview/fts/service/pdb/PDBFTSPanelTest.java b/test/jalview/fts/service/pdb/PDBFTSPanelTest.java index 69792bb..f02b00a 100644 --- a/test/jalview/fts/service/pdb/PDBFTSPanelTest.java +++ b/test/jalview/fts/service/pdb/PDBFTSPanelTest.java @@ -23,16 +23,28 @@ package jalview.fts.service.pdb; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; +import jalview.gui.JvOptionPane; + +import javax.swing.JComboBox; import javax.swing.JInternalFrame; -import javax.swing.JTextField; import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import junit.extensions.PA; + public class PDBFTSPanelTest { + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + @BeforeMethod(alwaysRun = true) public void setUp() throws Exception { @@ -57,7 +69,7 @@ public class PDBFTSPanelTest String expectedString = "1xyz OR text:2xyz OR text:3xyz"; String outcome = PDBFTSPanel.decodeSearchTerm("1xyz:A;2xyz;3xyz", "text"); - // System.out.println("1 >>>>>>>>>>> " + outcome); + System.out.println("1 >>>>>>>>>>> " + outcome); assertEquals(expectedString, outcome); expectedString = "1xyz"; @@ -88,17 +100,19 @@ public class PDBFTSPanelTest assertEquals(expectedString, outcome); } - @Test(groups = { "External" }, timeOut = 7000) + @Test(groups = { "External" }, timeOut = 8000) public void txt_search_ActionPerformedTest() { PDBFTSPanel searchPanel = new PDBFTSPanel(null); JInternalFrame mainFrame = searchPanel.getMainFrame(); - JTextField txt_search = searchPanel.getTxtSearch(); + // JComboBox txt_search = PA.gsearchPanel.getTxtSearch(); assertTrue(mainFrame.getTitle().length() == 20); - assertTrue(mainFrame.getTitle() - .equalsIgnoreCase("PDB Sequence Fetcher")); - txt_search.setText("ABC"); + assertTrue( + mainFrame.getTitle().equalsIgnoreCase("PDB Sequence Fetcher")); + PA.invokeMethod(PA.getValue(searchPanel, "txt_search"), + "setSelectedItem(java.lang.String)", "ABC"); + // txt_search.setSelectedItem("ABC"); try { // wait for web-service to handle response @@ -108,8 +122,17 @@ public class PDBFTSPanelTest e.printStackTrace(); } assertTrue(mainFrame.getTitle().length() > 20); - assertTrue(!mainFrame.getTitle().equalsIgnoreCase( - "PDB Sequence Fetcher")); + assertTrue( + !mainFrame.getTitle().equalsIgnoreCase("PDB Sequence Fetcher")); + } + + @Test + public void getFTSframeTitleTest() + { + PDBFTSPanel searchPanel = new PDBFTSPanel(null); + String outcome = searchPanel.getFTSFrameTitle(); + // System.out.println("FTS Frame title :" + outcome); + assertEquals(outcome, "PDB Sequence Fetcher"); } }