From 910006e96b4dd294744ee86f1f8647052141598a Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Thu, 18 Aug 2016 11:31:53 +0200 Subject: [PATCH] fix some unused variables --- .../java/org/sonar/server/ce/ws/TaskFormatter.java | 5 +---- .../org/sonar/server/ce/ws/ActivityActionTest.java | 5 ++--- .../org/sonar/server/ce/ws/ComponentActionTest.java | 5 +---- .../java/org/sonar/server/ce/ws/TaskActionTest.java | 5 +---- .../org/sonar/server/ce/ws/TaskFormatterTest.java | 11 ++--------- 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java index fddba7c4a65..0f260829843 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java @@ -33,7 +33,6 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; -import org.sonar.ce.log.CeLogging; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeActivityDto; @@ -48,12 +47,10 @@ import org.sonarqube.ws.WsCe; public class TaskFormatter { private final DbClient dbClient; - private final CeLogging ceLogging; private final System2 system2; - public TaskFormatter(DbClient dbClient, CeLogging ceLogging, System2 system2) { + public TaskFormatter(DbClient dbClient, System2 system2) { this.dbClient = dbClient; - this.ceLogging = ceLogging; this.system2 = system2; } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java index 2eb1ce43430..50cf0643a3f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java @@ -31,7 +31,6 @@ import org.junit.rules.ExpectedException; import org.sonar.api.server.ws.WebService.Param; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; -import org.sonar.ce.log.CeLogging; import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonar.core.permission.GlobalPermissions; import org.sonar.db.DbTester; @@ -67,6 +66,7 @@ import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE; public class ActivityActionTest { private static final long EXECUTED_AT = System2.INSTANCE.now(); + @Rule public ExpectedException expectedException = ExpectedException.none(); @Rule @@ -76,8 +76,7 @@ public class ActivityActionTest { ComponentDbTester componentDb = new ComponentDbTester(dbTester); - CeLogging ceLogging = mock(CeLogging.class); - TaskFormatter formatter = new TaskFormatter(dbTester.getDbClient(), ceLogging, System2.INSTANCE); + TaskFormatter formatter = new TaskFormatter(dbTester.getDbClient(), System2.INSTANCE); ActivityAction underTest = new ActivityAction(userSession, dbTester.getDbClient(), formatter, new CeTaskProcessor[] {mock(CeTaskProcessor.class)}); WsActionTester ws = new WsActionTester(underTest); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java index 282e87da55f..be96c4de481 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java @@ -23,7 +23,6 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; -import org.sonar.ce.log.CeLogging; import org.sonar.core.util.Protobuf; import org.sonar.db.DbTester; import org.sonar.db.ce.CeActivityDto; @@ -36,7 +35,6 @@ import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.WsCe; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; public class ComponentActionTest { @@ -46,8 +44,7 @@ public class ComponentActionTest { @Rule public DbTester dbTester = DbTester.create(System2.INSTANCE); - CeLogging ceLogging = mock(CeLogging.class); - TaskFormatter formatter = new TaskFormatter(dbTester.getDbClient(), ceLogging, System2.INSTANCE); + TaskFormatter formatter = new TaskFormatter(dbTester.getDbClient(), System2.INSTANCE); ComponentAction underTest = new ComponentAction(userSession, dbTester.getDbClient(), formatter); WsActionTester tester = new WsActionTester(underTest); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java index 0b18db34215..7ed877581dc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java @@ -24,7 +24,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.utils.System2; -import org.sonar.ce.log.CeLogging; import org.sonar.core.util.Protobuf; import org.sonar.db.DbTester; import org.sonar.db.ce.CeActivityDto; @@ -41,7 +40,6 @@ import org.sonarqube.ws.MediaTypes; import org.sonarqube.ws.WsCe; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; import static org.sonar.core.permission.GlobalPermissions.PROVISIONING; import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION; import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN; @@ -63,8 +61,7 @@ public class TaskActionTest { @Rule public DbTester dbTester = DbTester.create(System2.INSTANCE); - CeLogging ceLogging = mock(CeLogging.class); - TaskFormatter formatter = new TaskFormatter(dbTester.getDbClient(), ceLogging, System2.INSTANCE); + TaskFormatter formatter = new TaskFormatter(dbTester.getDbClient(), System2.INSTANCE); TaskAction underTest = new TaskAction(dbTester.getDbClient(), formatter, userSession); WsActionTester ws = new WsActionTester(underTest); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java index 6d4a2826502..0c75a8e0fd0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java @@ -24,11 +24,8 @@ import java.util.Collections; import java.util.Date; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.mockito.Mockito; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; -import org.sonar.ce.log.CeLogging; import org.sonar.db.DbTester; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; @@ -43,15 +40,11 @@ import static org.mockito.Mockito.when; public class TaskFormatterTest { - @Rule - public TemporaryFolder temp = new TemporaryFolder(); - @Rule public DbTester db = DbTester.create(System2.INSTANCE); - System2 system2 = mock(System2.class); - CeLogging ceLogging = mock(CeLogging.class, Mockito.RETURNS_DEEP_STUBS); - TaskFormatter underTest = new TaskFormatter(db.getDbClient(), ceLogging, system2); + private System2 system2 = mock(System2.class); + private TaskFormatter underTest = new TaskFormatter(db.getDbClient(), system2); @Test public void formatQueue_without_component() { -- 2.39.5