use of org.sonar.ce.task.projectanalysis.source.linereader.LineReader.Data.HIGHLIGHTING in project sonarqube by SonarSource.
the class FileSourceDataWarningsTest method create_highlighting_warning_when_any_number_of_read_error_for_one_file.
@Test
public void create_highlighting_warning_when_any_number_of_read_error_for_one_file() {
ReportComponent file = ReportComponent.builder(Component.Type.FILE, 1).setUuid("uuid").setName(path).build();
LineReader.ReadError[] readErrors = IntStream.range(0, 1 + random.nextInt(10)).mapToObj(i -> new LineReader.ReadError(HIGHLIGHTING, line + i)).toArray(LineReader.ReadError[]::new);
when(system2.now()).thenReturn(timeStamp);
Arrays.stream(readErrors).forEach(readError -> underTest.addWarning(file, readError));
verifyZeroInteractions(taskMessages);
underTest.commitWarnings();
verify(taskMessages, times(1)).add(new CeTaskMessages.Message("Inconsistent highlighting data detected on file '" + path + "'. " + "File source may have been modified while analysis was running.", timeStamp));
}
Aggregations