@Test
public void testEncodeStateSequence() {

  String[] hiddenSequence = {"H1", "H2", "H0", "H3", "H4"};
  String[] outputSequence = {"O1", "O2", "O4", "O0"};
  // test encoding the hidden Sequence
  int[] hiddenSequenceEnc = HmmUtils.encodeStateSequence(getModel(), Arrays
      .asList(hiddenSequence), false, -1);
  int[] outputSequenceEnc = HmmUtils.encodeStateSequence(getModel(), Arrays
      .asList(outputSequence), true, -1);
  // expected state sequences
  int[] hiddenSequenceExp = {1, 2, 0, 3, -1};
  int[] outputSequenceExp = {1, 2, -1, 0};
  // compare
  for (int i = 0; i < hiddenSequenceEnc.length; ++i) {
    assertEquals(hiddenSequenceExp[i], hiddenSequenceEnc[i]);
  }
  for (int i = 0; i < outputSequenceEnc.length; ++i) {
    assertEquals(outputSequenceExp[i], outputSequenceEnc[i]);
  }
}