Merge branch 'alpha/JAL-3362_Jalview_212_alpha' into alpha/merge_212_JalviewJS_2112
[jalview.git] / test / jalview / datamodel / HMMNodeTest.java
diff --git a/test/jalview/datamodel/HMMNodeTest.java b/test/jalview/datamodel/HMMNodeTest.java
new file mode 100644 (file)
index 0000000..f2aef06
--- /dev/null
@@ -0,0 +1,42 @@
+package jalview.datamodel;
+
+import static org.testng.Assert.assertEquals;
+
+import jalview.io.DataSourceType;
+import jalview.io.FileParse;
+import jalview.io.HMMFile;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class HMMNodeTest
+{
+  private HiddenMarkovModel hmm;
+
+  @BeforeClass(alwaysRun = true)
+  public void setUp() throws MalformedURLException, IOException
+  {
+    /*
+     * load hmm model of a Kinase domain to a HiddenMarkovModel
+     */
+    HMMFile file = new HMMFile(new FileParse(
+            "test/jalview/io/test_PKinase_hmm.txt", DataSourceType.FILE));
+    hmm = file.getHMM();
+  }
+
+  @Test(groups="Functional")
+  public void testGetMaxMatchEmissionIdex()
+  {
+    assertEquals(hmm.getAlphabetType(), "amino");
+    String symbols = hmm.getSymbols();
+
+    assertEquals(hmm.getNode(1).getMaxMatchEmissionIndex(),
+            symbols.indexOf('Y'));
+
+    assertEquals(hmm.getNode(17).getMaxMatchEmissionIndex(),
+            symbols.indexOf('K'));
+  }
+}