use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class DefaultBlameOutputTest method shouldFailIfNullRevision.
@Test
public void shouldFailIfNullRevision() {
InputFile file = new TestInputFileBuilder("foo", "src/main/java/Foo.java").setLines(1).build();
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Blame revision is blank for file src/main/java/Foo.java at line 1");
new DefaultBlameOutput(null, Arrays.<InputFile>asList(file)).blameResult(file, Arrays.asList(new BlameLine().date(new Date()).author("guy")));
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class DefaultSensorStorageTest method shouldValidateStrictlyPositiveLine.
@Test
public void shouldValidateStrictlyPositiveLine() throws Exception {
InputFile file = new TestInputFileBuilder("module", "testfile").setModuleBaseDir(temp.newFolder().toPath()).build();
Map<Integer, Integer> map = ImmutableMap.of(0, 3);
String data = KeyValueFormat.format(map);
thrown.expect(IllegalStateException.class);
thrown.expectMessage("must be > 0");
underTest.validateCoverageMeasure(data, file);
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class DefaultSensorStorageTest method duplicateSymbolTable.
@Test(expected = UnsupportedOperationException.class)
public void duplicateSymbolTable() throws Exception {
InputFile inputFile = new TestInputFileBuilder("foo", "src/Foo.java").setModuleBaseDir(temp.newFolder().toPath()).build();
DefaultSymbolTable st = new DefaultSymbolTable(null).onFile(inputFile);
underTest.store(st);
underTest.store(st);
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class SensorOptimizerTest method should_optimize_on_language.
@Test
public void should_optimize_on_language() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor().onlyOnLanguages("java", "php");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
fs.add(new TestInputFileBuilder("foo", "src/Foo.java").setLanguage("java").build());
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class CoverageExclusionsTest method shouldExcludeFileBasedOnPattern.
@Test
public void shouldExcludeFileBasedOnPattern() {
InputFile file = new TestInputFileBuilder("foo", "src/org/polop/File.php").build();
settings.setProperty("sonar.coverage.exclusions", "src/org/polop/*");
coverageExclusions.initPatterns();
assertThat(coverageExclusions.isExcluded(file)).isTrue();
}
Aggregations