]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11438 Update title status on issue change (#937)
authorBenoit <43733395+benoit-sns@users.noreply.github.com>
Mon, 19 Nov 2018 15:27:09 +0000 (15:27 +0000)
committerSonarTech <sonartech@sonarsource.com>
Tue, 8 Jan 2019 19:21:04 +0000 (20:21 +0100)
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java

index 8c12216574c0f5cc1f9d19a39be6aab9a0cf2e92..a96565ad1658367a0f1962ad6edfb86ac61d3161 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.ce.task.projectanalysis.analysis;
 
+import java.util.Optional;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -358,4 +359,28 @@ public class AnalysisMetadataHolderImplTest {
 
     assertThat(underTest.isPullRequest()).isTrue();
   }
+
+  @Test
+  public void setScmRevisionId_throws_ISE_when_called_twice() {
+    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
+    underTest.setScmRevisionId("scm_revision_id1");
+
+    expectedException.expect(IllegalStateException.class);
+    expectedException.expectMessage("ScmRevisionId has already been set");
+    underTest.setScmRevisionId("scm_revision_id1");
+  }
+
+  @Test
+  public void getScmRevisionId_returns_empty_if_scmRevisionId_is_not_initialized() {
+    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
+
+    assertThat(underTest.getScmRevisionId()).isNotPresent();
+  }
+
+  @Test
+  public void getScmRevisionId_returns_scmRevisionId_if_scmRevisionId_is_initialized() {
+    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
+    underTest.setScmRevisionId("scm_revision_id");
+    assertThat(underTest.getScmRevisionId()).isEqualTo(Optional.of("scm_revision_id"));
+  }
 }