JAL-1551 spotlessApply
[jalview.git] / test / jalview / analysis / AlignmentUtilsTests.java
index 8b6f67d..c526fa1 100644 (file)
@@ -2608,15 +2608,15 @@ public class AlignmentUtilsTests
     SequenceI sq = new Sequence("a", "SSSQ");
     ContactMatrixI cm = new SeqDistanceContactMatrix(4);
     AlignmentAnnotation cm_aan = sq.addContactList(cm);
+    cm_aan.description = cm_aan.description + " cm1";
     SequenceI dssq = sq.createDatasetSequence();
-    Alignment ds = new Alignment(new SequenceI[] { dssq });
 
     // remove annotation on our non-dataset sequence
     sq.removeAlignmentAnnotation(sq.getAnnotation()[0]);
     // test transfer
     Alignment al = new Alignment(new SequenceI[] { sq });
     SortedMap<String, String> tipEntries = new TreeMap<>();
-    final Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>();
+    Map<SequenceI, List<AlignmentAnnotation>> candidates = new LinkedHashMap<>();
 
     AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(),
             tipEntries, candidates, al);
@@ -2630,6 +2630,24 @@ public class AlignmentUtilsTests
     assertNotNull(
             "No contact matrix recovered after reference annotation transfer",
             cl);
+    // semantics of sequence associated contact list is slightly tricky - column
+    // 3 in alignment should have data
+    cl = al.getContactListFor(alan, 3);
+    assertNotNull(
+            "Contact matrix should have data for last position in sequence",
+            cl);
+
+    ContactMatrixI cm2 = new SeqDistanceContactMatrix(4);
+    dssq.addContactList(cm2);
+    tipEntries = new TreeMap<>();
+    candidates = new LinkedHashMap<>();
+
+    AlignmentUtils.findAddableReferenceAnnotations(al.getSequences(),
+            tipEntries, candidates, al);
+    AlignmentUtils.addReferenceAnnotations(candidates, al, null);
+    assertTrue("Expected two contact map annotation transferred",
+            al.getAlignmentAnnotation() != null
+                    && al.getAlignmentAnnotation().length == 2);
 
   }
 }