JAL-3875 test case and patch to verify the query 3d beacons button is shown for prote...
[jalview.git] / test / jalview / gui / StructureChooserTest.java
index a87e1c6..f183e5c 100644 (file)
@@ -58,7 +58,7 @@ public class StructureChooserTest
     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
   }
 
-  Sequence seq,upSeq;
+  Sequence seq,upSeq,upSeq_nocanonical;
 
   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
@@ -111,9 +111,15 @@ public class StructureChooserTest
             + "GTGVHPIVVVQPDAWTEDNGFHAIGQMCEAPVVTREWVLDSVALYQCQELDTYLIPQIPHSHY\n"
             + "", 1,
 1863);
-    upSeq.createDatasetSequence();
     upSeq.setDescription("Breast cancer type 1 susceptibility protein");
+    upSeq_nocanonical = new Sequence(upSeq);
+    upSeq.createDatasetSequence();
     upSeq.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,true));
+    
+    upSeq_nocanonical.createDatasetSequence();
+    // not a canonical reference
+    upSeq_nocanonical.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,false));
+
   }
 
   @AfterMethod(alwaysRun = true)
@@ -121,6 +127,7 @@ public class StructureChooserTest
   {
     seq = null;
     upSeq=null;
+    upSeq_nocanonical=null;
   }
 
   @Test(groups = { "Functional" })
@@ -163,6 +170,20 @@ public class StructureChooserTest
 
   }
 
+  @Test(groups = { "Functional" })
+  public void displayTDBQueryTest() throws InterruptedException
+  {
+    TDBeaconsFTSRestClientTest.setMock();
+    PDBFTSRestClientTest.setMock();
+
+    SequenceI[] selectedSeqs = new SequenceI[] { upSeq_nocanonical };
+    StructureChooser sc = new StructureChooser(selectedSeqs, upSeq_nocanonical, null);
+    // mock so should be quick. Exceptions from mocked PDBFTS are expected too
+    ThreadwaitFor(500, sc);
+    
+    assertTrue(sc.isCanQueryTDB() && sc.isNotQueriedTDBYet());
+  }
+
   @Test(groups = { "Network" })
   public void fetchStructuresInfoTest()
   {