예제 #1
0
  @Test
  public void firstCommonSequence() {
    String[] seq1 = "Common Name 1 Any Title".split("\\s");
    String[] seq2 = "abc xyz Common Name 2 Any Title".split("\\s");

    // check if common sequence can be determined
    assertArrayEquals(
        new String[] {"Common", "Name"},
        matcher.firstCommonSequence(seq1, seq2, 2, String.CASE_INSENSITIVE_ORDER));

    // check if max start index is working
    assertArrayEquals(
        null, matcher.firstCommonSequence(seq1, seq2, 0, String.CASE_INSENSITIVE_ORDER));
    assertArrayEquals(
        null, matcher.firstCommonSequence(seq2, seq1, 1, String.CASE_INSENSITIVE_ORDER));
  }