aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2019-11-11 15:49:12 -0600
committerSonarTech <sonartech@sonarsource.com>2019-12-09 20:46:15 +0100
commit4244d2ea76411f80d1ce9da40eefe2781c404327 (patch)
treefcc91c4905c16139e40a00bf3ae6b2fd4e85caa3 /sonar-plugin-api
parentd23f59d1802814dee023ebdc68421db440cde2f2 (diff)
downloadsonarqube-4244d2ea76411f80d1ce9da40eefe2781c404327.tar.gz
sonarqube-4244d2ea76411f80d1ce9da40eefe2781c404327.zip
SONAR-12679 Use single branch type
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java10
2 files changed, 10 insertions, 2 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
index e210aae821a..bb2eb9cc85a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
@@ -412,7 +412,7 @@ public class PostProjectAnalysisTaskTester {
public static final class BranchBuilder {
private boolean isMain = true;
private String name = null;
- private Branch.Type type = Branch.Type.LONG;
+ private Branch.Type type = Branch.Type.BRANCH;
private BranchBuilder() {
// prevents instantiation outside PostProjectAnalysisTaskTester
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
index e0d8d3cb093..6b95538150f 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
@@ -33,6 +33,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import static org.sonar.api.ce.posttask.Branch.Type.BRANCH;
public class PostProjectAnalysisTaskTesterTest {
@Rule
@@ -173,7 +174,7 @@ public class PostProjectAnalysisTaskTesterTest {
PostProjectAnalysisTask projectAnalysisTask = mock(PostProjectAnalysisTask.class);
doAnswer(i -> {
PostProjectAnalysisTask.Context context = i.getArgument(0);
- expected.forEach((k,v) -> context.getLogStatistics().add(k, v));
+ expected.forEach((k, v) -> context.getLogStatistics().add(k, v));
return null;
}).when(projectAnalysisTask).finished(any(PostProjectAnalysisTask.Context.class));
PostProjectAnalysisTaskTester underTest = PostProjectAnalysisTaskTester.of(projectAnalysisTask);
@@ -184,6 +185,13 @@ public class PostProjectAnalysisTaskTesterTest {
assertThat(underTest.getLogStatistics()).isEqualTo(expected);
}
+ @Test
+ public void branch_builder_builds_branch_of_type_branch_by_default() {
+ Branch branch = PostProjectAnalysisTaskTester.newBranchBuilder().build();
+
+ assertThat(branch.getType()).isEqualTo(BRANCH);
+ }
+
private static class CaptorPostProjectAnalysisTask implements PostProjectAnalysisTask {
private ProjectAnalysis projectAnalysis;