Search in sources :

Example 1 with DefaultBlameOutput

use of org.sonar.scanner.scm.DefaultBlameOutput in project sonarqube by SonarSource.

the class DefaultBlameOutputTest method shouldNotFailIfNotSameNumberOfLines.

@Test
public void shouldNotFailIfNotSameNumberOfLines() {
    InputFile file = new TestInputFileBuilder("foo", "src/main/java/Foo.java").setLines(10).build();
    new DefaultBlameOutput(null, Arrays.asList(file)).blameResult(file, Arrays.asList(new BlameLine().revision("1").author("guy")));
}
Also used : TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) BlameLine(org.sonar.api.batch.scm.BlameLine) DefaultBlameOutput(org.sonar.scanner.scm.DefaultBlameOutput) InputFile(org.sonar.api.batch.fs.InputFile) Test(org.junit.Test)

Example 2 with DefaultBlameOutput

use of org.sonar.scanner.scm.DefaultBlameOutput 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")));
}
Also used : TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) BlameLine(org.sonar.api.batch.scm.BlameLine) DefaultBlameOutput(org.sonar.scanner.scm.DefaultBlameOutput) Date(java.util.Date) InputFile(org.sonar.api.batch.fs.InputFile) Test(org.junit.Test)

Example 3 with DefaultBlameOutput

use of org.sonar.scanner.scm.DefaultBlameOutput in project sonarqube by SonarSource.

the class DefaultBlameOutputTest method shouldFailIfNotExpectedFile.

@Test
public void shouldFailIfNotExpectedFile() {
    InputFile file = new TestInputFileBuilder("foo", "src/main/java/Foo.java").build();
    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("It was not expected to blame file src/main/java/Foo.java");
    new DefaultBlameOutput(null, Arrays.<InputFile>asList(new TestInputFileBuilder("foo", "src/main/java/Foo2.java").build())).blameResult(file, Arrays.asList(new BlameLine().revision("1").author("guy")));
}
Also used : TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) BlameLine(org.sonar.api.batch.scm.BlameLine) DefaultBlameOutput(org.sonar.scanner.scm.DefaultBlameOutput) InputFile(org.sonar.api.batch.fs.InputFile) Test(org.junit.Test)

Example 4 with DefaultBlameOutput

use of org.sonar.scanner.scm.DefaultBlameOutput in project sonarqube by SonarSource.

the class DefaultBlameOutputTest method shouldFailIfNullDate.

@Test
public void shouldFailIfNullDate() {
    InputFile file = new TestInputFileBuilder("foo", "src/main/java/Foo.java").setLines(1).build();
    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("Blame date is null for file src/main/java/Foo.java at line 1");
    new DefaultBlameOutput(null, Arrays.<InputFile>asList(file)).blameResult(file, Arrays.asList(new BlameLine().revision("1").author("guy")));
}
Also used : TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) BlameLine(org.sonar.api.batch.scm.BlameLine) DefaultBlameOutput(org.sonar.scanner.scm.DefaultBlameOutput) InputFile(org.sonar.api.batch.fs.InputFile) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 InputFile (org.sonar.api.batch.fs.InputFile)4 TestInputFileBuilder (org.sonar.api.batch.fs.internal.TestInputFileBuilder)4 BlameLine (org.sonar.api.batch.scm.BlameLine)4 DefaultBlameOutput (org.sonar.scanner.scm.DefaultBlameOutput)4 Date (java.util.Date)1