JAL-1741 nucleotide-aware colour schemes applied to structures
[jalview.git] / test / jalview / schemes / ResiduePropertiesTest.java
index b976e44..b82d338 100644 (file)
@@ -3,6 +3,9 @@ package jalview.schemes;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
+import java.util.Collections;
+import java.util.List;
+
 import org.junit.Test;
 
 public class ResiduePropertiesTest
@@ -171,4 +174,46 @@ public class ResiduePropertiesTest
     assertNull(ResidueProperties.codonTranslate("VHD"));
     assertNull(ResidueProperties.codonTranslate("WSK"));
   }
+
+  @Test
+  public void testGetResidues_nucleotide()
+  {
+    /*
+     * Non-ambiguous only; we don't care about the order of the list, it is just
+     * sorted here to make assertions reliable
+     */
+    List<String> residues = ResidueProperties.getResidues(true, false);
+    Collections.sort(residues);
+    assertEquals("[A, C, G, T, U]", residues.toString());
+
+    /*
+     * Including ambiguity codes I N R X Y
+     */
+    residues = ResidueProperties.getResidues(true, true);
+    Collections.sort(residues);
+    assertEquals("[A, C, G, I, N, R, T, U, X, Y]", residues.toString());
+  }
+
+  @Test
+  public void testGetResidues_peptide()
+  {
+    /*
+     * Non-ambiguous only; we don't care about the order of the list, it is just
+     * sorted here to make assertions reliable
+     */
+    List<String> residues = ResidueProperties.getResidues(false, false);
+    Collections.sort(residues);
+    assertEquals(
+            "[ALA, ARG, ASN, ASP, CYS, GLN, GLU, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL]",
+            residues.toString());
+
+    /*
+     * Including ambiguity codes ASX, GLX, XAA
+     */
+    residues = ResidueProperties.getResidues(false, true);
+    Collections.sort(residues);
+    assertEquals(
+            "[ALA, ARG, ASN, ASP, ASX, CYS, GLN, GLU, GLX, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, XAA]",
+            residues.toString());
+  }
 }