public NonClosedTracking<RAW, BASE> trackNonClosed(Input<RAW> rawInput, Input<BASE> baseInput) {
    NonClosedTracking<RAW, BASE> tracking = NonClosedTracking.of(rawInput, baseInput);

    // 1. match by rule, line, line hash and message
    match(tracking, LineAndLineHashAndMessage::new);

    // 2. match issues with same rule, same line and same line hash, but not necessarily with same message
    match(tracking, LineAndLineHashKey::new);

    // 3. detect code moves by comparing blocks of codes
    detectCodeMoves(rawInput, baseInput, tracking);

    // 4. match issues with same rule, same message and same line hash
    match(tracking, LineHashAndMessageKey::new);

    // 5. match issues with same rule, same line and same message
    match(tracking, LineAndMessageKey::new);

    // 6. match issues with same rule and same line hash but different line and different message.
    // See SONAR-2812
    match(tracking, LineHashKey::new);

    return tracking;
  }
@Test
  public void recognize_blocks_1() {
    FakeInput baseInput = FakeInput.createForSourceLines(
      "package example1;",
      "",
      "public class Toto {",
      "",
      "    public void doSomething() {",
      "        // doSomething",
      "        }",
      "",
      "    public void doSomethingElse() {",
      "        // doSomethingElse",
      "        }",
      "}");
    Issue base1 = baseInput.createIssueOnLine(7, RULE_SYSTEM_PRINT, "Indentation");
    Issue base2 = baseInput.createIssueOnLine(11, RULE_SYSTEM_PRINT, "Indentation");

    FakeInput rawInput = FakeInput.createForSourceLines(
      "package example1;",
      "",
      "public class Toto {",
      "",
      "    public Toto(){}",
      "",
      "    public void doSomethingNew() {",
      "        // doSomethingNew",
      "        }",
      "",
      "    public void doSomethingElseNew() {",
      "        // doSomethingElseNew",
      "        }",
      "",
      "    public void doSomething() {",
      "        // doSomething",
      "        }",
      "",
      "    public void doSomethingElse() {",
      "        // doSomethingElse",
      "        }",
      "}");
    Issue raw1 = rawInput.createIssueOnLine(9, RULE_SYSTEM_PRINT, "Indentation");
    Issue raw2 = rawInput.createIssueOnLine(13, RULE_SYSTEM_PRINT, "Indentation");
    Issue raw3 = rawInput.createIssueOnLine(17, RULE_SYSTEM_PRINT, "Indentation");
    Issue raw4 = rawInput.createIssueOnLine(21, RULE_SYSTEM_PRINT, "Indentation");

    Tracking<Issue, Issue> tracking = tracker.trackNonClosed(rawInput, baseInput);
    assertThat(tracking.baseFor(raw1)).isNull();
    assertThat(tracking.baseFor(raw2)).isNull();
    assertThat(tracking.baseFor(raw3)).isSameAs(base1);
    assertThat(tracking.baseFor(raw4)).isSameAs(base2);
    assertThat(tracking.getUnmatchedBases()).isEmpty();
  }