aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2023-04-04 10:20:33 +0200
committersonartech <sonartech@sonarsource.com>2023-04-11 20:03:15 +0000
commitba00face3dc7fbab07c4526b8035a6f42ce2dc2d (patch)
tree7540208b6b81f7f58501712d760298a05a6b931a /server/sonar-ce-task
parent5e6f30d7c4989a683ba0e45fa39ed7dfa3b0252f (diff)
downloadsonarqube-ba00face3dc7fbab07c4526b8035a6f42ce2dc2d.tar.gz
sonarqube-ba00face3dc7fbab07c4526b8035a6f42ce2dc2d.zip
SONAR-19015 Use new log test fixtures in the sonar-plugin-api
Diffstat (limited to 'server/sonar-ce-task')
-rw-r--r--server/sonar-ce-task/build.gradle1
-rw-r--r--server/sonar-ce-task/src/test/java/org/sonar/ce/task/step/ComputationStepExecutorTest.java7
2 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-ce-task/build.gradle b/server/sonar-ce-task/build.gradle
index c8d51225ef2..c7d1127bc1d 100644
--- a/server/sonar-ce-task/build.gradle
+++ b/server/sonar-ce-task/build.gradle
@@ -38,6 +38,7 @@ dependencies {
testImplementation 'org.assertj:assertj-guava'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.reflections:reflections'
+ testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures'
testImplementation testFixtures(project(':server:sonar-db-dao'))
testFixturesApi 'org.assertj:assertj-core'
diff --git a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/step/ComputationStepExecutorTest.java b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/step/ComputationStepExecutorTest.java
index 0b8cde76160..1af78cdac9f 100644
--- a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/step/ComputationStepExecutorTest.java
+++ b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/step/ComputationStepExecutorTest.java
@@ -24,7 +24,8 @@ import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.InOrder;
-import org.sonar.api.utils.log.LogTester;
+import org.slf4j.event.Level;
+import org.sonar.api.testfixtures.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.ce.task.CeTaskInterrupter;
import org.sonar.ce.task.ChangeLogLevel;
@@ -96,7 +97,7 @@ public class ComputationStepExecutorTest {
ChangeLogLevel logLevel3 = new ChangeLogLevel(step3.getClass(), LoggerLevel.INFO)) {
new ComputationStepExecutor(mockComputationSteps(step1, step2, step3), taskInterrupter).execute();
- List<String> infoLogs = logTester.logs(LoggerLevel.INFO);
+ List<String> infoLogs = logTester.logs(Level.INFO);
assertThat(infoLogs).hasSize(3);
assertThat(infoLogs.get(0)).contains("Step One | foo=100 | bar=20 | status=SUCCESS | time=");
assertThat(infoLogs.get(1)).contains("Step Two | foo=50 | baz=10 | status=SUCCESS | time=");
@@ -126,7 +127,7 @@ public class ComputationStepExecutorTest {
new ComputationStepExecutor(mockComputationSteps(step1, step2, step3), taskInterrupter).execute();
fail("a RuntimeException should have been thrown");
} catch (RuntimeException e) {
- List<String> infoLogs = logTester.logs(LoggerLevel.INFO);
+ List<String> infoLogs = logTester.logs(Level.INFO);
assertThat(infoLogs).hasSize(3);
assertThat(infoLogs.get(0)).contains("Step One | foo=100 | bar=20 | status=SUCCESS | time=");
assertThat(infoLogs.get(1)).contains("Step Two | foo=50 | baz=10 | status=SUCCESS | time=");