]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9525 fix CeWorkerImplTest#verifyWorkerUuid
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 6 Jul 2017 13:00:29 +0000 (15:00 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 17 Jul 2017 08:52:47 +0000 (10:52 +0200)
server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeWorkerImplTest.java

index 73381b49dfac7591ed4bb6778f40e4c710b33bb4..5325f56771ada085ab5705f87ca4ddc16a9517db 100644 (file)
@@ -59,9 +59,10 @@ public class CeWorkerImplTest {
   private InternalCeQueue queue = mock(InternalCeQueue.class);
   private ReportTaskProcessor taskProcessor = mock(ReportTaskProcessor.class);
   private CeLogging ceLogging = spy(CeLogging.class);
-  private ArgumentCaptor<String> workerUuid = ArgumentCaptor.forClass(String.class);
+  private ArgumentCaptor<String> workerUuidCaptor = ArgumentCaptor.forClass(String.class);
   private int randomOrdinal = new Random().nextInt();
-  private CeWorker underTest = new CeWorkerImpl(randomOrdinal, UUID.randomUUID().toString(), queue, ceLogging, taskProcessorRepository);
+  private String workerUuid = UUID.randomUUID().toString();
+  private CeWorker underTest = new CeWorkerImpl(randomOrdinal, workerUuid, queue, ceLogging, taskProcessorRepository);
   private InOrder inOrder = Mockito.inOrder(ceLogging, taskProcessor, queue);
 
   @Test
@@ -237,8 +238,8 @@ public class CeWorkerImplTest {
   }
 
   private void verifyWorkerUuid() {
-    verify(queue).peek(workerUuid.capture());
-    assertThat(workerUuid.getValue()).startsWith(workerUuid.getValue());
+    verify(queue).peek(workerUuidCaptor.capture());
+    assertThat(workerUuidCaptor.getValue()).isEqualTo(workerUuid);
   }
 
   private static CeTask createCeTask(@Nullable String submitterLogin) {