diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-10 21:14:52 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-14 20:37:37 +0100 |
commit | d55f047c445daf698ccde5f0af9d0669804c818b (patch) | |
tree | 990d01ddad6fd40aff012e1f40bfc8ce77918670 /server/sonar-main/src | |
parent | 4a5be9fbaba0b9729e909eec935852c56f6e71e2 (diff) | |
download | sonarqube-d55f047c445daf698ccde5f0af9d0669804c818b.tar.gz sonarqube-d55f047c445daf698ccde5f0af9d0669804c818b.zip |
Cleanup code based on Intellij inspections
Diffstat (limited to 'server/sonar-main/src')
15 files changed, 23 insertions, 23 deletions
diff --git a/server/sonar-main/src/test/java/org/sonar/application/AppLoggingTest.java b/server/sonar-main/src/test/java/org/sonar/application/AppLoggingTest.java index 6d81706cc93..537e970e35d 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/AppLoggingTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/AppLoggingTest.java @@ -248,7 +248,7 @@ public class AppLoggingTest { } @Test - public void no_info_log_from_hazelcast() throws IOException { + public void no_info_log_from_hazelcast() { settings.getProps().set(CLUSTER_ENABLED, "true"); underTest.configure(); diff --git a/server/sonar-main/src/test/java/org/sonar/application/SchedulerImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/SchedulerImplTest.java index 708e8fbb2b9..dc8c597afcc 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/SchedulerImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/SchedulerImplTest.java @@ -96,7 +96,7 @@ public class SchedulerImplTest { } @After - public void tearDown() throws Exception { + public void tearDown() { processLauncher.close(); } diff --git a/server/sonar-main/src/test/java/org/sonar/application/cluster/ClusterAppStateImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/cluster/ClusterAppStateImplTest.java index 2dac6994733..262ff716687 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/cluster/ClusterAppStateImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/cluster/ClusterAppStateImplTest.java @@ -51,7 +51,7 @@ public class ClusterAppStateImplTest { public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60)); @Test - public void tryToLockWebLeader_returns_true_only_for_the_first_call() throws Exception { + public void tryToLockWebLeader_returns_true_only_for_the_first_call() { try (ClusterAppStateImpl underTest = new ClusterAppStateImpl(new TestAppSettings(), newHzMember())) { assertThat(underTest.tryToLockWebLeader()).isEqualTo(true); assertThat(underTest.tryToLockWebLeader()).isEqualTo(false); @@ -59,7 +59,7 @@ public class ClusterAppStateImplTest { } @Test - public void test_listeners() throws InterruptedException { + public void test_listeners() { AppStateListener listener = mock(AppStateListener.class); try (ClusterAppStateImpl underTest = new ClusterAppStateImpl(new TestAppSettings(), newHzMember())) { underTest.addListener(listener); @@ -106,7 +106,7 @@ public class ClusterAppStateImplTest { } @Test - public void registerSonarQubeVersion_throws_ISE_if_initial_version_is_different() throws Exception { + public void registerSonarQubeVersion_throws_ISE_if_initial_version_is_different() { // Now launch an instance that try to be part of the hzInstance cluster try (ClusterAppStateImpl underTest = new ClusterAppStateImpl(new TestAppSettings(), newHzMember())) { // Register first version @@ -121,7 +121,7 @@ public class ClusterAppStateImplTest { } @Test - public void registerClusterName_throws_MessageException_if_clusterName_is_different() throws Exception { + public void registerClusterName_throws_MessageException_if_clusterName_is_different() { try (ClusterAppStateImpl underTest = new ClusterAppStateImpl(new TestAppSettings(), newHzMember())) { // Register first version underTest.getHazelcastMember().getAtomicReference(CLUSTER_NAME).set("goodClusterName"); diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java index 4c10e3942fa..cf19a2de482 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java @@ -57,7 +57,7 @@ public class AbstractCommandTest { } @Test - public void constructor_throws_NPE_of_workDir_is_null() throws IOException { + public void constructor_throws_NPE_of_workDir_is_null() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("workDir can't be null"); diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java index 71a38bd90e6..4438fb768b6 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java @@ -63,7 +63,7 @@ public class CommandFactoryImplTest { } @After - public void tearDown() throws Exception { + public void tearDown() { if (listAppender != null) { ListAppender.detachMemoryAppenderToLoggerOf(CommandFactoryImpl.class, listAppender); } @@ -287,7 +287,7 @@ public class CommandFactoryImplTest { return newFactory(userProps, System2.INSTANCE); } - private CommandFactoryImpl newFactory(Properties userProps, System2 system2) throws IOException { + private CommandFactoryImpl newFactory(Properties userProps, System2 system2) { Properties p = new Properties(); p.setProperty("sonar.path.home", homeDir.getAbsolutePath()); p.setProperty("sonar.path.temp", tempDir.getAbsolutePath()); diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsLoaderImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsLoaderImplTest.java index cc12dc0e5e5..7261704b905 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsLoaderImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/AppSettingsLoaderImplTest.java @@ -97,7 +97,7 @@ public class AppSettingsLoaderImplTest { } @Test - public void detectHomeDir_returns_existing_dir() throws Exception { + public void detectHomeDir_returns_existing_dir() { assertThat(new AppSettingsLoaderImpl(new String[0]).getHomeDir()).exists().isDirectory(); } diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java index fbe5fb3519a..3c8abc90770 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java @@ -52,7 +52,7 @@ public class ClusterSettingsLoopbackTest { private NetworkUtils network = spy(NetworkUtilsImpl.INSTANCE); @Before - public void setUp() throws Exception { + public void setUp() { Optional<InetAddress> opt = network.getLocalNonLoopbackIpv4Address(); assumeThat(opt.isPresent(), CoreMatchers.is(true)); @@ -93,7 +93,7 @@ public class ClusterSettingsLoopbackTest { new ClusterSettings(network).accept(settings.getProps()); } - private TestAppSettings newSettingsForAppNode() throws SocketException { + private TestAppSettings newSettingsForAppNode() { return new TestAppSettings() .set(CLUSTER_ENABLED, "true") .set(CLUSTER_NODE_TYPE, "application") @@ -104,7 +104,7 @@ public class ClusterSettingsLoopbackTest { .set(JDBC_URL, "jdbc:mysql://localhost:3306/sonar"); } - private TestAppSettings newSettingsForSearchNode() throws SocketException { + private TestAppSettings newSettingsForSearchNode() { return new TestAppSettings() .set(CLUSTER_ENABLED, "true") .set(CLUSTER_NODE_TYPE, "search") diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java index 3cfc1c8bc6c..4418808b4b7 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java @@ -231,7 +231,7 @@ public class ClusterSettingsTest { new ClusterSettings(network).accept(settings.getProps()); } - private TestAppSettings newSettingsForAppNode() throws SocketException { + private TestAppSettings newSettingsForAppNode() { return new TestAppSettings() .set(CLUSTER_ENABLED, "true") .set(CLUSTER_NODE_TYPE, "application") @@ -242,7 +242,7 @@ public class ClusterSettingsTest { .set(JDBC_URL, "jdbc:mysql://localhost:3306/sonar"); } - private TestAppSettings newSettingsForSearchNode() throws SocketException { + private TestAppSettings newSettingsForSearchNode() { return new TestAppSettings() .set(CLUSTER_ENABLED, "true") .set(CLUSTER_NODE_TYPE, "search") diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/FileSystemSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/FileSystemSettingsTest.java index d4994889037..4120596bfca 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/FileSystemSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/FileSystemSettingsTest.java @@ -52,7 +52,7 @@ public class FileSystemSettingsTest { } @Test - public void relative_paths_are_converted_to_absolute_paths() throws Exception { + public void relative_paths_are_converted_to_absolute_paths() { Props props = new Props(new Properties()); props.set(PATH_HOME, homeDir.getAbsolutePath()); diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java index 125ba8a0f98..c7f89f7c33d 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java @@ -181,7 +181,7 @@ public class JdbcSettingsTest { } @Test - public void driver_dir_does_not_exist() throws Exception { + public void driver_dir_does_not_exist() { expectedException.expect(MessageException.class); expectedException.expectMessage("Directory does not exist: extensions/jdbc-driver/oracle"); diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java index 7d715511cb8..104a727146b 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java @@ -54,7 +54,7 @@ public class EsSettingsTest { private ListAppender listAppender; @After - public void tearDown() throws Exception { + public void tearDown() { if (listAppender != null) { ListAppender.detachMemoryAppenderToLoggerOf(EsSettings.class, listAppender); } @@ -82,7 +82,7 @@ public class EsSettingsTest { } @Test - public void constructor_logs_warning_if_env_variable_ES_JVM_OPTIONS_is_set_and_non_empty() throws IOException { + public void constructor_logs_warning_if_env_variable_ES_JVM_OPTIONS_is_set_and_non_empty() { this.listAppender = ListAppender.attachMemoryAppenderToLoggerOf(EsSettings.class); Props props = minimalProps(); System2 system2 = mock(System2.class); diff --git a/server/sonar-main/src/test/java/org/sonar/application/process/ProcessCommandsProcessMonitorTest.java b/server/sonar-main/src/test/java/org/sonar/application/process/ProcessCommandsProcessMonitorTest.java index 6cdd7614e55..719f2a350de 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/process/ProcessCommandsProcessMonitorTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/process/ProcessCommandsProcessMonitorTest.java @@ -65,7 +65,7 @@ public class ProcessCommandsProcessMonitorTest { } @Test - public void ProcessMonitorImpl_is_a_proxy_of_Commands() throws Exception { + public void ProcessMonitorImpl_is_a_proxy_of_Commands() { Process process = mock(Process.class, RETURNS_DEEP_STUBS); ProcessCommands commands = mock(ProcessCommands.class, RETURNS_DEEP_STUBS); diff --git a/server/sonar-main/src/test/java/org/sonar/application/process/ProcessLauncherImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/process/ProcessLauncherImplTest.java index e467eb10362..910b99d42be 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/process/ProcessLauncherImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/process/ProcessLauncherImplTest.java @@ -233,7 +233,7 @@ public class ProcessLauncherImplTest { } @Override - public Process start() throws IOException { + public Process start() { this.started = true; return mock(Process.class); } diff --git a/server/sonar-main/src/test/java/org/sonar/application/process/SQProcessTest.java b/server/sonar-main/src/test/java/org/sonar/application/process/SQProcessTest.java index 19d66737ced..376a05bfdc0 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/process/SQProcessTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/process/SQProcessTest.java @@ -235,7 +235,7 @@ public class SQProcessTest { } @Test - public void process_requests_are_listened_on_regular_basis() throws Exception { + public void process_requests_are_listened_on_regular_basis() { ProcessEventListener listener = mock(ProcessEventListener.class); SQProcess underTest = SQProcess.builder(A_PROCESS_ID) .addEventListener(listener) diff --git a/server/sonar-main/src/test/java/org/sonar/application/process/StopRequestWatcherImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/process/StopRequestWatcherImplTest.java index 973bb95158a..465b4247a8f 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/process/StopRequestWatcherImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/process/StopRequestWatcherImplTest.java @@ -53,7 +53,7 @@ public class StopRequestWatcherImplTest { private Scheduler scheduler = mock(Scheduler.class); @Test - public void do_not_watch_command_if_disabled() throws IOException { + public void do_not_watch_command_if_disabled() { enableSetting(false); StopRequestWatcherImpl underTest = new StopRequestWatcherImpl(settings, scheduler, commands); |