JAL-2235 implicit test to check that exception is raised for non-dataset reference
authorJim Procter <jprocter@issues.jalview.org>
Wed, 28 Sep 2016 14:26:08 +0000 (15:26 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 28 Sep 2016 14:26:08 +0000 (15:26 +0100)
test/jalview/datamodel/SequenceTest.java

index 8c5073b..cfcb9ec 100644 (file)
@@ -366,7 +366,16 @@ public class SequenceTest
      * is there a usecase for this ? setDatasetSequence should throw an error if
      * this actually occurs.
      */
-    sq.getDatasetSequence().setDatasetSequence(sq); // loop!
+    try
+    {
+      sq.getDatasetSequence().setDatasetSequence(sq); // loop!
+      Assert.fail("Expected Error to be raised when calling setDatasetSequence with self reference");
+    } catch (Error e)
+    {
+      // TODO Jalview error/exception class for raising implementation errors
+      assertTrue(e.getMessage().toLowerCase()
+              .contains("implementation error"));
+    }
     assertNull(sq.getSequenceFeatures());
   }