--- /dev/null
+package jalview.io;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.gui.AlignFrame;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class AnnotatedPDBFileInputTest
+{
+
+ AlignmentI al;
+
+ @Before
+ public void setup() throws Exception
+ {
+ FileLoader loader = new FileLoader(false);
+ AlignFrame af = loader.LoadFileWaitTillLoaded("examples/1gaq.txt",
+ FormatAdapter.FILE);
+ al = af.getViewport().getAlignment();
+ }
+
+ @Test
+ public void checkAnnotationWiring()
+ {
+ assertTrue(al.getAlignmentAnnotation() != null);
+ // verify that all sequence annotation is doubly referenced
+ for (AlignmentAnnotation aa : al.getAlignmentAnnotation())
+ {
+ if (aa.sequenceRef != null)
+ {
+ assertTrue(al.getSequences().contains(aa.sequenceRef));
+ assertNotNull(aa.sequenceRef.getAnnotation());
+ boolean found = false;
+ for (AlignmentAnnotation sqan : aa.sequenceRef.getAnnotation())
+ {
+ if (sqan == aa)
+ {
+ found = true;
+ break;
+ }
+ }
+ assertTrue(
+ "Couldn't find sequence associated annotation "
+ + aa.label
+ + " on the sequence it is associated with.\nSequence associated editing will fail.",
+ found);
+ }
+ }
+ }
+}