@Test
  public void testLatestChangedRangeOfAddedTextAtEnd() {
    String oldContent = "HelloWorld";
    String newContent = "HelloWorldNEW";
    ChangedTextFile changedTextFile = new ChangedTextFile("/path", oldContent, newContent);
    ChangedRange changedRange = changedTextFile.getLatestChangedRange();

    String addedText =
        newContent.substring(changedRange.getFirstIndex(), changedRange.getExlusiveEndOfNew());
    String removedText =
        oldContent.substring(changedRange.getFirstIndex(), changedRange.getExlusiveEndOfOld());
    assertEquals("", removedText);
    assertEquals("NEW", addedText);
  }
  @Test
  public void testEarliestChangedRangeOfReplacedTextAtStart() {
    String oldContent = "OLDHelloWorld";
    String newContent = "NEWHelloWorld";
    ChangedTextFile changedTextFile = new ChangedTextFile("/path", oldContent, newContent);
    ChangedRange changedRange = changedTextFile.getEarliestChangedRange();

    String addedText =
        newContent.substring(changedRange.getFirstIndex(), changedRange.getExlusiveEndOfNew());
    String removedText =
        oldContent.substring(changedRange.getFirstIndex(), changedRange.getExlusiveEndOfOld());
    assertEquals("OLD", removedText);
    assertEquals("NEW", addedText);
  }
  @Test
  public void testLatestChangedRangeAddedTextAtTwoPossibleLocationsInMiddle() {
    String oldContent = "HelloWorld";
    String newContent = "HelloWoWorld";
    ChangedTextFile changedTextFile = new ChangedTextFile("/path", oldContent, newContent);
    ChangedRange changedRange = changedTextFile.getLatestChangedRange();

    String addedText =
        newContent.substring(changedRange.getFirstIndex(), changedRange.getExlusiveEndOfNew());
    String removedText =
        oldContent.substring(changedRange.getFirstIndex(), changedRange.getExlusiveEndOfOld());
    assertEquals("", removedText);
    assertEquals("Wo", addedText);
    assertEquals(7, changedRange.getFirstIndex());
  }