]> source.dussan.org Git - sonarqube.git/commitdiff
Remove redundant throws
authorDavid Gageot <david@gageot.net>
Wed, 13 May 2015 09:41:01 +0000 (11:41 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 13 May 2015 13:13:54 +0000 (15:13 +0200)
18 files changed:
server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/PluginsMonitorTest.java
server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemStatusWsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/InstalledPluginReferentialFactoryTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/MimeTypesTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/PluginReferentialMetadataConverterTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ServerPluginRepositoryTest.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingPluginsWsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RuleServiceMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/user/RubyUserSessionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ThreadLocalUserSessionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/UserSessionFilterTest.java
sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java
sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
sonar-core/src/test/java/org/sonar/core/persistence/IsAliveMapperTest.java
sonar-core/src/test/java/org/sonar/core/platform/ComponentKeysTest.java
sonar-core/src/test/java/org/sonar/core/platform/PluginInfoTest.java
sonar-core/src/test/java/org/sonar/core/platform/PluginLoaderTest.java

index bf4bc9d5596aba65eff537cbba9fde2589b5cea2..66196e232a971cbfa5c23d79d256a7ed2b497c15 100644 (file)
@@ -118,7 +118,7 @@ public class DebtModelBackupTest {
   DebtModelBackup debtModelBackup;
 
   @Before
-  public void setUp() throws Exception {
+  public void setUp() {
     userSessionRule.setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);
 
     when(system2.now()).thenReturn(now.getTime());
index 9e70d80a699e1a4c9dc5df6f2b71b49141ad1349..5019042853975d45527bbca82a989d57161ae874 100644 (file)
@@ -44,7 +44,7 @@ public class PluginsMonitorTest {
   }
 
   @Test
-  public void plugin_name_and_version() throws Exception {
+  public void plugin_name_and_version() {
     when(repo.getPluginInfos()).thenReturn(Arrays.asList(
       new PluginInfo("key-1")
         .setName("plugin-1")
index ddcdaa9f9bdee94695f8873598f3e47d05ea29e3..a64e45a95b9df9e4bfb248bfcbadbfd1d513201e 100644 (file)
@@ -69,13 +69,13 @@ public class SystemStatusWsActionTest {
   private Request request = mock(Request.class);
 
   @Before
-  public void wireMocks() throws Exception {
+  public void wireMocks() {
     when(dbClient.openSession(anyBoolean())).thenReturn(dbSession);
     when(dbSession.getMapper(IsAliveMapper.class)).thenReturn(isAliveMapper);
   }
 
   @Test
-  public void action_status_is_defined() throws Exception {
+  public void action_status_is_defined() {
     WsTester wsTester = new WsTester();
     WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY);
 
index b027737c11611ef7b89ba8f1c9915ae8a0e56a59..ce629c074760040c44e79fc90839301aecdf5a4e 100644 (file)
@@ -33,7 +33,7 @@ import static org.mockito.Mockito.when;
 public class InstalledPluginReferentialFactoryTest {
 
   @Test
-  public void should_create_plugin_referential() throws IOException {
+  public void should_create_plugin_referential() {
     PluginInfo info = new PluginInfo("foo");
     PluginRepository pluginRepository = mock(PluginRepository.class);
     when(pluginRepository.getPluginInfos()).thenReturn(newArrayList(info));
index 25b5b4978c47abe0c5be58545704d148410a4795..235831cd6feae57a7df517840f3c15b662d78f7d 100644 (file)
@@ -38,7 +38,7 @@ public class MimeTypesTest {
   }
 
   @Test
-  public void only_statics() throws Exception {
+  public void only_statics() {
     assertThat(TestUtils.hasOnlyPrivateConstructors(MimeTypes.class)).isTrue();
   }
 }
index 8afe4e72f6230d96abd9e8cabdd9e3820f4e0002..6e2a64e6ead7d466e06ba3f51f9d12ba21871658 100644 (file)
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class PluginReferentialMetadataConverterTest {
 
   @Test
-  public void should_convert_info_to_plugin_referential() throws IOException {
+  public void should_convert_info_to_plugin_referential() {
     PluginInfo info = new PluginInfo("foo");
 
     PluginReferential pluginReferential = PluginReferentialMetadataConverter.getInstalledPluginReferential(newArrayList(info));
@@ -41,7 +41,7 @@ public class PluginReferentialMetadataConverterTest {
   }
 
   @Test
-  public void should_not_add_core_plugin() throws IOException {
+  public void should_not_add_core_plugin() {
     PluginInfo info = new PluginInfo("foo").setCore(true);
 
     PluginReferential pluginReferential = PluginReferentialMetadataConverter.getInstalledPluginReferential(newArrayList(info));
index 0e114a78f75059ec07fa2625bb094ade4a3bb58d..41e3523344cf8105dff5c384010e78a1d94ff7ae 100644 (file)
@@ -74,7 +74,7 @@ public class ServerPluginRepositoryTest {
   }
 
   @After
-  public void tearDown() throws Exception {
+  public void tearDown() {
     underTest.stop();
   }
 
@@ -124,7 +124,7 @@ public class ServerPluginRepositoryTest {
    * to test sensibility to null values.
    */
   @Test
-  public void no_plugins_at_all_on_startup() throws Exception {
+  public void no_plugins_at_all_on_startup() {
     underTest.start();
 
     assertThat(underTest.getPluginInfos()).isEmpty();
@@ -301,7 +301,7 @@ public class ServerPluginRepositoryTest {
   }
 
   @Test
-  public void fail_to_get_missing_plugins() throws Exception {
+  public void fail_to_get_missing_plugins() {
     try {
       underTest.getPluginInfo("unknown");
       fail();
@@ -318,7 +318,7 @@ public class ServerPluginRepositoryTest {
   }
 
   @Test
-  public void plugin_is_incompatible_if_no_entry_point_class() throws Exception {
+  public void plugin_is_incompatible_if_no_entry_point_class() {
     PluginInfo plugin = new PluginInfo("foo").setName("Foo");
     assertThat(ServerPluginRepository.isCompatible(plugin, server, Collections.<String, PluginInfo>emptyMap())).isFalse();
     assertThat(logs.logs()).contains("Plugin Foo [foo] is ignored because entry point class is not defined");
@@ -328,7 +328,7 @@ public class ServerPluginRepositoryTest {
    * Some plugins can only extend the classloader of base plugin, without declaring new extensions.
    */
   @Test
-  public void plugin_is_compatible_if_no_entry_point_class_but_extend_other_plugin() throws Exception {
+  public void plugin_is_compatible_if_no_entry_point_class_but_extend_other_plugin() {
     PluginInfo basePlugin = new PluginInfo("base").setMainClass("org.bar.Bar");
     PluginInfo plugin = new PluginInfo("foo").setBasePlugin("base");
     Map<String, PluginInfo> plugins = ImmutableMap.of("base", basePlugin, "foo", plugin);
index bc3bea14a3ac14d89102f8e0ce07fc939a7ce5f6..a0256b3a8fb3d8266c3627c7c1ce7544805c4db0 100644 (file)
@@ -208,7 +208,7 @@ public class PendingPluginsWsActionTest {
       .setImplementationBuild("9ce9d330c313c296fab051317cc5ad4b26319e07");
   }
 
-  public PluginInfo newPluginInfo(int id) throws IOException {
+  public PluginInfo newPluginInfo(int id) {
     return new PluginInfo("key" + id).setName("name" + id);
   }
 }
index c571bf9683699cd17a1ed8446b4bc456b1460b8d..06078595bfa26c481d705d5128c88209bf18dba1 100644 (file)
@@ -244,7 +244,7 @@ public class RuleServiceMediumTest {
   }
 
   @Test(expected = UnauthorizedException.class)
-  public void do_not_delete_if_not_granted() throws Exception {
+  public void do_not_delete_if_not_granted() {
     userSessionRule.setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION);
 
     service.delete(RuleKey.of("java", "S001"));
index eb6160d5717ad4fe18fc912c9799dc89d883138c..d75a7c733b1738e8c051d8012471330eee7c4671 100644 (file)
@@ -37,7 +37,7 @@ public class RubyUserSessionTest {
   RubyUserSession underTest = new RubyUserSession(platform);
 
   @Before
-  public void setUp() throws Exception {
+  public void setUp() {
     when(platform.getContainer()).thenReturn(componentContainer);
     when(componentContainer.getComponentByType(ThreadLocalUserSession.class)).thenReturn(threadLocalUserSession);
   }
index 40a64d627ed80a386e266f3132df09445aa0610e..1b69404d8c12bfcda167c444a557373d6166d0b1 100644 (file)
@@ -34,12 +34,12 @@ public class ThreadLocalUserSessionTest {
   public ExpectedException thrown = ExpectedException.none();
 
   @Before
-  public void setUp() throws Exception {
+  public void setUp() {
     threadLocalUserSession.remove();
   }
 
   @Test
-  public void getSession_get_anonymous_by_default() throws Exception {
+  public void getSession_get_anonymous_by_default() {
     UserSession session = threadLocalUserSession.get();
 
     assertThat(session).isNotNull();
@@ -51,7 +51,7 @@ public class ThreadLocalUserSessionTest {
   }
 
   @Test
-  public void get_session() throws Exception {
+  public void get_session() {
     threadLocalUserSession.set(new MockUserSession("karadoc").setUserId(123).setLocale(Locale.FRENCH));
 
     UserSession session = threadLocalUserSession.get();
index 2b2f7c545eaadc19340cd208975d2eaf83d52ae4..52592d2460b319880b73109a90db3cb579b66f3a 100644 (file)
@@ -51,7 +51,7 @@ public class UserSessionFilterTest {
   }
 
   @After
-  public void tearDown() throws Exception {
+  public void tearDown() {
     threadLocalUserSession.remove();
   }
 
index cafee2bebf248c77dfb19305111582b01887b469..2adf1b314520b961fa7ddf954a4557b7cdb2d049 100644 (file)
@@ -39,7 +39,7 @@ public class BatchPluginRepositoryTest {
   BatchPluginRepository underTest = new BatchPluginRepository(installer, loader);
 
   @Test
-  public void install_and_load_plugins() throws Exception {
+  public void install_and_load_plugins() {
     PluginInfo info = new PluginInfo("squid");
     ImmutableMap<String, PluginInfo> infos = ImmutableMap.of("squid", info);
     Plugin instance = mock(Plugin.class);
@@ -57,7 +57,7 @@ public class BatchPluginRepositoryTest {
   }
 
   @Test
-  public void fail_if_requesting_missing_plugin() throws Exception {
+  public void fail_if_requesting_missing_plugin() {
     underTest.start();
 
     try {
index 383a93af12eb9a10e34293e404213bd93cd0346f..9b0577ec5b842bd990b4f52f6cf4adaf90c0e941 100644 (file)
@@ -262,7 +262,7 @@ public class FileSystemMediumTest {
   }
 
   @Test
-  public void scanMultiModuleProject() throws IOException {
+  public void scanMultiModuleProject() {
     File projectDir = new File("src/test/resources/mediumtest/xoo/multi-modules-sample");
     TaskResult result = tester
       .newScanTask(new File(projectDir, "sonar-project.properties"))
index ff5b27a0271e2737c1a8bdef45bcdd2bcf2ae20a..4cf93908b7e3e3d1239b72850d0744c3ae754a10 100644 (file)
@@ -38,18 +38,18 @@ public class IsAliveMapperTest {
   IsAliveMapper underTest;
 
   @Before
-  public void setUp() throws Exception {
+  public void setUp() {
     session = dbTester.myBatis().openSession(false);
     underTest = session.getMapper(IsAliveMapper.class);
   }
 
   @After
-  public void tearDown() throws Exception {
+  public void tearDown() {
     session.close();
   }
 
   @Test
-  public void isAlive_works_for_current_vendors() throws Exception {
+  public void isAlive_works_for_current_vendors() {
     assertThat(underTest.isAlive()).isEqualTo(IsAliveMapper.IS_ALIVE_RETURNED_VALUE);
   }
 }
index 431890bc012b20989acbc30ae3dd4629eb786cdd..bf8bd8dda9d17600cfeb1f26b95467d63c6779d7 100644 (file)
@@ -38,7 +38,7 @@ public class ComponentKeysTest {
   }
 
   @Test
-  public void generate_key_of_object() throws Exception {
+  public void generate_key_of_object() {
     assertThat(keys.of(new FakeComponent())).isEqualTo("org.sonar.core.platform.ComponentKeysTest.FakeComponent-fake");
   }
 
index 02cdea2aebe82976550d901a3b7eb8fa7db5b436..28b33ae338bbea8f438f73418d99c391c9387540 100644 (file)
@@ -190,7 +190,7 @@ public class PluginInfoTest {
   }
 
   @Test
-  public void create_from_file() throws Exception {
+  public void create_from_file() {
     File checkstyleJar = FileUtils.toFile(getClass().getResource("/org/sonar/core/plugins/sonar-checkstyle-plugin-2.8.jar"));
     PluginInfo checkstyleInfo = PluginInfo.create(checkstyleJar);
 
@@ -207,7 +207,7 @@ public class PluginInfoTest {
     assertThat(pluginInfo.toString()).isEqualTo("[java / 1.1 / SHA1]");
   }
 
-  PluginInfo withMinSqVersion(@Nullable String version) throws IOException {
+  PluginInfo withMinSqVersion(@Nullable String version) {
     PluginInfo pluginInfo = new PluginInfo("foo");
     if (version != null) {
       pluginInfo.setMinimalSqVersion(Version.create(version));
index c32fc2f711a42d87f576b314ec5c55fa7ef76d71..e2da9f4c85f2db592bbd2b7779e9d1f574d9d7ee 100644 (file)
@@ -43,7 +43,7 @@ public class PluginLoaderTest {
   public TemporaryFolder temp = new TemporaryFolder();
 
   @Test
-  public void load_and_unload_plugins() throws Exception {
+  public void load_and_unload_plugins() {
     File checkstyleJar = FileUtils.toFile(getClass().getResource("/org/sonar/core/plugins/sonar-checkstyle-plugin-2.8.jar"));
     PluginInfo checkstyleInfo = PluginInfo.create(checkstyleJar);