From 4244d2ea76411f80d1ce9da40eefe2781c404327 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Mon, 11 Nov 2019 15:49:12 -0600 Subject: SONAR-12679 Use single branch type --- .../sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java | 2 +- .../api/ce/posttask/PostProjectAnalysisTaskTesterTest.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'sonar-plugin-api') 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; -- cgit v1.2.3