diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-12-09 09:34:43 -0600 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-12-10 20:46:09 +0100 |
commit | d1fd889554bccbb50122550899dbb66b90b04f78 (patch) | |
tree | 9cad838366292ee79b77ac3513403f7489b06355 /server/sonar-webserver-api | |
parent | f86a1094588e4e47b3abf612891af0431653cd0e (diff) | |
download | sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.tar.gz sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.zip |
Fix code quality issues and reduce dependency on Guava
Diffstat (limited to 'server/sonar-webserver-api')
5 files changed, 6 insertions, 11 deletions
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java index f984cd9bd1e..c8e171332a4 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java @@ -306,7 +306,7 @@ public class PluginDownloaderTest { assertThat(new File(downloadDir, "testdep-1.0.jar")).exists(); } - class HasFileName implements ArgumentMatcher<File> { + static class HasFileName implements ArgumentMatcher<File> { private final String name; HasFileName(String name) { diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java index bc353f99778..05b5a95f81b 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java @@ -40,15 +40,12 @@ public class PluginFileSystemTest { public TemporaryFolder temp = new TemporaryFolder(); private MapSettings settings = new MapSettings(); - private Path targetJarPath; - private Path targetFolder; - private Path sourceFolder; @Before public void setUp() throws IOException { - sourceFolder = temp.newFolder("source").toPath(); - targetFolder = temp.newFolder("target").toPath(); - targetJarPath = targetFolder.resolve("test.jar"); + Path sourceFolder = temp.newFolder("source").toPath(); + Path targetFolder = temp.newFolder("target").toPath(); + Path targetJarPath = targetFolder.resolve("test.jar"); Files.createFile(targetJarPath); } diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java index d6d9904452d..17c87fa7431 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java @@ -20,7 +20,6 @@ package org.sonar.server.plugins; import javax.servlet.GenericServlet; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java index 964637487fb..d27267a5c20 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java @@ -45,7 +45,6 @@ import org.sonar.db.component.ComponentDto; import org.sonar.server.qualitygate.changeevent.QGChangeEventListener.ChangedIssue; import org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.ChangedIssueImpl; -import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static java.util.Collections.emptySet; import static java.util.Collections.singletonList; @@ -307,7 +306,7 @@ public class QGChangeEventListenersImplTest { .containsOnly(expected); } - private static final String[] POSSIBLE_STATUSES = asList(Issue.STATUS_CONFIRMED, Issue.STATUS_REOPENED, Issue.STATUS_RESOLVED).stream().toArray(String[]::new); + private static final String[] POSSIBLE_STATUSES = Stream.of(Issue.STATUS_CONFIRMED, Issue.STATUS_REOPENED, Issue.STATUS_RESOLVED).toArray(String[]::new); private static int issueIdCounter = 0; private static DefaultIssue newDefaultIssue(String projectUuid) { diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java index 0fb88ee9b05..523bcd85c8e 100644 --- a/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java +++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java @@ -54,7 +54,7 @@ public class ProjectConfigurationLoaderImplTest { private ProjectConfigurationLoaderImpl underTest = new ProjectConfigurationLoaderImpl(globalSettings, dbClient); @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.openSession(anyBoolean())) .thenThrow(new IllegalStateException("ProjectConfigurationLoaderImpl should not open DB session")); when(dbClient.propertiesDao()).thenReturn(propertiesDao); |