use of org.sonar.ce.task.projectanalysis.source.SourceLinesHashRepositoryImpl.SignificantCodeLineHashesComputer in project sonarqube by SonarSource.
the class SourceLinesHashRepositoryImplTest method SignificantCodeLineHashesComputer_delegates_after_taking_ranges_into_account.
@Test
public void SignificantCodeLineHashesComputer_delegates_after_taking_ranges_into_account() {
LineRange[] lineRanges = { new LineRange(0, 1), null, new LineRange(1, 5), new LineRange(2, 7), new LineRange(4, 5) };
SourceLineHashesComputer lineHashComputer = mock(SourceLineHashesComputer.class);
SignificantCodeLineHashesComputer computer = new SignificantCodeLineHashesComputer(lineHashComputer, lineRanges);
computer.addLine("testline");
computer.addLine("testline");
computer.addLine("testline");
computer.addLine("testline");
computer.addLine("testline");
computer.addLine("testline");
verify(lineHashComputer).addLine("t");
// there is an extra line at the end which will be ignored since there is no range for it
verify(lineHashComputer, times(2)).addLine("");
verify(lineHashComputer).addLine("estl");
verify(lineHashComputer).addLine("stlin");
verify(lineHashComputer).addLine("l");
verifyNoMoreInteractions(lineHashComputer);
}
Aggregations