diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2023-01-12 09:35:20 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-12 20:02:51 +0000 |
commit | 118a3ed166799831e097748f2ce8e113298ad14e (patch) | |
tree | 9ea5410359990f4ef457bf0822b5b31a770d15de /server/sonar-ce | |
parent | 0b5343ff7744ec27ed14a90e07833319719bc9a8 (diff) | |
download | sonarqube-118a3ed166799831e097748f2ce8e113298ad14e.tar.gz sonarqube-118a3ed166799831e097748f2ce8e113298ad14e.zip |
[NO JIRA] Fix quality issues related to assertions
Diffstat (limited to 'server/sonar-ce')
-rw-r--r-- | server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java | 14 | ||||
-rw-r--r-- | server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImplTest.java | 6 |
2 files changed, 11 insertions, 9 deletions
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java index cdb8b6b37b0..ec7f64a3fe7 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/monitoring/CeTasksMBeanImplTest.java @@ -123,9 +123,10 @@ public class CeTasksMBeanImplTest { public void getWorkerUuids_returns_ordered_list_of_uuids_of_worker_from_CeWorkerFactory_instance() { List<String> workerUuids = underTest.getWorkerUuids(); - assertThat(workerUuids).isEqualTo(WORKERS.stream().map(CeWorker::getUUID).sorted().collect(Collectors.toList())); - // ImmutableSet can not be serialized - assertThat(workerUuids).isNotInstanceOf(ImmutableSet.class); + assertThat(workerUuids). + isEqualTo(WORKERS.stream().map(CeWorker::getUUID).sorted().collect(Collectors.toList())) + // ImmutableSet can not be serialized + .isNotInstanceOf(ImmutableSet.class); } @Test @@ -145,9 +146,10 @@ public class CeTasksMBeanImplTest { List<String> enabledWorkerUuids = underTest.getEnabledWorkerUuids(); - assertThat(enabledWorkerUuids).isEqualTo(Stream.of(enabledWorkers).map(CeWorker::getUUID).sorted().collect(Collectors.toList())); - // ImmutableSet can not be serialized - assertThat(enabledWorkerUuids).isNotInstanceOf(ImmutableSet.class); + assertThat(enabledWorkerUuids) + .isEqualTo(Stream.of(enabledWorkers).map(CeWorker::getUUID).sorted().collect(Collectors.toList())) + // ImmutableSet can not be serialized + .isNotInstanceOf(ImmutableSet.class); } @Test diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImplTest.java index 31593cccac8..bf3e7f97514 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImplTest.java @@ -87,8 +87,8 @@ public class CeTaskProcessorRepositoryImplTest { CeTaskProcessor taskProcessor = createCeTaskProcessor(SOME_CE_TASK_TYPE); CeTaskProcessorRepositoryImpl underTest = new CeTaskProcessorRepositoryImpl(new CeTaskProcessor[] {taskProcessor}); - assertThat(underTest.getForCeTask(createCeTask(SOME_CE_TASK_TYPE, SOME_COMPONENT_KEY)).get()).isSameAs(taskProcessor); - assertThat(underTest.getForCeTask(createCeTask(SOME_CE_TASK_TYPE, SOME_COMPONENT_KEY + "2")).get()).isSameAs(taskProcessor); + assertThat(underTest.getForCeTask(createCeTask(SOME_CE_TASK_TYPE, SOME_COMPONENT_KEY))).containsSame(taskProcessor); + assertThat(underTest.getForCeTask(createCeTask(SOME_CE_TASK_TYPE, SOME_COMPONENT_KEY + "2"))).containsSame(taskProcessor); } @Test @@ -96,7 +96,7 @@ public class CeTaskProcessorRepositoryImplTest { CeTaskProcessor taskProcessor = createCeTaskProcessor(SOME_CE_TASK_TYPE + "_1", SOME_CE_TASK_TYPE, SOME_CE_TASK_TYPE + "_3"); CeTaskProcessorRepositoryImpl underTest = new CeTaskProcessorRepositoryImpl(new CeTaskProcessor[] {taskProcessor}); - assertThat(underTest.getForCeTask(createCeTask(SOME_CE_TASK_TYPE, SOME_COMPONENT_KEY)).get()).isSameAs(taskProcessor); + assertThat(underTest.getForCeTask(createCeTask(SOME_CE_TASK_TYPE, SOME_COMPONENT_KEY))).containsSame(taskProcessor); } private CeTaskProcessor createCeTaskProcessor(final String... ceTaskTypes) { |