JAL-1645 Version-Rel Version 2.9 Year-Rel 2015 Licensing glob
[jalview.git] / test / jalview / schemes / ResiduePropertiesTest.java
index eb2ad45..1e5821b 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.schemes;
 
 import static org.testng.AssertJUnit.assertEquals;
@@ -14,7 +34,7 @@ public class ResiduePropertiesTest
   /**
    * Test 'standard' codon translations (no ambiguity codes)
    */
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testCodonTranslate()
   {
     // standard translation table order column 1/2/3/4
@@ -88,7 +108,7 @@ public class ResiduePropertiesTest
    * Test a sample of codon translations involving ambiguity codes. Should
    * return a protein value where the ambiguity does not affect the translation.
    */
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testCodonTranslate_ambiguityCodes()
   {
     // Y is C or T
@@ -175,7 +195,7 @@ public class ResiduePropertiesTest
     assertNull(ResidueProperties.codonTranslate("WSK"));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testGetResidues_nucleotide()
   {
     /*
@@ -194,7 +214,7 @@ public class ResiduePropertiesTest
     assertEquals("[A, C, G, I, N, R, T, U, X, Y]", residues.toString());
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testGetResidues_peptide()
   {
     /*
@@ -216,4 +236,23 @@ public class ResiduePropertiesTest
             "[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());
   }
+
+  @Test(groups = { "Functional" })
+  public void testGetCanonicalAminoAcid()
+  {
+    assertEquals("MET", ResidueProperties.getCanonicalAminoAcid("MET"));
+    assertEquals("MET", ResidueProperties.getCanonicalAminoAcid("MSE"));
+    assertEquals(null, ResidueProperties.getCanonicalAminoAcid(null));
+  }
+
+  @Test(groups = { "Functional" })
+  public void testGetSingleCharacterCode()
+  {
+    assertEquals('0', ResidueProperties.getSingleCharacterCode(null));
+    assertEquals('0', ResidueProperties.getSingleCharacterCode(null));
+    assertEquals('0', ResidueProperties.getSingleCharacterCode(""));
+    assertEquals('Q', ResidueProperties.getSingleCharacterCode("GLN"));
+    assertEquals('Q', ResidueProperties.getSingleCharacterCode("Gln"));
+    assertEquals('Q', ResidueProperties.getSingleCharacterCode("gln"));
+  }
 }