@Test
public void testDecodeStateSequence() {

  int[] hiddenSequence = {1, 2, 0, 3, 10};
  int[] outputSequence = {1, 2, 10, 0};
  // test encoding the hidden Sequence
  List<String> hiddenSequenceDec = HmmUtils.decodeStateSequence(
      getModel(), hiddenSequence, false, "unknown");
  List<String> outputSequenceDec = HmmUtils.decodeStateSequence(
      getModel(), outputSequence, true, "unknown");
  // expected state sequences
  String[] hiddenSequenceExp = {"H1", "H2", "H0", "H3", "unknown"};
  String[] outputSequenceExp = {"O1", "O2", "unknown", "O0"};
  // compare
  for (int i = 0; i < hiddenSequenceExp.length; ++i) {
    assertEquals(hiddenSequenceExp[i], hiddenSequenceDec.get(i));
  }
  for (int i = 0; i < outputSequenceExp.length; ++i) {
    assertEquals(outputSequenceExp[i], outputSequenceDec.get(i));
  }
}