From: David Gageot Date: Thu, 7 May 2015 17:04:22 +0000 (+0200) Subject: Redundant throws clause in tests X-Git-Tag: 5.2-RC1~2015 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5a587fb74fd9a8c8839b6f8582f5ff15f5183805;p=sonarqube.git Redundant throws clause in tests --- diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java index 28924a13293..716a43843b6 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/dashboards/ProjectIssuesDashboardTest.java @@ -42,7 +42,7 @@ public class ProjectIssuesDashboardTest { ProjectIssuesDashboard template; @Before - public void setUp() throws Exception { + public void setUp() { IssueFilterDao issueFilterDao = new IssueFilterDao(dbTester.myBatis()); template = new ProjectIssuesDashboard(issueFilterDao); } diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/NewAlertsTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/NewAlertsTest.java index dd35f5871cc..4dab1794650 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/NewAlertsTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/notifications/alerts/NewAlertsTest.java @@ -39,7 +39,7 @@ public class NewAlertsTest { NewAlerts dispatcher = new NewAlerts(notificationManager); @Test - public void should_not_dispatch_if_not_alerts_notification() throws Exception { + public void should_not_dispatch_if_not_alerts_notification() { Notification notification = new Notification("other-notif"); dispatcher.performDispatch(notification, context); diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewCoverageFileAnalyzerTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewCoverageFileAnalyzerTest.java index b0efe896194..75297f6578f 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewCoverageFileAnalyzerTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/NewCoverageFileAnalyzerTest.java @@ -78,7 +78,7 @@ public class NewCoverageFileAnalyzerTest { } @Test - public void shouldDoNothingIfNoScmData() throws ParseException { + public void shouldDoNothingIfNoScmData() { when(context.getMeasure(CoreMetrics.COVERAGE_LINE_HITS_DATA)) .thenReturn(new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "1=10")); @@ -87,7 +87,7 @@ public class NewCoverageFileAnalyzerTest { } @Test - public void shouldDoNothingIfNoCoverageData() throws ParseException { + public void shouldDoNothingIfNoCoverageData() { writer.writeComponentChangesets(BatchReport.Changesets.newBuilder() .setComponentRef(1) .addChangeset(Changeset.newBuilder() @@ -102,7 +102,7 @@ public class NewCoverageFileAnalyzerTest { } @Test - public void shouldGetNewLines() throws ParseException { + public void shouldGetNewLines() { when(context.getMeasure(CoreMetrics.COVERAGE_LINE_HITS_DATA)).thenReturn( new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "10=2;11=3")); writer.writeComponentChangesets(BatchReport.Changesets.newBuilder() @@ -148,7 +148,7 @@ public class NewCoverageFileAnalyzerTest { } @Test - public void shouldGetNewConditions() throws ParseException { + public void shouldGetNewConditions() { when(context.getMeasure(CoreMetrics.COVERAGE_LINE_HITS_DATA)).thenReturn( new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "10=2;11=3")); when(context.getMeasure(CoreMetrics.CONDITIONS_BY_LINE)).thenReturn( @@ -198,7 +198,7 @@ public class NewCoverageFileAnalyzerTest { } @Test - public void shouldNotGetNewConditionsWhenNewLineHasNoConditions() throws ParseException { + public void shouldNotGetNewConditionsWhenNewLineHasNoConditions() { when(context.getMeasure(CoreMetrics.COVERAGE_LINE_HITS_DATA)).thenReturn( new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "10=2;11=3")); when(context.getMeasure(CoreMetrics.CONDITIONS_BY_LINE)).thenReturn( @@ -236,7 +236,7 @@ public class NewCoverageFileAnalyzerTest { } @Test - public void shouldLeaveNullValueWhenNothingHasChanged() throws Exception { + public void shouldLeaveNullValueWhenNothingHasChanged() { when(context.getMeasure(CoreMetrics.COVERAGE_LINE_HITS_DATA)).thenReturn( new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "2=1;3=1")); diff --git a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java index cd7113e44e0..02c43eb00d2 100644 --- a/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java +++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java @@ -95,7 +95,7 @@ public class EmailNotificationChannelTest { } @Test - public void shouldThrowAnExceptionWhenUnableToSendTestEmail() throws Exception { + public void shouldThrowAnExceptionWhenUnableToSendTestEmail() { configure(); server.stop(); @@ -108,7 +108,7 @@ public class EmailNotificationChannelTest { } @Test - public void shouldNotSendEmailWhenHostnameNotConfigured() throws Exception { + public void shouldNotSendEmailWhenHostnameNotConfigured() { EmailMessage emailMessage = new EmailMessage() .setTo("user@nowhere") .setSubject("Foo") @@ -176,7 +176,7 @@ public class EmailNotificationChannelTest { } @Test - public void shouldNotThrowAnExceptionWhenUnableToSendEmail() throws Exception { + public void shouldNotThrowAnExceptionWhenUnableToSendEmail() { configure(); server.stop(); @@ -188,7 +188,7 @@ public class EmailNotificationChannelTest { } @Test - public void shouldSendTestEmailWithSTARTTLS() throws Exception { + public void shouldSendTestEmailWithSTARTTLS() { server.getServer().setEnableTLS(true); server.getServer().setRequireTLS(true); configure(); diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java index c6e96e1e3f4..d24b194dfeb 100644 --- a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java +++ b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaCommandTest.java @@ -65,7 +65,7 @@ public class JavaCommandTest { } @Test - public void add_java_options() throws Exception { + public void add_java_options() { JavaCommand command = new JavaCommand("foo"); assertThat(command.getJavaOptions()).isEmpty(); diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaProcessLauncherTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaProcessLauncherTest.java index f88481019c8..5104542e0d9 100644 --- a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaProcessLauncherTest.java +++ b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/JavaProcessLauncherTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; public class JavaProcessLauncherTest { @Test - public void fail_to_launch() throws Exception { + public void fail_to_launch() { JavaCommand command = new JavaCommand("test"); JavaProcessLauncher launcher = new JavaProcessLauncher(new Timeouts()); try { diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/MonitorTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/MonitorTest.java index e417b5fd268..57e3478162c 100644 --- a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/MonitorTest.java +++ b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/MonitorTest.java @@ -87,7 +87,7 @@ public class MonitorTest { * Safeguard */ @After - public void tearDown() throws Exception { + public void tearDown() { try { if (monitor != null) { monitor.stop(); @@ -97,7 +97,7 @@ public class MonitorTest { } @Test - public void fail_to_start_if_no_commands() throws Exception { + public void fail_to_start_if_no_commands() { monitor = newDefaultMonitor(); try { monitor.start(Collections.emptyList()); @@ -264,7 +264,7 @@ public class MonitorTest { this.httpPort = httpPort; } - JavaCommand newCommand() throws IOException { + JavaCommand newCommand() { return new JavaCommand(commandKey) .addClasspath(testJar.getAbsolutePath()) .setClassName("org.sonar.process.test.HttpProcess") @@ -313,7 +313,7 @@ public class MonitorTest { return readTimeFromFile("terminatedAt"); } - boolean wasReady() throws IOException { + boolean wasReady() { return fileExists("readyAt"); } diff --git a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/StreamGobblerTest.java b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/StreamGobblerTest.java index 16ebb2837c5..05e6dff57bf 100644 --- a/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/StreamGobblerTest.java +++ b/server/sonar-process-monitor/src/test/java/org/sonar/process/monitor/StreamGobblerTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; public class StreamGobblerTest { @Test - public void forward_stream_to_log() throws Exception { + public void forward_stream_to_log() { InputStream stream = IOUtils.toInputStream("one\nsecond log\nthird log\n"); Logger logger = mock(Logger.class); diff --git a/server/sonar-process/src/test/java/org/sonar/process/AesCipherTest.java b/server/sonar-process/src/test/java/org/sonar/process/AesCipherTest.java index 58e4d594fea..fd94c291d0a 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/AesCipherTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/AesCipherTest.java @@ -52,7 +52,7 @@ public class AesCipherTest { } @Test - public void encrypt() throws Exception { + public void encrypt() { AesCipher cipher = new AesCipher(pathToSecretKey()); String encryptedText = cipher.encrypt("this is a secret"); @@ -62,7 +62,7 @@ public class AesCipherTest { } @Test - public void encrypt_bad_key() throws Exception { + public void encrypt_bad_key() { thrown.expect(RuntimeException.class); thrown.expectMessage("Invalid AES key"); @@ -72,7 +72,7 @@ public class AesCipherTest { } @Test - public void decrypt() throws Exception { + public void decrypt() { AesCipher cipher = new AesCipher(pathToSecretKey()); // the following value has been encrypted with the key /org/sonar/api/config/AesCipherTest/aes_secret_key.txt @@ -82,7 +82,7 @@ public class AesCipherTest { } @Test - public void decrypt_bad_key() throws Exception { + public void decrypt_bad_key() { AesCipher cipher = new AesCipher(getPath("bad_secret_key.txt")); try { @@ -95,7 +95,7 @@ public class AesCipherTest { } @Test - public void decrypt_other_key() throws Exception { + public void decrypt_other_key() { AesCipher cipher = new AesCipher(getPath("other_secret_key.txt")); try { @@ -109,7 +109,7 @@ public class AesCipherTest { } @Test - public void encryptThenDecrypt() throws Exception { + public void encryptThenDecrypt() { AesCipher cipher = new AesCipher(pathToSecretKey()); assertThat(cipher.decrypt(cipher.encrypt("foo"))).isEqualTo("foo"); @@ -161,14 +161,14 @@ public class AesCipherTest { } @Test - public void hasSecretKey() throws Exception { + public void hasSecretKey() { AesCipher cipher = new AesCipher(pathToSecretKey()); assertThat(cipher.hasSecretKey()).isTrue(); } @Test - public void doesNotHaveSecretKey() throws Exception { + public void doesNotHaveSecretKey() { AesCipher cipher = new AesCipher("/my/twitter/id/is/SimonBrandhof"); assertThat(cipher.hasSecretKey()).isFalse(); @@ -178,7 +178,7 @@ public class AesCipherTest { return Resources.getResource(AesCipherTest.class, "AesCipherTest/" + file).getPath(); } - private static String pathToSecretKey() throws Exception { + private static String pathToSecretKey() { return getPath("aes_secret_key.txt"); } diff --git a/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java b/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java index 6ed9dc357cb..28cd557a3d1 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java @@ -62,7 +62,7 @@ public class ConfigurationUtilsTest { } @Test - public void loadPropsFromCommandLineArgs_missing_argument() throws Exception { + public void loadPropsFromCommandLineArgs_missing_argument() { try { ConfigurationUtils.loadPropsFromCommandLineArgs(new String[0]); fail(); @@ -95,7 +95,7 @@ public class ConfigurationUtilsTest { } @Test - public void private_constructor() throws Exception { + public void private_constructor() { assertThat(TestUtils.hasOnlyPrivateConstructors(ConfigurationUtils.class)).isTrue(); } } diff --git a/server/sonar-process/src/test/java/org/sonar/process/LifecycleTest.java b/server/sonar-process/src/test/java/org/sonar/process/LifecycleTest.java index 11b267b3e77..fdcdbb1d957 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/LifecycleTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/LifecycleTest.java @@ -27,7 +27,7 @@ import static org.sonar.process.Lifecycle.State; public class LifecycleTest { @Test - public void equals_and_hashcode() throws Exception { + public void equals_and_hashcode() { Lifecycle init = new Lifecycle(); assertThat(init.equals(init)).isTrue(); assertThat(init.equals(new Lifecycle())).isTrue(); @@ -42,7 +42,7 @@ public class LifecycleTest { } @Test - public void try_to_move() throws Exception { + public void try_to_move() { Lifecycle lifecycle = new Lifecycle(); assertThat(lifecycle.getState()).isEqualTo(State.INIT); diff --git a/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java b/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java index 753d06e67c4..e4cad8faea8 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java @@ -79,7 +79,7 @@ public class LogbackHelperTest { } @Test - public void newConsoleAppender() throws Exception { + public void newConsoleAppender() { LoggerContext ctx = sut.getRootContext(); ConsoleAppender appender = sut.newConsoleAppender(ctx, "MY_APPENDER", "%msg%n"); @@ -90,7 +90,7 @@ public class LogbackHelperTest { } @Test - public void configureLogger() throws Exception { + public void configureLogger() { LoggerContext ctx = sut.getRootContext(); Logger logger = sut.configureLogger(ctx, "my_logger", Level.WARN); @@ -100,7 +100,7 @@ public class LogbackHelperTest { } @Test - public void createRollingPolicy_defaults() throws Exception { + public void createRollingPolicy_defaults() { LoggerContext ctx = sut.getRootContext(); LogbackHelper.RollingPolicy policy = sut.createRollingPolicy(ctx, props, "sonar"); FileAppender appender = policy.createAppender("SONAR_FILE"); @@ -114,7 +114,7 @@ public class LogbackHelperTest { } @Test - public void createRollingPolicy_none() throws Exception { + public void createRollingPolicy_none() { props.set("sonar.log.rollingPolicy", "none"); LoggerContext ctx = sut.getRootContext(); LogbackHelper.RollingPolicy policy = sut.createRollingPolicy(ctx, props, "sonar"); @@ -124,7 +124,7 @@ public class LogbackHelperTest { } @Test - public void createRollingPolicy_size() throws Exception { + public void createRollingPolicy_size() { props.set("sonar.log.rollingPolicy", "size:1MB"); props.set("sonar.log.maxFiles", "20"); LoggerContext ctx = sut.getRootContext(); @@ -143,7 +143,7 @@ public class LogbackHelperTest { } @Test - public void createRollingPolicy_time() throws Exception { + public void createRollingPolicy_time() { props.set("sonar.log.rollingPolicy", "time:yyyy-MM"); props.set("sonar.log.maxFiles", "20"); @@ -159,7 +159,7 @@ public class LogbackHelperTest { } @Test - public void createRollingPolicy_fail_if_unknown_policy() throws Exception { + public void createRollingPolicy_fail_if_unknown_policy() { props.set("sonar.log.rollingPolicy", "unknown:foo"); try { LoggerContext ctx = sut.getRootContext(); diff --git a/server/sonar-process/src/test/java/org/sonar/process/LoopbackAddressTest.java b/server/sonar-process/src/test/java/org/sonar/process/LoopbackAddressTest.java index 782923d9aee..39b75fd03b0 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/LoopbackAddressTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/LoopbackAddressTest.java @@ -33,14 +33,14 @@ import static org.junit.Assert.fail; public class LoopbackAddressTest { @Test - public void get() throws Exception { + public void get() { assertThat(LoopbackAddress.get()).isNotNull(); assertThat(LoopbackAddress.get().isLoopbackAddress()).isTrue(); assertThat(LoopbackAddress.get().getHostAddress()).isNotNull(); } @Test - public void fail_to_get_loopback_address() throws Exception { + public void fail_to_get_loopback_address() { Enumeration ifaces = Iterators.asEnumeration(Collections.emptyList().iterator()); try { LoopbackAddress.doGet(ifaces); @@ -51,7 +51,7 @@ public class LoopbackAddressTest { } @Test - public void private_constructor() throws Exception { + public void private_constructor() { assertThat(TestUtils.hasOnlyPrivateConstructors(LoopbackAddress.class)).isTrue(); } } diff --git a/server/sonar-process/src/test/java/org/sonar/process/MinimumViableSystemTest.java b/server/sonar-process/src/test/java/org/sonar/process/MinimumViableSystemTest.java index de339683db6..dc2bdf2c4a6 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/MinimumViableSystemTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/MinimumViableSystemTest.java @@ -38,7 +38,7 @@ public class MinimumViableSystemTest { * Test environment does not necessarily follows all checks. */ @Test - public void check() throws Exception { + public void check() { MinimumViableSystem mve = new MinimumViableSystem(); try { @@ -50,7 +50,7 @@ public class MinimumViableSystemTest { } @Test - public void checkJavaVersion() throws Exception { + public void checkJavaVersion() { MinimumViableSystem mve = new MinimumViableSystem(); // yes, sources are compiled with a supported Java version! @@ -66,7 +66,7 @@ public class MinimumViableSystemTest { } @Test - public void checkJavaOption() throws Exception { + public void checkJavaOption() { String key = "MinimumViableEnvironmentTest.test.prop"; MinimumViableSystem mve = new MinimumViableSystem() .setRequiredJavaOption(key, "true"); diff --git a/server/sonar-process/src/test/java/org/sonar/process/NetworkUtilsTest.java b/server/sonar-process/src/test/java/org/sonar/process/NetworkUtilsTest.java index c14aa4daa9b..e5723aa99cc 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/NetworkUtilsTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/NetworkUtilsTest.java @@ -27,13 +27,13 @@ import static org.assertj.core.api.Assertions.assertThat; public class NetworkUtilsTest { @Test - public void find_free_port() throws Exception { + public void find_free_port() { int port = NetworkUtils.freePort(); assertThat(port).isGreaterThan(0); } @Test - public void find_multiple_free_port() throws Exception { + public void find_multiple_free_port() { int port1 = NetworkUtils.freePort(); int port2 = NetworkUtils.freePort(); @@ -41,7 +41,7 @@ public class NetworkUtilsTest { } @Test - public void private_constructor() throws Exception { + public void private_constructor() { assertThat(TestUtils.hasOnlyPrivateConstructors(NetworkUtils.class)).isTrue(); } } diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java index bfca7cb63ba..a24fec18704 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java @@ -70,7 +70,7 @@ public class ProcessEntryPointTest { } @Test - public void fail_to_launch_multiple_times() throws Exception { + public void fail_to_launch_multiple_times() { Props props = new Props(new Properties()); props.set(ProcessEntryPoint.PROPERTY_PROCESS_KEY, "test"); props.set(ProcessEntryPoint.PROPERTY_TERMINATION_TIMEOUT, "30000"); @@ -146,7 +146,7 @@ public class ProcessEntryPointTest { } @Test - public void terminate_if_startup_error() throws Exception { + public void terminate_if_startup_error() { Props props = new Props(new Properties()); props.set(ProcessEntryPoint.PROPERTY_PROCESS_KEY, "foo"); props.set(ProcessEntryPoint.PROPERTY_TERMINATION_TIMEOUT, "30000"); diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java index 2a8cdddd3d7..65fb20ee3fc 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ProcessPropertiesTest { @Test - public void init_defaults() throws Exception { + public void init_defaults() { Props props = new Props(new Properties()); ProcessProperties.completeDefaults(props); @@ -39,7 +39,7 @@ public class ProcessPropertiesTest { } @Test - public void do_not_override_existing_properties() throws Exception { + public void do_not_override_existing_properties() { Properties p = new Properties(); p.setProperty("sonar.jdbc.username", "angela"); Props props = new Props(p); @@ -49,7 +49,7 @@ public class ProcessPropertiesTest { } @Test - public void use_random_port_if_zero() throws Exception { + public void use_random_port_if_zero() { Properties p = new Properties(); p.setProperty("sonar.search.port", "0"); Props props = new Props(p); @@ -59,7 +59,7 @@ public class ProcessPropertiesTest { } @Test - public void private_constructor() throws Exception { + public void private_constructor() { assertThat(TestUtils.hasOnlyPrivateConstructors(ProcessProperties.class)).isTrue(); } } diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java index fa97e2ae2f4..8ac5bab177d 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ProcessUtilsTest { @Test - public void private_constructor() throws Exception { + public void private_constructor() { assertThat(TestUtils.hasOnlyPrivateConstructors(ProcessUtils.class)).isTrue(); } } diff --git a/server/sonar-process/src/test/java/org/sonar/process/PropsTest.java b/server/sonar-process/src/test/java/org/sonar/process/PropsTest.java index 8af1e96c086..0a180f3717c 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/PropsTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/PropsTest.java @@ -36,7 +36,7 @@ public class PropsTest { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void value() throws Exception { + public void value() { Properties p = new Properties(); p.setProperty("foo", "bar"); Props props = new Props(p); @@ -56,7 +56,7 @@ public class PropsTest { } @Test - public void valueAsInt() throws Exception { + public void valueAsInt() { Properties p = new Properties(); p.setProperty("foo", "33"); p.setProperty("blank", ""); @@ -71,7 +71,7 @@ public class PropsTest { } @Test - public void valueAsInt_not_integer() throws Exception { + public void valueAsInt_not_integer() { Properties p = new Properties(); p.setProperty("foo", "bar"); Props props = new Props(p); @@ -85,7 +85,7 @@ public class PropsTest { } @Test - public void booleanOf() throws Exception { + public void booleanOf() { Properties p = new Properties(); p.setProperty("foo", "True"); p.setProperty("bar", "false"); @@ -97,7 +97,7 @@ public class PropsTest { } @Test - public void booleanOf_default_value() throws Exception { + public void booleanOf_default_value() { Properties p = new Properties(); p.setProperty("foo", "true"); p.setProperty("bar", "false"); @@ -110,7 +110,7 @@ public class PropsTest { } @Test - public void setDefault() throws Exception { + public void setDefault() { Properties p = new Properties(); p.setProperty("foo", "foo_value"); Props props = new Props(p); @@ -123,7 +123,7 @@ public class PropsTest { } @Test - public void set() throws Exception { + public void set() { Properties p = new Properties(); p.setProperty("foo", "old_foo"); Props props = new Props(p); @@ -135,7 +135,7 @@ public class PropsTest { } @Test - public void raw_properties() throws Exception { + public void raw_properties() { Properties p = new Properties(); p.setProperty("encrypted_prop", "{aes}abcde"); p.setProperty("clear_prop", "foo"); diff --git a/server/sonar-process/src/test/java/org/sonar/process/SystemExitTest.java b/server/sonar-process/src/test/java/org/sonar/process/SystemExitTest.java index d2bb4e495c5..64bf66216bd 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/SystemExitTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/SystemExitTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class SystemExitTest { @Test - public void do_not_exit_if_in_shutdown_hook() throws Exception { + public void do_not_exit_if_in_shutdown_hook() { SystemExit systemExit = new SystemExit(); systemExit.setInShutdownHook(); @@ -39,7 +39,7 @@ public class SystemExitTest { } @Test - public void exit_if_not_in_shutdown_hook() throws Exception { + public void exit_if_not_in_shutdown_hook() { final AtomicInteger got = new AtomicInteger(); SystemExit systemExit = new SystemExit() { @Override diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java index f85772f7340..2a8f9e89774 100644 --- a/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java +++ b/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java @@ -39,7 +39,7 @@ public class SearchLoggingTest { } @Test - public void log_to_console() throws Exception { + public void log_to_console() { LoggerContext ctx = sut.configure(); Logger root = ctx.getLogger(Logger.ROOT_LOGGER_NAME); diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java index bd8f49b511a..92a1047889d 100644 --- a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java +++ b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java @@ -58,7 +58,7 @@ public class SearchServerTest { public TemporaryFolder temp = new TemporaryFolder(); @After - public void tearDown() throws Exception { + public void tearDown() { if (searchServer != null) { searchServer.stop(); searchServer.awaitStop(); diff --git a/server/sonar-search/src/test/java/org/sonar/search/script/UpdateListScriptTest.java b/server/sonar-search/src/test/java/org/sonar/search/script/UpdateListScriptTest.java index 0c1f603831c..06c2c355c73 100644 --- a/server/sonar-search/src/test/java/org/sonar/search/script/UpdateListScriptTest.java +++ b/server/sonar-search/src/test/java/org/sonar/search/script/UpdateListScriptTest.java @@ -37,7 +37,7 @@ public class UpdateListScriptTest { ListUpdate.UpdateListScriptFactory factory; @Before - public void setUp() throws Exception { + public void setUp() { factory = new ListUpdate.UpdateListScriptFactory(); } @@ -101,7 +101,7 @@ public class UpdateListScriptTest { } @Test - public void update_list() throws Exception { + public void update_list() { String listField = "listField"; Collection> mapFields; diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java index ded7df36c5c..460b785d64b 100644 --- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java +++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/IssueIndexBenchmarkTest.java @@ -67,7 +67,7 @@ public class IssueIndexBenchmarkTest { public Benchmark benchmark = new Benchmark(); @Test - public void benchmark() throws Exception { + public void benchmark() { // initialization - feed issues/issueAuthorization with projects and hardcoded users indexAuthorizations(); diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java index eb871e7be7c..9ecf6f4786e 100644 --- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java +++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java @@ -70,7 +70,7 @@ public class PersistFileSourcesStepTest { persistFileSources(reportDir); } - private void persistFileSources(File reportDir) throws SQLException { + private void persistFileSources(File reportDir) { LOGGER.info("Persist file sources"); DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new FileSourceDao(dbTester.myBatis())); diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceDbBenchmarkTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceDbBenchmarkTest.java index 5ce4e1e6c55..e6e8885e010 100644 --- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceDbBenchmarkTest.java +++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceDbBenchmarkTest.java @@ -116,7 +116,7 @@ public class SourceDbBenchmarkTest { return dto; } - private byte[] generateData() throws IOException { + private byte[] generateData() { FileSourceDb.Data.Builder dataBuilder = FileSourceDb.Data.newBuilder(); FileSourceDb.Line.Builder lineBuilder = FileSourceDb.Line.newBuilder(); for (int i = 1; i <= NUMBER_OF_LINES; i++) { diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java index 73943f97720..658b701874b 100644 --- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java +++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/SourceIndexBenchmarkTest.java @@ -56,7 +56,7 @@ public class SourceIndexBenchmarkTest { public Benchmark benchmark = new Benchmark(); @Test - public void benchmark() throws Exception { + public void benchmark() { // index source lines benchmarkIndexing(); diff --git a/server/sonar-server/src/test/java/org/sonar/core/computation/dbcleaner/ProjectCleanerTest.java b/server/sonar-server/src/test/java/org/sonar/core/computation/dbcleaner/ProjectCleanerTest.java index c8fceca3a3d..95a673731c5 100644 --- a/server/sonar-server/src/test/java/org/sonar/core/computation/dbcleaner/ProjectCleanerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/core/computation/dbcleaner/ProjectCleanerTest.java @@ -53,14 +53,14 @@ public class ProjectCleanerTest { private Settings settings = new Settings(); @Before - public void before() throws Exception { + public void before() { this.projectSettingsFactory = mock(ProjectSettingsFactory.class); this.sut = new ProjectCleaner(dao, periodCleaner, profiler, purgeListener, issueIndex); } @Test - public void no_profiling_when_property_is_false() throws Exception { + public void no_profiling_when_property_is_false() { settings.setProperty(CoreProperties.PROFILING_LOG_PROPERTY, false); sut.purge(mock(DbSession.class), mock(IdUuidPair.class), settings); @@ -69,14 +69,14 @@ public class ProjectCleanerTest { } @Test - public void no_indexing_when_no_issue_to_delete() throws Exception { + public void no_indexing_when_no_issue_to_delete() { sut.purge(mock(DbSession.class), mock(IdUuidPair.class), settings); verifyZeroInteractions(issueIndex); } @Test - public void profiling_when_property_is_true() throws Exception { + public void profiling_when_property_is_true() { settings.setProperty(CoreProperties.PROFILING_LOG_PROPERTY, true); sut.purge(mock(DbSession.class), mock(IdUuidPair.class), settings); @@ -85,7 +85,7 @@ public class ProjectCleanerTest { } @Test - public void call_period_cleaner_index_client_and_purge_dao() throws Exception { + public void call_period_cleaner_index_client_and_purge_dao() { settings.setProperty(DbCleanerConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES, 5); sut.purge(mock(DbSession.class), mock(IdUuidPair.class), settings); @@ -96,7 +96,7 @@ public class ProjectCleanerTest { } @Test - public void if_dao_purge_fails_it_should_not_interrupt_program_execution() throws Exception { + public void if_dao_purge_fails_it_should_not_interrupt_program_execution() { doThrow(RuntimeException.class).when(dao).purge(any(DbSession.class), any(PurgeConfiguration.class), any(PurgeListener.class)); sut.purge(mock(DbSession.class), mock(IdUuidPair.class), settings); @@ -105,7 +105,7 @@ public class ProjectCleanerTest { } @Test - public void if_profiler_cleaning_fails_it_should_not_interrupt_program_execution() throws Exception { + public void if_profiler_cleaning_fails_it_should_not_interrupt_program_execution() { doThrow(RuntimeException.class).when(periodCleaner).clean(any(DbSession.class), anyLong(), any(Settings.class)); sut.purge(mock(DbSession.class), mock(IdUuidPair.class), settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityServiceTest.java index d12d072f1f3..21a53442e81 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/activity/ActivityServiceTest.java @@ -64,7 +64,7 @@ public class ActivityServiceTest { } @Test - public void insert_and_index() throws Exception { + public void insert_and_index() { when(system.now()).thenReturn(1_500_000_000_000L); Activity activity = new Activity(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/RubyQProfileActivityServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/RubyQProfileActivityServiceTest.java index ef446052923..691b34d69a1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/activity/RubyQProfileActivityServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/activity/RubyQProfileActivityServiceTest.java @@ -57,12 +57,12 @@ public class RubyQProfileActivityServiceTest { RubyQProfileActivityService rubyQProfileActivityService; @Before - public void setUp() throws Exception { + public void setUp() { rubyQProfileActivityService = new RubyQProfileActivityService(service); } @Test - public void search() throws Exception { + public void search() { Date since = DateUtils.parseDate("2014-05-19"); Date to = DateUtils.parseDate("2014-06-19"); @@ -84,7 +84,7 @@ public class RubyQProfileActivityServiceTest { } @Test - public void search_with_empty_fields() throws Exception { + public void search_with_empty_fields() { Result result = mock(Result.class); when(result.getHits()).thenReturn(Lists.newArrayList()); when(result.getTotal()).thenReturn(10L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/db/ActivityDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/db/ActivityDaoTest.java index 2aea0522ce8..5608f473118 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/activity/db/ActivityDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/activity/db/ActivityDaoTest.java @@ -44,12 +44,12 @@ public class ActivityDaoTest { ActivityDao sut; @Before - public void before() throws Exception { + public void before() { sut = new ActivityDao(dbTester.myBatis(), system); } @Test - public void insert() throws Exception { + public void insert() { when(system.now()).thenReturn(1_500_000_000_000L); ActivityDto dto = new ActivityDto() .setKey("UUID_1").setAction("THE_ACTION").setType("THE_TYPE") diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityIndexDefinitionTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityIndexDefinitionTest.java index 3e5336d9194..c05e98cbde6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityIndexDefinitionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityIndexDefinitionTest.java @@ -32,7 +32,7 @@ public class ActivityIndexDefinitionTest { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); @Test - public void define() throws Exception { + public void define() { ActivityIndexDefinition def = new ActivityIndexDefinition(new Settings()); def.define(context); @@ -47,7 +47,7 @@ public class ActivityIndexDefinitionTest { } @Test - public void enable_cluster() throws Exception { + public void enable_cluster() { Settings settings = new Settings(); settings.setProperty(ProcessProperties.CLUSTER_ACTIVATE, true); ActivityIndexDefinition def = new ActivityIndexDefinition(settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityResultSetIteratorTest.java index b52b4fabc2e..0fae6a28d6f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/activity/index/ActivityResultSetIteratorTest.java @@ -54,7 +54,7 @@ public class ActivityResultSetIteratorTest { } @After - public void tearDown() throws Exception { + public void tearDown() { DbUtils.closeQuietly(connection); } @@ -62,7 +62,7 @@ public class ActivityResultSetIteratorTest { * Iterate over two rows in table. */ @Test - public void traverse() throws Exception { + public void traverse() { dbTester.prepareDbUnit(getClass(), "traverse.xml"); ActivityResultSetIterator it = ActivityResultSetIterator.create(client, connection, 0L); @@ -84,7 +84,7 @@ public class ActivityResultSetIteratorTest { } @Test - public void traverse_after_date() throws Exception { + public void traverse_after_date() { dbTester.prepareDbUnit(getClass(), "traverse.xml"); ActivityResultSetIterator it = ActivityResultSetIterator.create(client, connection, DateUtils.parseDate("2014-12-01").getTime()); @@ -101,7 +101,7 @@ public class ActivityResultSetIteratorTest { } @Test - public void nothing_to_traverse() throws Exception { + public void nothing_to_traverse() { dbTester.prepareDbUnit(getClass(), "traverse.xml"); ActivityResultSetIterator it = ActivityResultSetIterator.create(client, connection, DateUtils.parseDate("2030-01-01").getTime()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/activity/ws/ActivitiesWebServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/activity/ws/ActivitiesWebServiceMediumTest.java index f5462dc69fa..2bf1bb92b00 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/activity/ws/ActivitiesWebServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/activity/ws/ActivitiesWebServiceMediumTest.java @@ -40,14 +40,14 @@ public class ActivitiesWebServiceMediumTest { ActivityService service; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); ws = tester.get(ActivitiesWebService.class); service = tester.get(ActivityService.class); } @Test - public void define() throws Exception { + public void define() { WebService.Context context = new WebService.Context(); ws.define(context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/StartupLogsTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/StartupLogsTest.java index 1d85a118a00..fbf96397de0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/app/StartupLogsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/app/StartupLogsTest.java @@ -40,7 +40,7 @@ public class StartupLogsTest { StartupLogs sut = new StartupLogs(props, logger); @Test - public void logAjp() throws Exception { + public void logAjp() { Connector connector = newConnector("AJP/1.3", "http"); when(tomcat.getService().findConnectors()).thenReturn(new Connector[] {connector}); @@ -51,7 +51,7 @@ public class StartupLogsTest { } @Test - public void logHttp() throws Exception { + public void logHttp() { Connector connector = newConnector("HTTP/1.1", "http"); when(tomcat.getService().findConnectors()).thenReturn(new Connector[] {connector}); @@ -62,7 +62,7 @@ public class StartupLogsTest { } @Test - public void logHttps_default_ciphers() throws Exception { + public void logHttps_default_ciphers() { Connector connector = newConnector("HTTP/1.1", "https"); when(tomcat.getService().findConnectors()).thenReturn(new Connector[] {connector}); @@ -73,7 +73,7 @@ public class StartupLogsTest { } @Test - public void logHttps_overridden_ciphers() throws Exception { + public void logHttps_overridden_ciphers() { Connector connector = mock(Connector.class); when(connector.getScheme()).thenReturn("https"); when(connector.getPort()).thenReturn(1234); @@ -89,7 +89,7 @@ public class StartupLogsTest { } @Test - public void unsupported_connector() throws Exception { + public void unsupported_connector() { Connector connector = mock(Connector.class, Mockito.RETURNS_DEEP_STUBS); when(connector.getProtocol()).thenReturn("SPDY/1.1"); when(connector.getScheme()).thenReturn("spdy"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/TomcatConnectorsTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/TomcatConnectorsTest.java index 6c4c7d49c80..1b8452ef58a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/app/TomcatConnectorsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/app/TomcatConnectorsTest.java @@ -45,7 +45,7 @@ public class TomcatConnectorsTest { // ---- connectors @Test - public void configure_thread_pool() throws Exception { + public void configure_thread_pool() { Properties p = new Properties(); p.setProperty("sonar.web.http.minThreads", "2"); p.setProperty("sonar.web.http.maxThreads", "30"); @@ -60,7 +60,7 @@ public class TomcatConnectorsTest { } @Test - public void configure_default_thread_pool() throws Exception { + public void configure_default_thread_pool() { Props props = new Props(new Properties()); TomcatConnectors.configure(tomcat, props); @@ -71,7 +71,7 @@ public class TomcatConnectorsTest { } @Test - public void different_thread_pools_for_connectors() throws Exception { + public void different_thread_pools_for_connectors() { Properties p = new Properties(); p.setProperty("sonar.web.port", "9000"); p.setProperty("sonar.web.http.minThreads", "2"); @@ -165,7 +165,7 @@ public class TomcatConnectorsTest { } @Test - public void http_and_ajp_and_https_ports_should_be_different() throws Exception { + public void http_and_ajp_and_https_ports_should_be_different() { Properties p = new Properties(); p.setProperty("sonar.web.port", "9000"); p.setProperty("sonar.ajp.port", "9000"); @@ -180,7 +180,7 @@ public class TomcatConnectorsTest { } @Test - public void bind_to_all_addresses_by_default() throws Exception { + public void bind_to_all_addresses_by_default() { Properties p = new Properties(); p.setProperty("sonar.web.port", "9000"); p.setProperty("sonar.ajp.port", "9009"); @@ -212,7 +212,7 @@ public class TomcatConnectorsTest { } @Test - public void bind_to_specific_address() throws Exception { + public void bind_to_specific_address() { Properties p = new Properties(); p.setProperty("sonar.web.port", "9000"); p.setProperty("sonar.web.https.port", "9443"); @@ -237,7 +237,7 @@ public class TomcatConnectorsTest { } @Test - public void enable_client_auth() throws Exception { + public void enable_client_auth() { Properties p = new Properties(); @@ -259,7 +259,7 @@ public class TomcatConnectorsTest { } @Test - public void require_client_auth() throws Exception { + public void require_client_auth() { Properties p = new Properties(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/WebLoggingTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/WebLoggingTest.java index 6bc5f9c6d00..765283ebdb7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/app/WebLoggingTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/app/WebLoggingTest.java @@ -44,7 +44,7 @@ public class WebLoggingTest { } @Test - public void log_to_console() throws Exception { + public void log_to_console() { LoggerContext ctx = sut.configure(props); Logger root = ctx.getLogger(Logger.ROOT_LOGGER_NAME); @@ -58,14 +58,14 @@ public class WebLoggingTest { } @Test - public void enable_debug_logs() throws Exception { + public void enable_debug_logs() { props.set("sonar.log.level", "DEBUG"); LoggerContext ctx = sut.configure(props); assertThat(ctx.getLogger(Logger.ROOT_LOGGER_NAME).getLevel()).isEqualTo(Level.DEBUG); } @Test - public void enable_trace_logs() throws Exception { + public void enable_trace_logs() { props.set("sonar.log.level", "TRACE"); LoggerContext ctx = sut.configure(props); assertThat(ctx.getLogger(Logger.ROOT_LOGGER_NAME).getLevel()).isEqualTo(Level.TRACE); diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/WebappTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/WebappTest.java index db343c6e919..cf9b70370d1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/app/WebappTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/app/WebappTest.java @@ -74,7 +74,7 @@ public class WebappTest { } @Test - public void configure_rails_dev_mode() throws Exception { + public void configure_rails_dev_mode() { props.set("sonar.web.dev", "true"); Context context = mock(Context.class); @@ -85,7 +85,7 @@ public class WebappTest { } @Test - public void configure_production_mode() throws Exception { + public void configure_production_mode() { props.set("sonar.web.dev", "false"); Context context = mock(Context.class); @@ -96,7 +96,7 @@ public class WebappTest { } @Test - public void context_path_must_start_with_slash() throws Exception { + public void context_path_must_start_with_slash() { Properties p = new Properties(); p.setProperty("sonar.web.context", "foo"); @@ -109,7 +109,7 @@ public class WebappTest { } @Test - public void root_context_path_must_be_blank() throws Exception { + public void root_context_path_must_be_blank() { Properties p = new Properties(); p.setProperty("sonar.web.context", "/"); @@ -117,7 +117,7 @@ public class WebappTest { } @Test - public void default_context_path_is_root() throws Exception { + public void default_context_path_is_root() { String context = Webapp.getContextPath(new Props(new Properties())); assertThat(context).isEqualTo(""); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/authentication/ws/AuthenticationWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/authentication/ws/AuthenticationWsTest.java index 4fc95886c14..db10031a427 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/authentication/ws/AuthenticationWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/authentication/ws/AuthenticationWsTest.java @@ -32,7 +32,7 @@ public class AuthenticationWsTest { WsTester tester = new WsTester(new AuthenticationWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/authentication"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchIndexTest.java index 6fbf6aa4ce4..884524cc9ca 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchIndexTest.java @@ -59,7 +59,7 @@ public class BatchIndexTest { } @Test - public void get_index() throws Exception { + public void get_index() { BatchIndex batchIndex = new BatchIndex(server); batchIndex.start(); @@ -70,7 +70,7 @@ public class BatchIndexTest { } @Test - public void get_file() throws Exception { + public void get_file() { BatchIndex batchIndex = new BatchIndex(server); batchIndex.start(); @@ -83,7 +83,7 @@ public class BatchIndexTest { * /etc/passwd */ @Test - public void check_location_of_file() throws Exception { + public void check_location_of_file() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Bad filename: ../sonar-batch.jar"); @@ -94,7 +94,7 @@ public class BatchIndexTest { } @Test - public void file_does_not_exist() throws Exception { + public void file_does_not_exist() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Bad filename: other.jar"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java index 2e34503a7b5..582d4034f46 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java @@ -55,7 +55,7 @@ public class BatchWsTest { WsTester tester; @Before - public void before() throws IOException { + public void before() { tester = new WsTester(new BatchWs(batchIndex, new GlobalRepositoryAction(mock(DbClient.class), mock(PropertiesDao.class)), new ProjectRepositoryAction(mock(ProjectRepositoryLoader.class)), diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalRepositoryActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalRepositoryActionTest.java index 6548bfe6bf7..9d5ec7d2841 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalRepositoryActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalRepositoryActionTest.java @@ -60,7 +60,7 @@ public class GlobalRepositoryActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { DbClient dbClient = mock(DbClient.class); when(dbClient.openSession(false)).thenReturn(session); when(dbClient.metricDao()).thenReturn(metricDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java index efb7729e583..740b2f2c661 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java @@ -86,7 +86,7 @@ public class IssuesActionTest { IssuesAction issuesAction; @Before - public void before() throws Exception { + public void before() { db.truncateTables(); es.truncateIndices(); this.session = db.myBatis().openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryActionTest.java index 806196fb2f9..161d65ce6d9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryActionTest.java @@ -42,7 +42,7 @@ public class ProjectRepositoryActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new BatchWs(mock(BatchIndex.class), new ProjectRepositoryAction(projectRepositoryLoader))); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryLoaderMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryLoaderMediumTest.java index 79dfba70c7c..c4074ef4536 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryLoaderMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectRepositoryLoaderMediumTest.java @@ -86,7 +86,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_project_settings() throws Exception { + public void return_project_settings() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -110,7 +110,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void not_returned_secured_settings_with_only_preview_permission() throws Exception { + public void not_returned_secured_settings_with_only_preview_permission() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION).addProjectUuidPermissions(UserRole.USER, project.uuid()); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -133,7 +133,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_project_with_module_settings() throws Exception { + public void return_project_with_module_settings() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -169,7 +169,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_project_with_module_settings_inherited_from_project() throws Exception { + public void return_project_with_module_settings_inherited_from_project() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -200,7 +200,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_project_with_module_with_sub_module() throws Exception { + public void return_project_with_module_with_sub_module() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -248,7 +248,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_project_with_two_modules() throws Exception { + public void return_project_with_two_modules() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -292,7 +292,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_provisioned_project_settings() throws Exception { + public void return_provisioned_project_settings() { // No snapshot attached on the project -> provisioned project ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); @@ -313,7 +313,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_sub_module_settings() throws Exception { + public void return_sub_module_settings() { ComponentDto project = ComponentTesting.newProjectDto(); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -346,7 +346,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_sub_module_settings_including_settings_from_parent_modules() throws Exception { + public void return_sub_module_settings_including_settings_from_parent_modules() { ComponentDto project = ComponentTesting.newProjectDto(); tester.get(DbClient.class).componentDao().insert(dbSession, project); addDefaultProfile(); @@ -380,7 +380,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_sub_module_settings_only_inherited_from_project() throws Exception { + public void return_sub_module_settings_only_inherited_from_project() { ComponentDto project = ComponentTesting.newProjectDto(); tester.get(DbClient.class).componentDao().insert(dbSession, project); addDefaultProfile(); @@ -412,7 +412,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_sub_module_settings_inherited_from_project_and_module() throws Exception { + public void return_sub_module_settings_inherited_from_project_and_module() { ComponentDto project = ComponentTesting.newProjectDto(); tester.get(DbClient.class).componentDao().insert(dbSession, project); addDefaultProfile(); @@ -445,7 +445,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_quality_profile_from_project_profile() throws Exception { + public void return_quality_profile_from_project_profile() { Date ruleUpdatedAt = DateUtils.parseDateTime("2014-01-14T13:00:00+0100"); ComponentDto project = ComponentTesting.newProjectDto(); @@ -469,7 +469,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_quality_profile_from_default_profile() throws Exception { + public void return_quality_profile_from_default_profile() { Date ruleUpdatedAt = DateUtils.parseDateTime("2014-01-14T13:00:00+0100"); ComponentDto project = ComponentTesting.newProjectDto(); @@ -492,7 +492,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_quality_profile_from_given_profile_name() throws Exception { + public void return_quality_profile_from_given_profile_name() { Date ruleUpdatedAt = DateUtils.parseDateTime("2014-01-14T13:00:00+0100"); ComponentDto project = ComponentTesting.newProjectDto(); @@ -515,7 +515,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_quality_profiles_even_when_project_does_not_exists() throws Exception { + public void return_quality_profiles_even_when_project_does_not_exists() { MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); Date ruleUpdatedAt = DateUtils.parseDateTime("2014-01-14T13:00:00+0100"); @@ -535,7 +535,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_provisioned_project_profile() throws Exception { + public void return_provisioned_project_profile() { Date ruleUpdatedAt = DateUtils.parseDateTime("2014-01-14T13:00:00+0100"); // No snapshot attached on the project -> provisioned project @@ -560,7 +560,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void fail_when_no_quality_profile_for_a_language() throws Exception { + public void fail_when_no_quality_profile_for_a_language() { ComponentDto project = ComponentTesting.newProjectDto().setKey("org.codehaus.sonar:sonar"); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -575,7 +575,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_active_rules() throws Exception { + public void return_active_rules() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -610,7 +610,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_only_active_rules_from_project_profile() throws Exception { + public void return_only_active_rules_from_project_profile() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -648,7 +648,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_more_than_10_active_rules() throws Exception { + public void return_more_than_10_active_rules() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -670,7 +670,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_custom_rule() throws Exception { + public void return_custom_rule() { Date ruleUpdatedAt = DateUtils.parseDateTime("2014-01-14T13:00:00+0100"); ComponentDto project = ComponentTesting.newProjectDto(); @@ -702,7 +702,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_manual_rules() throws Exception { + public void return_manual_rules() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -723,7 +723,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void fail_if_no_permission() throws Exception { + public void fail_if_no_permission() { MockUserSession.set().setLogin("john").setGlobalPermissions(); ComponentDto project = ComponentTesting.newProjectDto(); @@ -739,7 +739,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void fail_when_not_preview_and_only_dry_run_permission() throws Exception { + public void fail_when_not_preview_and_only_dry_run_permission() { MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PREVIEW_EXECUTION); ComponentDto project = ComponentTesting.newProjectDto(); @@ -757,7 +757,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_file_data_from_single_project() throws Exception { + public void return_file_data_from_single_project() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -776,7 +776,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_file_data_from_multi_modules() throws Exception { + public void return_file_data_from_multi_modules() { ComponentDto project = ComponentTesting.newProjectDto(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); tester.get(DbClient.class).componentDao().insert(dbSession, project); @@ -803,7 +803,7 @@ public class ProjectRepositoryLoaderMediumTest { } @Test - public void return_file_data_from_module() throws Exception { + public void return_file_data_from_module() { ComponentDto project = ComponentTesting.newProjectDto(); tester.get(DbClient.class).componentDao().insert(dbSession, project); addDefaultProfile(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java index 1daa51c3dff..c2258e44af0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/UsersActionTest.java @@ -51,7 +51,7 @@ public class UsersActionTest { UsersAction usersAction; @Before - public void before() throws Exception { + public void before() { es.truncateIndices(); userIndex = new UserIndex(es.client()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentCleanerServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentCleanerServiceMediumTest.java index 5c2268872f3..9b434ba91d1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentCleanerServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentCleanerServiceMediumTest.java @@ -60,7 +60,7 @@ public class ComponentCleanerServiceMediumTest { ComponentCleanerService service; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); @@ -75,7 +75,7 @@ public class ComponentCleanerServiceMediumTest { } @Test - public void delete_project() throws Exception { + public void delete_project() { ComponentDto project = ComponentTesting.newProjectDto(); db.componentDao().insert(session, project); session.commit(); @@ -86,7 +86,7 @@ public class ComponentCleanerServiceMediumTest { } @Test - public void remove_issue_permission_index_when_deleting_a_project() throws Exception { + public void remove_issue_permission_index_when_deleting_a_project() { ComponentDto project = ComponentTesting.newProjectDto(); db.componentDao().insert(session, project); @@ -103,7 +103,7 @@ public class ComponentCleanerServiceMediumTest { } @Test - public void remove_issue_when_deleting_a_project() throws Exception { + public void remove_issue_when_deleting_a_project() { // ARRANGE ComponentDto project = ComponentTesting.newProjectDto(); db.componentDao().insert(session, project); @@ -127,7 +127,7 @@ public class ComponentCleanerServiceMediumTest { } @Test(expected = IllegalArgumentException.class) - public void fail_to_delete_not_project() throws Exception { + public void fail_to_delete_not_project() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); db.componentDao().insert(session, project, file); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentQueryTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentQueryTest.java index 0b2136f67ff..06d4ce46e01 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentQueryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentQueryTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ComponentQueryTest { @Test - public void should_build_query() throws Exception { + public void should_build_query() { ComponentQuery query = ComponentQuery.builder() .keys(newArrayList("org.codehaus")) .names(newArrayList("Sona")) @@ -48,20 +48,20 @@ public class ComponentQueryTest { } @Test - public void should_accept_null_sort() throws Exception { + public void should_accept_null_sort() { ComponentQuery query = ComponentQuery.builder().sort(null).build(); assertThat(query.sort()).isNull(); } @Test - public void should_sort_by_name_asc_by_default() throws Exception { + public void should_sort_by_name_asc_by_default() { ComponentQuery query = ComponentQuery.builder().build(); assertThat(query.sort()).isEqualTo(ComponentQuery.SORT_BY_NAME); assertThat(query.asc()).isTrue(); } @Test - public void should_throw_exception_if_sort_is_not_valid() throws Exception { + public void should_throw_exception_if_sort_is_not_valid() { try { ComponentQuery.builder() .sort("UNKNOWN") @@ -79,7 +79,7 @@ public class ComponentQueryTest { } @Test - public void should_build_non_paginated_query() throws Exception { + public void should_build_non_paginated_query() { ComponentQuery query = ComponentQuery.builder().pageSize(ComponentQuery.NO_PAGINATION).build(); assertThat(query.pageSize()).isEqualTo(ComponentQuery.NO_PAGINATION); assertThat(query.pageIndex()).isEqualTo(ComponentQuery.DEFAULT_PAGE_INDEX); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceMediumTest.java index 3ae19ea4b37..2f3d3ecc786 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceMediumTest.java @@ -62,7 +62,7 @@ public class ComponentServiceMediumTest { ComponentService service; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); session = db.openSession(false); @@ -75,33 +75,33 @@ public class ComponentServiceMediumTest { } @Test - public void get_by_key() throws Exception { + public void get_by_key() { ComponentDto project = createProject("sample:root"); assertThat(service.getByKey(project.getKey())).isNotNull(); } @Test - public void get_nullable_by_key() throws Exception { + public void get_nullable_by_key() { ComponentDto project = createProject("sample:root"); assertThat(service.getNullableByKey(project.getKey())).isNotNull(); assertThat(service.getNullableByKey("unknown")).isNull(); } @Test - public void get_by_uuid() throws Exception { + public void get_by_uuid() { ComponentDto project = createProject("sample:root"); assertThat(service.getByUuid(project.uuid())).isNotNull(); } @Test - public void get_nullable_by_uuid() throws Exception { + public void get_nullable_by_uuid() { ComponentDto project = createProject("sample:root"); assertThat(service.getNullableByUuid(project.uuid())).isNotNull(); assertThat(service.getNullableByUuid("unknown")).isNull(); } @Test - public void update_project_key() throws Exception { + public void update_project_key() { ComponentDto project = createProject("sample:root"); ComponentDto file = ComponentTesting.newFileDto(project).setKey("sample:root:src/File.xoo"); tester.get(ComponentDao.class).insert(session, file); @@ -122,7 +122,7 @@ public class ComponentServiceMediumTest { } @Test - public void update_module_key() throws Exception { + public void update_module_key() { ComponentDto project = createProject("sample:root"); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); tester.get(ComponentDao.class).insert(session, module); @@ -149,7 +149,7 @@ public class ComponentServiceMediumTest { } @Test - public void update_provisioned_project_key() throws Exception { + public void update_provisioned_project_key() { ComponentDto provisionedProject = ComponentTesting.newProjectDto().setKey("provisionedProject"); tester.get(ComponentDao.class).insert(session, provisionedProject); @@ -165,14 +165,14 @@ public class ComponentServiceMediumTest { } @Test(expected = ForbiddenException.class) - public void fail_to_update_project_key_without_admin_permission() throws Exception { + public void fail_to_update_project_key_without_admin_permission() { ComponentDto project = createProject("sample:root"); MockUserSession.set().setLogin("john").addProjectUuidPermissions(UserRole.USER, project.uuid()); service.updateKey(project.key(), "sample2:root"); } @Test - public void check_module_keys_before_renaming() throws Exception { + public void check_module_keys_before_renaming() { ComponentDto project = createProject("sample:root"); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); tester.get(ComponentDao.class).insert(session, module); @@ -191,7 +191,7 @@ public class ComponentServiceMediumTest { } @Test - public void check_module_keys_before_renaming_return_duplicate_key() throws Exception { + public void check_module_keys_before_renaming_return_duplicate_key() { ComponentDto project = createProject("sample:root"); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); tester.get(ComponentDao.class).insert(session, module); @@ -210,14 +210,14 @@ public class ComponentServiceMediumTest { } @Test(expected = ForbiddenException.class) - public void fail_to_check_module_keys_before_renaming_without_admin_permission() throws Exception { + public void fail_to_check_module_keys_before_renaming_without_admin_permission() { ComponentDto project = createProject("sample:root"); MockUserSession.set().setLogin("john").addProjectUuidPermissions(UserRole.USER, project.uuid()); service.checkModuleKeysBeforeRenaming(project.key(), "sample", "sample2"); } @Test - public void bulk_update_project_key() throws Exception { + public void bulk_update_project_key() { ComponentDto project = createProject("sample:root"); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); tester.get(ComponentDao.class).insert(session, module); @@ -245,7 +245,7 @@ public class ComponentServiceMediumTest { } @Test - public void bulk_update_provisioned_project_key() throws Exception { + public void bulk_update_provisioned_project_key() { ComponentDto provisionedProject = ComponentTesting.newProjectDto().setKey("provisionedProject"); tester.get(ComponentDao.class).insert(session, provisionedProject); @@ -261,14 +261,14 @@ public class ComponentServiceMediumTest { } @Test(expected = ForbiddenException.class) - public void fail_to_bulk_update_project_key_without_admin_permission() throws Exception { + public void fail_to_bulk_update_project_key_without_admin_permission() { ComponentDto project = createProject("sample:root"); MockUserSession.set().setLogin("john").addProjectPermissions(UserRole.USER, project.key()); service.bulkUpdateKey("sample:root", "sample", "sample2"); } @Test - public void create_project() throws Exception { + public void create_project() { executeStartupTasksToCreateDefaultPermissionTemplate(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PROVISIONING); @@ -289,7 +289,7 @@ public class ComponentServiceMediumTest { } @Test - public void create_new_project_with_branch() throws Exception { + public void create_new_project_with_branch() { executeStartupTasksToCreateDefaultPermissionTemplate(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PROVISIONING); @@ -301,7 +301,7 @@ public class ComponentServiceMediumTest { } @Test - public void create_view() throws Exception { + public void create_view() { executeStartupTasksToCreateDefaultPermissionTemplate(); MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PROVISIONING); @@ -322,7 +322,7 @@ public class ComponentServiceMediumTest { } @Test - public void fail_to_create_new_component_on_invalid_key() throws Exception { + public void fail_to_create_new_component_on_invalid_key() { MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PROVISIONING); try { @@ -335,7 +335,7 @@ public class ComponentServiceMediumTest { } @Test - public void fail_to_create_new_component_on_invalid_branch() throws Exception { + public void fail_to_create_new_component_on_invalid_branch() { MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PROVISIONING); try { @@ -348,7 +348,7 @@ public class ComponentServiceMediumTest { } @Test - public void fail_to_create_new_component_if_key_already_exists() throws Exception { + public void fail_to_create_new_component_if_key_already_exists() { MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.PROVISIONING); ComponentDto project = ComponentTesting.newProjectDto().setKey("struts"); @@ -364,7 +364,7 @@ public class ComponentServiceMediumTest { } @Test - public void should_return_project_uuids() throws Exception { + public void should_return_project_uuids() { ComponentDto project = createProject("sample:root"); String moduleKey = "sample:root:module"; ComponentDto module = ComponentTesting.newModuleDto(project).setKey(moduleKey); @@ -380,7 +380,7 @@ public class ComponentServiceMediumTest { } @Test - public void should_fail_on_components_not_found() throws Exception { + public void should_fail_on_components_not_found() { String moduleKey = "sample:root:module"; String fileKey = "sample:root:module:Foo.xoo"; @@ -393,7 +393,7 @@ public class ComponentServiceMediumTest { } @Test - public void should_fail_silently_on_components_not_found_if_told_so() throws Exception { + public void should_fail_silently_on_components_not_found_if_told_so() { String moduleKey = "sample:root:module"; String fileKey = "sample:root:module:Foo.xoo"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/DefaultComponentFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/DefaultComponentFinderTest.java index 50c4b4c4d6f..45415e798e1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/DefaultComponentFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/DefaultComponentFinderTest.java @@ -111,7 +111,7 @@ public class DefaultComponentFinderTest { } @Test - public void should_skip_pagination() throws Exception { + public void should_skip_pagination() { ComponentQuery query = ComponentQuery.builder().pageSize(ComponentQuery.NO_PAGINATION) .pageIndex(ComponentQuery.DEFAULT_PAGE_INDEX).build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentDaoTest.java index 6f62417470b..a7b643f7905 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentDaoTest.java @@ -50,14 +50,14 @@ public class ComponentDaoTest extends AbstractDaoTestCase { System2 system2; @Before - public void createDao() throws Exception { + public void createDao() { session = getMyBatis().openSession(false); system2 = mock(System2.class); dao = new ComponentDao(system2); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -294,7 +294,7 @@ public class ComponentDaoTest extends AbstractDaoTestCase { } @Test - public void find_modules_by_project() throws Exception { + public void find_modules_by_project() { setupData("multi-modules"); List results = dao.findModulesByProject("org.struts:struts", session); @@ -311,7 +311,7 @@ public class ComponentDaoTest extends AbstractDaoTestCase { } @Test - public void find_sub_projects_by_component_keys() throws Exception { + public void find_sub_projects_by_component_keys() { setupData("multi-modules"); // Sub project of a file @@ -346,7 +346,7 @@ public class ComponentDaoTest extends AbstractDaoTestCase { } @Test - public void select_enabled_modules_tree() throws Exception { + public void select_enabled_modules_tree() { setupData("multi-modules"); // From root project @@ -367,7 +367,7 @@ public class ComponentDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_modules_tree() throws Exception { + public void select_all_modules_tree() { setupData("multi-modules"); // From root project, disabled sub module is returned @@ -383,7 +383,7 @@ public class ComponentDaoTest extends AbstractDaoTestCase { } @Test - public void select_enabled_module_files_tree_from_module() throws Exception { + public void select_enabled_module_files_tree_from_module() { setupData("select_module_files_tree"); // From root project @@ -414,7 +414,7 @@ public class ComponentDaoTest extends AbstractDaoTestCase { } @Test - public void select_enabled_module_files_tree_from_project() throws Exception { + public void select_enabled_module_files_tree_from_project() { setupData("select_module_files_tree"); // From root project diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentIndexDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentIndexDaoTest.java index e830c9ef298..24a480baa0f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentIndexDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentIndexDaoTest.java @@ -42,19 +42,19 @@ public class ComponentIndexDaoTest { ComponentIndexDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dbTester.truncateTables(); session = dbTester.myBatis().openSession(false); dao = new ComponentIndexDao(); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void select_project_ids_from_query_and_view_or_sub_view_uuid() throws Exception { + public void select_project_ids_from_query_and_view_or_sub_view_uuid() { dbTester.prepareDbUnit(getClass(), "select_project_ids_from_query_and_view_or_sub_view_uuid.xml"); String viewUuid = "EFGH"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentLinkDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentLinkDaoTest.java index d8ba219baa8..f29a3ddc20b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentLinkDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/db/ComponentLinkDaoTest.java @@ -45,18 +45,18 @@ public class ComponentLinkDaoTest { ComponentLinkDao dao; @Before - public void createDao() throws Exception { + public void createDao() { session = dbTester.myBatis().openSession(false); dao = new ComponentLinkDao(); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void select_by_component_uuid() throws Exception { + public void select_by_component_uuid() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List links = dao.selectByComponentUuid(session, "ABCD"); @@ -74,7 +74,7 @@ public class ComponentLinkDaoTest { } @Test - public void insert() throws Exception { + public void insert() { dbTester.prepareDbUnit(getClass(), "empty.xml"); dao.insert(session, new ComponentLinkDto() @@ -89,7 +89,7 @@ public class ComponentLinkDaoTest { } @Test - public void update() throws Exception { + public void update() { dbTester.prepareDbUnit(getClass(), "update.xml"); dao.update(session, new ComponentLinkDto() @@ -105,7 +105,7 @@ public class ComponentLinkDaoTest { } @Test - public void delete() throws Exception { + public void delete() { dbTester.prepareDbUnit(getClass(), "delete.xml"); dao.delete(session, 1L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/db/SnapshotDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/db/SnapshotDaoTest.java index 94f8c1ca48b..1f636b2b26c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/db/SnapshotDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/db/SnapshotDaoTest.java @@ -45,14 +45,14 @@ public class SnapshotDaoTest extends AbstractDaoTestCase { System2 system2; @Before - public void createDao() throws Exception { + public void createDao() { session = getMyBatis().openSession(false); system2 = mock(System2.class); sut = new SnapshotDao(system2); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java index b7d0e949216..95610a3deb8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentAppActionTest.java @@ -91,7 +91,7 @@ public class ComponentAppActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { DbClient dbClient = mock(DbClient.class); when(dbClient.openSession(false)).thenReturn(session); when(dbClient.componentDao()).thenReturn(componentDao); @@ -189,7 +189,7 @@ public class ComponentAppActionTest { } @Test - public void fail_on_unknown_component() throws Exception { + public void fail_on_unknown_component() { MockUserSession.set().setLogin("john").addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY); when(componentDao.getNullableByUuid(session, COMPONENT_UUID)).thenReturn(null); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java index 6d216685dc7..f169e304c19 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java @@ -37,13 +37,13 @@ public class ComponentsWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new ComponentsWs(new ComponentAppAction(mock(DbClient.class), mock(Durations.class), mock(I18n.class)), new SearchAction(mock(DbClient.class)))); controller = tester.controller("api/components"); } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); assertThat(controller.since()).isEqualTo("4.2"); @@ -51,7 +51,7 @@ public class ComponentsWsTest { } @Test - public void define_suggestions_action() throws Exception { + public void define_suggestions_action() { WebService.Action action = controller.action("suggestions"); assertThat(action).isNotNull(); assertThat(action.isInternal()).isTrue(); @@ -62,7 +62,7 @@ public class ComponentsWsTest { } @Test - public void define_app_action() throws Exception { + public void define_app_action() { WebService.Action action = controller.action("app"); assertThat(action).isNotNull(); assertThat(action.isInternal()).isTrue(); @@ -72,7 +72,7 @@ public class ComponentsWsTest { } @Test - public void define_search_action() throws Exception { + public void define_search_action() { WebService.Action action = controller.action("search"); assertThat(action).isNotNull(); assertThat(action.isInternal()).isTrue(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/EventsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/EventsWsTest.java index 4246751004b..dc8a40e4831 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/EventsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/EventsWsTest.java @@ -31,7 +31,7 @@ public class EventsWsTest { WsTester tester = new WsTester(new EventsWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/events"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ProjectsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ProjectsWsTest.java index 473dd6896db..94f05808947 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ProjectsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ProjectsWsTest.java @@ -33,13 +33,13 @@ public class ProjectsWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new ProjectsWs()); controller = tester.controller("api/projects"); } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); assertThat(controller.since()).isEqualTo("2.10"); @@ -47,7 +47,7 @@ public class ProjectsWsTest { } @Test - public void define_index_action() throws Exception { + public void define_index_action() { WebService.Action action = controller.action("index"); assertThat(action).isNotNull(); assertThat(action.handler()).isInstanceOf(RailsHandler.class); @@ -56,7 +56,7 @@ public class ProjectsWsTest { } @Test - public void define_create_action() throws Exception { + public void define_create_action() { WebService.Action action = controller.action("create"); assertThat(action).isNotNull(); assertThat(action.handler()).isInstanceOf(RailsHandler.class); @@ -65,7 +65,7 @@ public class ProjectsWsTest { } @Test - public void define_destroy_action() throws Exception { + public void define_destroy_action() { WebService.Action action = controller.action("destroy"); assertThat(action).isNotNull(); assertThat(action.handler()).isInstanceOf(RailsHandler.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java index ddf33774804..4df182c329e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java @@ -33,13 +33,13 @@ public class ResourcesWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new ResourcesWs()); controller = tester.controller("api/resources"); } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("2.10"); assertThat(controller.description()).isNotEmpty(); @@ -47,7 +47,7 @@ public class ResourcesWsTest { } @Test - public void define_index_action() throws Exception { + public void define_index_action() { WebService.Action action = controller.action("index"); assertThat(action).isNotNull(); assertThat(action.handler()).isInstanceOf(RailsHandler.class); @@ -56,7 +56,7 @@ public class ResourcesWsTest { } @Test - public void define_search_action() throws Exception { + public void define_search_action() { WebService.Action action = controller.action("search"); assertThat(action).isNotNull(); assertThat(action.handler()).isInstanceOf(RailsHandler.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java index 8c8e4670c71..b3665895986 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.java @@ -47,7 +47,7 @@ public class SearchActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao(), new AuthorizationDao(dbTester.myBatis()), new ComponentIndexDao() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContainerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContainerTest.java index bd391ffbed2..43b640ddbce 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContainerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContainerTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ComputationContainerTest { @Test - public void componentClasses() throws Exception { + public void componentClasses() { assertThat(ComputationContainer.componentClasses()).isNotEmpty(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContextTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContextTest.java index 5f20e21bb36..82fe204eb8a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContextTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationContextTest.java @@ -32,7 +32,7 @@ public class ComputationContextTest { ComputationContext sut = new ComputationContext(mock(BatchReportReader.class), mock(ComponentDto.class)); @Test(expected = IllegalStateException.class) - public void setProjectSettings() throws Exception { + public void setProjectSettings() { sut.setProjectSettings(mock(Settings.class)); sut.setProjectSettings(mock(Settings.class)); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java index 5beec075d1b..d1ca0e5436a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationServiceTest.java @@ -74,7 +74,7 @@ public class ComputationServiceTest { ProjectSettingsFactory settingsFactory = mock(ProjectSettingsFactory.class, Mockito.RETURNS_DEEP_STUBS); @Before - public void setUp() throws Exception { + public void setUp() { DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao(), new SnapshotDao(system)); sut = new ComputationService(dbClient, steps, activityService, settingsFactory, tempFolder, system); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationThreadTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationThreadTest.java index 43cac0b1700..f3d0993db63 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationThreadTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationThreadTest.java @@ -66,7 +66,7 @@ public class ComputationThreadTest { } @Test - public void handle_error_during_queue_pop() throws Exception { + public void handle_error_during_queue_pop() { when(queue.pop()).thenThrow(new IllegalStateException()); sut.run(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ReportQueueTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ReportQueueTest.java index b7ffeb65311..ba5ec765781 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ReportQueueTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ReportQueueTest.java @@ -83,7 +83,7 @@ public class ReportQueueTest { } @Test - public void add_report_to_queue() throws Exception { + public void add_report_to_queue() { // must: // 1. insert metadata in db // 2. copy report content to directory /data/analysis @@ -112,7 +112,7 @@ public class ReportQueueTest { } @Test - public void find_by_project_key() throws Exception { + public void find_by_project_key() { sut.add("P1", generateData()); assertThat(sut.selectByProjectKey("P1")).hasSize(1).extracting("projectKey").containsExactly("P1"); assertThat(sut.selectByProjectKey("P2")).isEmpty(); @@ -154,7 +154,7 @@ public class ReportQueueTest { } @Test - public void do_not_pop_corrupted_item() throws Exception { + public void do_not_pop_corrupted_item() { ReportQueue.Item item = sut.add("P1", generateData()); // emulate corruption: file is missing on FS @@ -167,7 +167,7 @@ public class ReportQueueTest { } @Test - public void clear() throws Exception { + public void clear() { sut.add("P1", generateData()); sut.add("P2", generateData()); assertThat(analysisDir()).exists().isDirectory(); @@ -179,18 +179,18 @@ public class ReportQueueTest { } @Test - public void clear_do_not_fail_when_directory_do_not_exist() throws Exception { + public void clear_do_not_fail_when_directory_do_not_exist() { sut.clear(); sut.clear(); } @Test(expected = IllegalStateException.class) - public void add_on_non_existent_project() throws Exception { + public void add_on_non_existent_project() { sut.add("UNKNOWN_PROJECT_KEY", generateData()); } @Test - public void reset_to_pending_status() throws Exception { + public void reset_to_pending_status() { // 2 pending sut.add("P1", generateData()); sut.add("P2", generateData()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java index 2b34564c7b1..6e3a09a0df3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/db/AnalysisReportDaoTest.java @@ -72,7 +72,7 @@ public class AnalysisReportDaoTest { } @Test - public void insert_multiple_reports() throws Exception { + public void insert_multiple_reports() { db.prepareDbUnit(getClass(), "empty.xml"); AnalysisReportDto report1 = newDefaultAnalysisReport().setUuid("UUID_1"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueComputationTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueComputationTest.java index 7b9b56012ba..2bda0425723 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueComputationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/IssueComputationTest.java @@ -81,19 +81,19 @@ public class IssueComputationTest { } @After - public void after() throws Exception { + public void after() { sut.afterReportProcessing(); } @Test - public void store_issues_on_disk() throws Exception { + public void store_issues_on_disk() { process(); assertThat(Iterators.getOnlyElement(outputIssues.traverse()).key()).isEqualTo("ISSUE_A"); } @Test - public void copy_rule_tags_on_new_issues() throws Exception { + public void copy_rule_tags_on_new_issues() { inputIssue.setIsNew(true); rule.setTags(ImmutableSet.of("bug", "performance")); rule.setSystemTags(ImmutableSet.of("blocker")); @@ -104,7 +104,7 @@ public class IssueComputationTest { } @Test - public void do_not_copy_rule_tags_on_existing_issues() throws Exception { + public void do_not_copy_rule_tags_on_existing_issues() { inputIssue.setIsNew(false); rule.setTags(ImmutableSet.of("bug", "performance")); rule.setSystemTags(ImmutableSet.of("blocker")); @@ -115,7 +115,7 @@ public class IssueComputationTest { } @Test - public void guess_author_of_new_issues() throws Exception { + public void guess_author_of_new_issues() { inputIssue.setIsNew(true); inputIssue.setLine(3); when(lineCache.lineAuthor(3)).thenReturn("charlie"); @@ -126,7 +126,7 @@ public class IssueComputationTest { } @Test - public void do_not_fail_if_missing_author_for_new_issues() throws Exception { + public void do_not_fail_if_missing_author_for_new_issues() { inputIssue.setIsNew(true); inputIssue.setLine(3); when(lineCache.lineAuthor(3)).thenReturn(null); @@ -137,7 +137,7 @@ public class IssueComputationTest { } @Test - public void do_not_guess_author_of_existing_issues() throws Exception { + public void do_not_guess_author_of_existing_issues() { inputIssue.setIsNew(false); inputIssue.setLine(3); when(lineCache.lineAuthor(3)).thenReturn("charlie"); @@ -148,7 +148,7 @@ public class IssueComputationTest { } @Test - public void auto_assign_new_issues() throws Exception { + public void auto_assign_new_issues() { inputIssue.setIsNew(true); inputIssue.setAuthorLogin("charlie"); when(scmAccountCache.getNullable("charlie")).thenReturn("char.lie"); @@ -159,7 +159,7 @@ public class IssueComputationTest { } @Test - public void do_not_auto_assign_existing_issues() throws Exception { + public void do_not_auto_assign_existing_issues() { inputIssue.setIsNew(false); inputIssue.setAuthorLogin("charlie"); when(scmAccountCache.getNullable("charlie")).thenReturn("char.lie"); @@ -170,7 +170,7 @@ public class IssueComputationTest { } @Test - public void do_not_override_author_and_assignee_set_by_old_batch_plugins() throws Exception { + public void do_not_override_author_and_assignee_set_by_old_batch_plugins() { inputIssue.setIsNew(true); // these fields were provided during project analysis, for instance @@ -188,7 +188,7 @@ public class IssueComputationTest { } @Test - public void assign_default_assignee_when_available() throws Exception { + public void assign_default_assignee_when_available() { inputIssue.setIsNew(true); String wolinski = "wolinski"; when(context.getProjectSettings().getString(CoreProperties.DEFAULT_ISSUE_ASSIGNEE)).thenReturn(wolinski); @@ -201,7 +201,7 @@ public class IssueComputationTest { } @Test - public void do_not_assign_default_assignee_when_not_found_in_index() throws Exception { + public void do_not_assign_default_assignee_when_not_found_in_index() { inputIssue.setIsNew(true); String wolinski = "wolinski"; when(context.getProjectSettings().getString(CoreProperties.DEFAULT_ISSUE_ASSIGNEE)).thenReturn(wolinski); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheLoaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheLoaderTest.java index 5eb35e4976d..23fb6501a82 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheLoaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheLoaderTest.java @@ -38,12 +38,12 @@ public class RuleCacheLoaderTest { public static DbTester dbTester = new DbTester(); @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); } @Test - public void load_by_key() throws Exception { + public void load_by_key() { dbTester.prepareDbUnit(getClass(), "shared.xml"); DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new RuleDao()); RuleCacheLoader loader = new RuleCacheLoader(dbClient); @@ -53,7 +53,7 @@ public class RuleCacheLoaderTest { } @Test - public void load_by_keys_is_not_supported() throws Exception { + public void load_by_keys_is_not_supported() { DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new RuleDao()); RuleCacheLoader loader = new RuleCacheLoader(dbClient); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheTest.java index 9c94c3ec2c0..57172b9b9dc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/RuleCacheTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.when; public class RuleCacheTest { @Test - public void ruleName() throws Exception { + public void ruleName() { RuleCacheLoader loader = mock(RuleCacheLoader.class); when(loader.load(RuleKey.of("squid", "R002"))).thenReturn(new RuleDto().setName("Rule Two")); RuleCache cache = new RuleCache(loader); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/ScmAccountCacheLoaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/ScmAccountCacheLoaderTest.java index faa52fcbec6..6f0fd8ae6fc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/ScmAccountCacheLoaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/ScmAccountCacheLoaderTest.java @@ -41,7 +41,7 @@ public class ScmAccountCacheLoaderTest { public static EsTester esTester = new EsTester().addDefinitions(new UserIndexDefinition(new Settings())); @Before - public void setUp() throws Exception { + public void setUp() { esTester.truncateIndices(); } @@ -67,7 +67,7 @@ public class ScmAccountCacheLoaderTest { } @Test - public void load_by_multiple_scm_accounts_is_not_supported_yet() throws Exception { + public void load_by_multiple_scm_accounts_is_not_supported_yet() { UserIndex index = new UserIndex(esTester.client()); ScmAccountCacheLoader loader = new ScmAccountCacheLoader(index); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/SourceLinesCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/SourceLinesCacheTest.java index c5635716af4..84074a7b032 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/issue/SourceLinesCacheTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/issue/SourceLinesCacheTest.java @@ -59,7 +59,7 @@ public class SourceLinesCacheTest { } @Test - public void line_author_from_report() throws Exception { + public void line_author_from_report() { BatchReportWriter reportWriter = new BatchReportWriter(dir); reportWriter.writeComponentChangesets(BatchReport.Changesets.newBuilder() .setComponentRef(123_456_789) @@ -101,7 +101,7 @@ public class SourceLinesCacheTest { } @Test(expected = IllegalStateException.class) - public void fail_when_component_ref_is_not_filled() throws Exception { + public void fail_when_component_ref_is_not_filled() { sut.init("ANY_UUID", null, new BatchReportReader(dir)); sut.lineAuthor(0); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java index 38f61abee62..ef27d3ba663 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MetricCacheTest.java @@ -38,19 +38,19 @@ public class MetricCacheTest { MetricCache sut; @Before - public void setUp() throws Exception { + public void setUp() { db.prepareDbUnit(getClass(), "metrics.xml"); sut = new MetricCache(new DbClient(db.database(), db.myBatis(), new MetricDao())); } @Test - public void cache_give_access_to_enabled_metrics() throws Exception { + public void cache_give_access_to_enabled_metrics() { assertThat(sut.get("ncloc").getId()).isEqualTo(1); assertThat(sut.get("coverage").getId()).isEqualTo(2); } @Test(expected = NotFoundException.class) - public void fail_when_metric_not_found() throws Exception { + public void fail_when_metric_not_found() { sut.get("complexity"); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ComputeFileSourceDataTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ComputeFileSourceDataTest.java index 97cb70ea346..55a1137fec1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ComputeFileSourceDataTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ComputeFileSourceDataTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ComputeFileSourceDataTest { @Test - public void compute_one_line() throws Exception { + public void compute_one_line() { ComputeFileSourceData computeFileSourceData = new ComputeFileSourceData( newArrayList("line1").iterator(), Lists.newArrayList(new MockLineReader()), @@ -45,7 +45,7 @@ public class ComputeFileSourceDataTest { } @Test - public void compute_two_lines() throws Exception { + public void compute_two_lines() { ComputeFileSourceData computeFileSourceData = new ComputeFileSourceData( newArrayList("line1", "line2").iterator(), Lists.newArrayList(new MockLineReader()), @@ -61,7 +61,7 @@ public class ComputeFileSourceDataTest { } @Test - public void compute_missing_last_line() throws Exception { + public void compute_missing_last_line() { ComputeFileSourceData computeFileSourceData = new ComputeFileSourceData( newArrayList("line1").iterator(), Lists.newArrayList(new MockLineReader()), @@ -78,7 +78,7 @@ public class ComputeFileSourceDataTest { } @Test - public void remove_tabs_and_spaces_in_line_hashes() throws Exception { + public void remove_tabs_and_spaces_in_line_hashes() { String refLineHashes = new ComputeFileSourceData( newArrayList("line1").iterator(), Lists.newArrayList(new MockLineReader()), @@ -93,7 +93,7 @@ public class ComputeFileSourceDataTest { } @Test - public void compute_line_hashes_of_empty_lines() throws Exception { + public void compute_line_hashes_of_empty_lines() { assertThat(new ComputeFileSourceData( newArrayList(" ").iterator(), Lists.newArrayList(new MockLineReader()), diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/CoverageLineReaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/CoverageLineReaderTest.java index 1e8fa696cab..d1791bd1592 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/CoverageLineReaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/CoverageLineReaderTest.java @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CoverageLineReaderTest { @Test - public void set_coverage() throws Exception { + public void set_coverage() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList(BatchReport.Coverage.newBuilder() .setLine(1) .setConditions(10) @@ -56,7 +56,7 @@ public class CoverageLineReaderTest { } @Test - public void set_coverage_on_uncovered_lines() throws Exception { + public void set_coverage_on_uncovered_lines() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList(BatchReport.Coverage.newBuilder() .setLine(1) .setUtHits(false) @@ -75,7 +75,7 @@ public class CoverageLineReaderTest { } @Test - public void set_coverage_without_line_hits() throws Exception { + public void set_coverage_without_line_hits() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList(BatchReport.Coverage.newBuilder() .setLine(1) .build()).iterator()); @@ -89,7 +89,7 @@ public class CoverageLineReaderTest { } @Test - public void set_overall_line_hits_with_only_ut() throws Exception { + public void set_overall_line_hits_with_only_ut() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList(BatchReport.Coverage.newBuilder() .setLine(1) .setUtHits(true) @@ -103,7 +103,7 @@ public class CoverageLineReaderTest { } @Test - public void set_overall_line_hits_with_only_it() throws Exception { + public void set_overall_line_hits_with_only_it() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList(BatchReport.Coverage.newBuilder() .setLine(1) .setUtHits(false) @@ -117,7 +117,7 @@ public class CoverageLineReaderTest { } @Test - public void set_overall_line_hits_with_ut_and_it() throws Exception { + public void set_overall_line_hits_with_ut_and_it() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList(BatchReport.Coverage.newBuilder() .setLine(1) .setUtHits(true) @@ -131,7 +131,7 @@ public class CoverageLineReaderTest { } @Test - public void nothing_to_do_when_no_coverage_info() throws Exception { + public void nothing_to_do_when_no_coverage_info() { CoverageLineReader computeCoverageLine = new CoverageLineReader(Collections.emptyList().iterator()); FileSourceDb.Line.Builder lineBuilder = FileSourceDb.Data.newBuilder().addLinesBuilder().setLine(1); @@ -147,7 +147,7 @@ public class CoverageLineReaderTest { } @Test - public void nothing_to_do_when_no_coverage_info_for_current_line() throws Exception { + public void nothing_to_do_when_no_coverage_info_for_current_line() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList( BatchReport.Coverage.newBuilder() .setLine(1) @@ -174,7 +174,7 @@ public class CoverageLineReaderTest { } @Test - public void nothing_to_do_when_no_coverage_info_for_next_line() throws Exception { + public void nothing_to_do_when_no_coverage_info_for_next_line() { CoverageLineReader computeCoverageLine = new CoverageLineReader(newArrayList( BatchReport.Coverage.newBuilder() .setLine(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/DuplicationLineReaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/DuplicationLineReaderTest.java index 8a462856e44..8f64ab62772 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/DuplicationLineReaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/DuplicationLineReaderTest.java @@ -38,7 +38,7 @@ public class DuplicationLineReaderTest { FileSourceDb.Line.Builder line4 = sourceData.addLinesBuilder().setSource("line4").setLine(4); @Test - public void read_nothing() throws Exception { + public void read_nothing() { DuplicationLineReader reader = new DuplicationLineReader(Collections.emptyList()); reader.read(line1); @@ -47,7 +47,7 @@ public class DuplicationLineReaderTest { } @Test - public void read_duplication_with_duplicates_on_same_file() throws Exception { + public void read_duplication_with_duplicates_on_same_file() { DuplicationLineReader reader = new DuplicationLineReader(newArrayList( BatchReport.Duplication.newBuilder() .setOriginPosition(BatchReport.Range.newBuilder() @@ -75,7 +75,7 @@ public class DuplicationLineReaderTest { } @Test - public void read_duplication_with_duplicates_on_other_file() throws Exception { + public void read_duplication_with_duplicates_on_other_file() { DuplicationLineReader reader = new DuplicationLineReader(newArrayList( BatchReport.Duplication.newBuilder() .setOriginPosition(BatchReport.Range.newBuilder() @@ -104,7 +104,7 @@ public class DuplicationLineReaderTest { } @Test - public void read_duplication_with_duplicates_on_other_file_from_other_project() throws Exception { + public void read_duplication_with_duplicates_on_other_file_from_other_project() { DuplicationLineReader reader = new DuplicationLineReader(newArrayList( BatchReport.Duplication.newBuilder() .setOriginPosition(BatchReport.Range.newBuilder() @@ -133,7 +133,7 @@ public class DuplicationLineReaderTest { } @Test - public void read_many_duplications() throws Exception { + public void read_many_duplications() { DuplicationLineReader reader = new DuplicationLineReader(newArrayList( BatchReport.Duplication.newBuilder() .setOriginPosition(BatchReport.Range.newBuilder() @@ -173,7 +173,7 @@ public class DuplicationLineReaderTest { } @Test - public void should_be_sorted_by_line_block() throws Exception { + public void should_be_sorted_by_line_block() { DuplicationLineReader reader = new DuplicationLineReader(newArrayList( BatchReport.Duplication.newBuilder() .setOriginPosition(BatchReport.Range.newBuilder() @@ -213,7 +213,7 @@ public class DuplicationLineReaderTest { } @Test - public void should_be_sorted_by_line_length() throws Exception { + public void should_be_sorted_by_line_length() { DuplicationLineReader reader = new DuplicationLineReader(newArrayList( BatchReport.Duplication.newBuilder() .setOriginPosition(BatchReport.Range.newBuilder() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/RangeOffsetHelperTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/RangeOffsetHelperTest.java index 69625c5521b..8a1afbc4965 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/RangeOffsetHelperTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/RangeOffsetHelperTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Fail.failBecauseExceptionWasNotThrown; public class RangeOffsetHelperTest { @Test - public void append_range() throws Exception { + public void append_range() { assertThat(RangeOffsetHelper.offsetToString(BatchReport.Range.newBuilder() .setStartLine(1).setEndLine(1) .setStartOffset(2).setEndOffset(3) @@ -37,7 +37,7 @@ public class RangeOffsetHelperTest { } @Test - public void append_range_not_finishing_in_current_line() throws Exception { + public void append_range_not_finishing_in_current_line() { assertThat( RangeOffsetHelper.offsetToString(BatchReport.Range.newBuilder() .setStartLine(1).setEndLine(3) .setStartOffset(2).setEndOffset(3) @@ -45,7 +45,7 @@ public class RangeOffsetHelperTest { } @Test - public void append_range_that_began_in_previous_line_and_finish_in_current_line() throws Exception { + public void append_range_that_began_in_previous_line_and_finish_in_current_line() { assertThat(RangeOffsetHelper.offsetToString(BatchReport.Range.newBuilder() .setStartLine(1).setEndLine(3) .setStartOffset(2).setEndOffset(3) @@ -53,7 +53,7 @@ public class RangeOffsetHelperTest { } @Test - public void append_range_that_began_in_previous_line_and_not_finishing_in_current_line() throws Exception { + public void append_range_that_began_in_previous_line_and_not_finishing_in_current_line() { assertThat(RangeOffsetHelper.offsetToString(BatchReport.Range.newBuilder() .setStartLine(1).setEndLine(3) .setStartOffset(2).setEndOffset(3) @@ -61,7 +61,7 @@ public class RangeOffsetHelperTest { } @Test - public void do_nothing_if_offset_is_empty() throws Exception { + public void do_nothing_if_offset_is_empty() { assertThat(RangeOffsetHelper.offsetToString(BatchReport.Range.newBuilder() .setStartLine(1).setEndLine(1) .setStartOffset(0).setEndOffset(0) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ReportIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ReportIteratorTest.java index 9a0a56983f3..3919d5fdbfd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ReportIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ReportIteratorTest.java @@ -59,20 +59,20 @@ public class ReportIteratorTest { } @After - public void tearDown() throws Exception { + public void tearDown() { if (sut != null) { sut.close(); } } @Test - public void read_report() throws Exception { + public void read_report() { sut = new ReportIterator<>(file, BatchReport.Coverage.PARSER); assertThat(sut.next().getLine()).isEqualTo(1); } @Test - public void do_not_fail_when_calling_has_next_with_iterator_already_closed() throws Exception { + public void do_not_fail_when_calling_has_next_with_iterator_already_closed() { sut = new ReportIterator<>(file, BatchReport.Coverage.PARSER); assertThat(sut.next().getLine()).isEqualTo(1); assertThat(sut.hasNext()).isFalse(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java index a8db073973e..16bcd886133 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class ScmLineReaderTest { @Test - public void set_scm() throws Exception { + public void set_scm() { BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() .addChangeset(BatchReport.Changesets.Changeset.newBuilder() .setAuthor("john") @@ -51,7 +51,7 @@ public class ScmLineReaderTest { } @Test - public void set_only_author() throws Exception { + public void set_only_author() { BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() .addChangeset(BatchReport.Changesets.Changeset.newBuilder() .setAuthor("john") @@ -70,7 +70,7 @@ public class ScmLineReaderTest { } @Test - public void set_only_date() throws Exception { + public void set_only_date() { BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() .addChangeset(BatchReport.Changesets.Changeset.newBuilder() .setDate(123456789L) @@ -89,7 +89,7 @@ public class ScmLineReaderTest { } @Test - public void set_only_revision() throws Exception { + public void set_only_revision() { BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() .addChangeset(BatchReport.Changesets.Changeset.newBuilder() .setRevision("rev-1") @@ -108,7 +108,7 @@ public class ScmLineReaderTest { } @Test - public void fail_when_changeset_is_empty() throws Exception { + public void fail_when_changeset_is_empty() { BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() .addChangeset(BatchReport.Changesets.Changeset.newBuilder() .build()) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/SymbolsLineReaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/SymbolsLineReaderTest.java index 74030b083fa..dac7d1347c3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/SymbolsLineReaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/SymbolsLineReaderTest.java @@ -39,7 +39,7 @@ public class SymbolsLineReaderTest { FileSourceDb.Line.Builder line4 = sourceData.addLinesBuilder().setSource("line4").setLine(4); @Test - public void read_nothing() throws Exception { + public void read_nothing() { SymbolsLineReader symbolsLineReader = new SymbolsLineReader(Collections.emptyList()); symbolsLineReader.read(line1); @@ -48,7 +48,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols() throws Exception { + public void read_symbols() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -71,7 +71,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols_with_reference_on_same_line() throws Exception { + public void read_symbols_with_reference_on_same_line() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -90,7 +90,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols_with_two_references() throws Exception { + public void read_symbols_with_two_references() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -116,7 +116,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols_with_two_references_on_the_same_line() throws Exception { + public void read_symbols_with_two_references_on_the_same_line() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -140,7 +140,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols_when_reference_line_is_before_declaration_line() throws Exception { + public void read_symbols_when_reference_line_is_before_declaration_line() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -161,7 +161,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_many_symbols_on_lines() throws Exception { + public void read_many_symbols_on_lines() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -192,7 +192,7 @@ public class SymbolsLineReaderTest { } @Test - public void symbol_declaration_should_be_sorted_by_offset() throws Exception { + public void symbol_declaration_should_be_sorted_by_offset() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -223,7 +223,7 @@ public class SymbolsLineReaderTest { } @Test - public void symbol_declaration_should_be_sorted_by_line() throws Exception { + public void symbol_declaration_should_be_sorted_by_line() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -254,7 +254,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols_defined_on_many_lines() throws Exception { + public void read_symbols_defined_on_many_lines() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() @@ -278,7 +278,7 @@ public class SymbolsLineReaderTest { } @Test - public void read_symbols_declared_on_a_whole_line() throws Exception { + public void read_symbols_declared_on_a_whole_line() { List symbols = newArrayList( BatchReport.Symbols.Symbol.newBuilder() .setDeclaration(BatchReport.Range.newBuilder() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java index 938a2d49d48..09a793d5641 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ApplyPermissionsStepTest.java @@ -32,7 +32,7 @@ public class ApplyPermissionsStepTest extends BaseStepTest { ApplyPermissionsStep step = new ApplyPermissionsStep(indexer); @Test - public void index_issue_permissions() throws Exception { + public void index_issue_permissions() { step.execute(mock(ComputationContext.class)); verify(indexer).index(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/BaseStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/BaseStepTest.java index fa355fc4ea3..77dd05aab09 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/BaseStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/BaseStepTest.java @@ -31,10 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat; */ public abstract class BaseStepTest { - protected abstract ComputationStep step() throws IOException; + protected abstract ComputationStep step(); @Test - public void test_metadata() throws Exception { + public void test_metadata() { assertThat(step().toString()).isNotEmpty(); assertThat(step().getDescription()).isNotEmpty(); assertThat(step().supportedProjectQualifiers().length).isGreaterThan(0); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComponentUuidsCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComponentUuidsCacheTest.java index 23c124698a6..280b42f3722 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComponentUuidsCacheTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComponentUuidsCacheTest.java @@ -46,7 +46,7 @@ public class ComponentUuidsCacheTest { } @Test - public void get_uuid_from_ref() throws Exception { + public void get_uuid_from_ref() { BatchReportWriter writer = new BatchReportWriter(reportDir); writer.writeComponent(BatchReport.Component.newBuilder() .setRef(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java index 5023190cd91..493e4e153b1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java @@ -29,7 +29,7 @@ import static org.mockito.Mockito.mock; public class ComputationStepsTest { @Test - public void ordered_steps() throws Exception { + public void ordered_steps() { ComputationSteps registry = new ComputationSteps( // unordered mock(ApplyPermissionsStep.class), @@ -60,7 +60,7 @@ public class ComputationStepsTest { } @Test - public void fail_if_a_step_is_not_registered_in_picocontainer() throws Exception { + public void fail_if_a_step_is_not_registered_in_picocontainer() { try { new ComputationSteps(mock(ParseReportStep.class)); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java index ccb4223c2a5..307b6c8e1ca 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexComponentsStepTest.java @@ -36,7 +36,7 @@ public class IndexComponentsStepTest extends BaseStepTest { IndexComponentsStep sut = new IndexComponentsStep(resourceIndexerDao); @Test - public void call_indexProject_of_dao() throws IOException { + public void call_indexProject_of_dao() { ComponentDto project = mock(ComponentDto.class); when(project.getId()).thenReturn(123L); ComputationContext context = new ComputationContext(mock(BatchReportReader.class), project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexIssuesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexIssuesStepTest.java index a49f1fea668..5388cd90eea 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexIssuesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexIssuesStepTest.java @@ -33,7 +33,7 @@ public class IndexIssuesStepTest { IndexIssuesStep sut; @Test - public void call_indexers() throws Exception { + public void call_indexers() { IssueAuthorizationIndexer authorizationIndexer = mock(IssueAuthorizationIndexer.class); IssueIndexer issueIndexer = mock(IssueIndexer.class); sut = new IndexIssuesStep(authorizationIndexer, issueIndexer); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java index 1c7313091c0..59bdc546662 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexSourceLinesStepTest.java @@ -56,19 +56,19 @@ public class IndexSourceLinesStepTest extends BaseStepTest { DbClient dbClient; @Before - public void setUp() throws Exception { + public void setUp() { dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new FileSourceDao(null)); } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { SourceLineIndexer sourceLineIndexer = new SourceLineIndexer(dbClient, esTester.client()); sourceLineIndexer.setEnabled(true); return new IndexSourceLinesStep(sourceLineIndexer); } @Test - public void supported_project_qualifiers() throws Exception { + public void supported_project_qualifiers() { assertThat(step().supportedProjectQualifiers()).containsOnly(Qualifiers.PROJECT); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java index 28eb9aeaa17..fc7479c8bdb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexTestsStepTest.java @@ -56,19 +56,19 @@ public class IndexTestsStepTest extends BaseStepTest { DbClient dbClient; @Before - public void setUp() throws Exception { + public void setUp() { dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new FileSourceDao(null)); } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { TestIndexer testIndexer = new TestIndexer(dbClient, esTester.client()); testIndexer.setEnabled(true); return new IndexTestsStep(testIndexer); } @Test - public void supported_project_qualifiers() throws Exception { + public void supported_project_qualifiers() { assertThat(step().supportedProjectQualifiers()).containsOnly(Qualifiers.PROJECT); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexViewsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexViewsStepTest.java index fc1c913232a..d2d8b2b4049 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexViewsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/IndexViewsStepTest.java @@ -35,7 +35,7 @@ public class IndexViewsStepTest extends BaseStepTest { IndexViewsStep sut = new IndexViewsStep(indexer); @Test - public void index_views() throws Exception { + public void index_views() { when(context.getProject()).thenReturn(ComponentTesting.newProjectDto("ABCD").setQualifier(Qualifiers.VIEW)); sut.execute(context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentLinksStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentLinksStepTest.java index 3c7492581f2..344aba77dc1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentLinksStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistComponentLinksStepTest.java @@ -63,7 +63,7 @@ public class PersistComponentLinksStepTest extends BaseStepTest { PersistComponentLinksStep step; @Before - public void setup() throws Exception { + public void setup() { session = dbTester.myBatis().openSession(false); dao = new ComponentLinkDao(); DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), dao); @@ -79,17 +79,17 @@ public class PersistComponentLinksStepTest extends BaseStepTest { } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return step; } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void execute_only_on_projects() throws Exception { + public void execute_only_on_projects() { assertThat(step.supportedProjectQualifiers()).containsOnly("TRK"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationMeasuresStepTest.java index a482a0dd532..305ede4d72e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistDuplicationMeasuresStepTest.java @@ -76,17 +76,17 @@ public class } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return sut; } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void nothing_to_do_when_no_duplication() throws Exception { + public void nothing_to_do_when_no_duplication() { saveDuplicationMetric(); initReportWithProjectAndFile(); @@ -96,7 +96,7 @@ public class } @Test - public void persist_duplications_on_same_file() throws Exception { + public void persist_duplications_on_same_file() { MetricDto duplicationMetric = saveDuplicationMetric(); BatchReportWriter writer = initReportWithProjectAndFile(); @@ -182,7 +182,7 @@ public class } @Test - public void persist_duplications_on_same_file_linked_on_a_folder() throws Exception { + public void persist_duplications_on_same_file_linked_on_a_folder() { saveDuplicationMetric(); BatchReportWriter writer = new BatchReportWriter(reportDir); @@ -236,7 +236,7 @@ public class } @Test - public void persist_duplications_on_same_file_linked_on_sub_folder() throws Exception { + public void persist_duplications_on_same_file_linked_on_sub_folder() { saveDuplicationMetric(); BatchReportWriter writer = new BatchReportWriter(reportDir); @@ -346,7 +346,7 @@ public class } @Test - public void persist_duplications_on_different_files() throws Exception { + public void persist_duplications_on_different_files() { saveDuplicationMetric(); BatchReportWriter writer = initReportWithProjectAndFile(); @@ -382,7 +382,7 @@ public class } @Test - public void persist_duplications_on_different_projects() throws Exception { + public void persist_duplications_on_different_projects() { saveDuplicationMetric(); BatchReportWriter writer = initReportWithProjectAndFile(); @@ -410,7 +410,7 @@ public class assertThat(dto.get("textValue")).isEqualTo(""); } - private BatchReportWriter initReportWithProjectAndFile() throws IOException { + private BatchReportWriter initReportWithProjectAndFile() { BatchReportWriter writer = new BatchReportWriter(reportDir); writer.writeMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java index 9482e655740..35b45d6fce3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistEventsStepTest.java @@ -61,7 +61,7 @@ public class PersistEventsStepTest extends BaseStepTest { PersistEventsStep step; @Before - public void setup() throws Exception { + public void setup() { session = dbTester.myBatis().openSession(false); dao = new EventDao(); DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), dao); @@ -73,17 +73,17 @@ public class PersistEventsStepTest extends BaseStepTest { } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return step; } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void execute_only_on_projects() throws Exception { + public void execute_only_on_projects() { assertThat(step.supportedProjectQualifiers()).containsOnly("TRK"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileDependenciesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileDependenciesStepTest.java index b22b133334e..0c1cedfbf1b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileDependenciesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileDependenciesStepTest.java @@ -94,22 +94,22 @@ public class PersistFileDependenciesStepTest extends BaseStepTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return new PersistFileDependenciesStep(dbClient, system2); } @Test - public void supported_project_qualifiers() throws Exception { + public void supported_project_qualifiers() { assertThat(step().supportedProjectQualifiers()).containsOnly(Qualifiers.PROJECT); } @Test - public void persist_file_dependencies() throws Exception { + public void persist_file_dependencies() { writer.writeComponent(BatchReport.Component.newBuilder() .setRef(1) .setType(Constants.ComponentType.PROJECT) @@ -164,7 +164,7 @@ public class PersistFileDependenciesStepTest extends BaseStepTest { } @Test - public void nothing_to_persist() throws Exception { + public void nothing_to_persist() { writer.writeComponent(BatchReport.Component.newBuilder() .setRef(1) .setType(Constants.ComponentType.PROJECT) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java index f39c2511d51..d66e24ad040 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java @@ -96,12 +96,12 @@ public class PersistFileSourcesStepTest extends BaseStepTest { } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return sut; } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistIssuesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistIssuesStepTest.java index 717f8a61eda..e3b49033a05 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistIssuesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistIssuesStepTest.java @@ -63,7 +63,7 @@ public class PersistIssuesStepTest extends BaseStepTest { ComputationStep step; @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return step; } @@ -80,12 +80,12 @@ public class PersistIssuesStepTest extends BaseStepTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void insert_new_issue() throws Exception { + public void insert_new_issue() { dbTester.prepareDbUnit(getClass(), "insert_new_issue.xml"); issueCache.newAppender().append(new DefaultIssue() @@ -104,7 +104,7 @@ public class PersistIssuesStepTest extends BaseStepTest { } @Test - public void close_issue() throws Exception { + public void close_issue() { dbTester.prepareDbUnit(getClass(), "shared.xml"); issueCache.newAppender().append(new DefaultIssue() @@ -125,7 +125,7 @@ public class PersistIssuesStepTest extends BaseStepTest { } @Test - public void add_comment() throws Exception { + public void add_comment() { dbTester.prepareDbUnit(getClass(), "shared.xml"); issueCache.newAppender().append(new DefaultIssue() @@ -153,7 +153,7 @@ public class PersistIssuesStepTest extends BaseStepTest { } @Test - public void add_change() throws Exception { + public void add_change() { dbTester.prepareDbUnit(getClass(), "shared.xml"); issueCache.newAppender().append(new DefaultIssue() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java index d51b38deb45..24b307da440 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java @@ -67,7 +67,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { private BatchReport.Component component; @Before - public void setUp() throws Exception { + public void setUp() { dbClient = mock(DbClient.class, Mockito.RETURNS_DEEP_STUBS); ruleCache = mock(RuleCache.class, Mockito.RETURNS_DEEP_STUBS); metricCache = mock(MetricCache.class, Mockito.RETURNS_DEEP_STUBS); @@ -156,7 +156,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test - public void map_full_batch_measure() throws Exception { + public void map_full_batch_measure() { BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder() .setValueType(Constants.MeasureValueType.DOUBLE) .setDoubleValue(123.123d) @@ -181,7 +181,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test - public void map_minimal_batch_measure() throws Exception { + public void map_minimal_batch_measure() { BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder() .setValueType(Constants.MeasureValueType.INT) .setMetricKey("metric-key") @@ -193,7 +193,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test - public void map_boolean_batch_measure() throws Exception { + public void map_boolean_batch_measure() { BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder() .setValueType(Constants.MeasureValueType.BOOLEAN) .setBooleanValue(true) @@ -225,7 +225,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test - public void map_double_batch_measure() throws Exception { + public void map_double_batch_measure() { BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder() .setValueType(Constants.MeasureValueType.DOUBLE) .setDoubleValue(3.2) @@ -247,7 +247,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test - public void map_int_batch_measure() throws Exception { + public void map_int_batch_measure() { BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder() .setValueType(Constants.MeasureValueType.INT) .setIntValue(3) @@ -269,7 +269,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test - public void map_long_batch_measure() throws Exception { + public void map_long_batch_measure() { BatchReport.Measure batchMeasure = BatchReport.Measure.newBuilder() .setValueType(Constants.MeasureValueType.LONG) .setLongValue(3L) @@ -291,7 +291,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test(expected = IllegalStateException.class) - public void fail_when_no_metric_key() throws Exception { + public void fail_when_no_metric_key() { BatchReport.Measure measure = BatchReport.Measure.newBuilder() .setValueType(MeasureValueType.STRING) .setStringValue("string-value") @@ -302,7 +302,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test(expected = IllegalStateException.class) - public void fail_when_no_value() throws Exception { + public void fail_when_no_value() { BatchReport.Measure measure = BatchReport.Measure.newBuilder() .setMetricKey("repo:metric-key") .build(); @@ -312,7 +312,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Test(expected = IllegalStateException.class) - public void fail_when_forbid_metric() throws Exception { + public void fail_when_forbid_metric() { BatchReport.Measure measure = BatchReport.Measure.newBuilder() .setMetricKey("duplications_data") .build(); @@ -349,7 +349,7 @@ public class PersistMeasuresStepTest extends BaseStepTest { } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return sut; } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java index b65582c80a9..c28c22fbc8d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistNumberOfDaysSinceLastCommitStepTest.java @@ -75,12 +75,12 @@ public class PersistNumberOfDaysSinceLastCommitStepTest extends BaseStepTest { } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return sut; } @Test - public void persist_number_of_days_since_last_commit_from_report() throws Exception { + public void persist_number_of_days_since_last_commit_from_report() { long threeDaysAgo = DateUtils.addDays(new Date(), -3).getTime(); BatchReportWriter reportWriter = initReportWithProjectAndFile(); reportWriter.writeComponentChangesets( @@ -100,7 +100,7 @@ public class PersistNumberOfDaysSinceLastCommitStepTest extends BaseStepTest { } @Test - public void persist_number_of_days_since_last_commit_from_index() throws Exception { + public void persist_number_of_days_since_last_commit_from_index() { Date sixDaysAgo = DateUtils.addDays(new Date(), -6); when(sourceLineIndex.lastCommitDateOnProject("project-uuid")).thenReturn(sixDaysAgo); initReportWithProjectAndFile(); @@ -112,7 +112,7 @@ public class PersistNumberOfDaysSinceLastCommitStepTest extends BaseStepTest { } @Test - public void no_scm_information_in_report_and_index() throws Exception { + public void no_scm_information_in_report_and_index() { initReportWithProjectAndFile(); ComputationContext context = new ComputationContext(new BatchReportReader(dir), ComponentTesting.newProjectDto("project-uuid")); @@ -121,7 +121,7 @@ public class PersistNumberOfDaysSinceLastCommitStepTest extends BaseStepTest { db.assertDbUnit(getClass(), "empty.xml"); } - private BatchReportWriter initReportWithProjectAndFile() throws IOException { + private BatchReportWriter initReportWithProjectAndFile() { BatchReportWriter writer = new BatchReportWriter(dir); writer.writeMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java index 8884d6476ea..9b724a5236e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistTestsStepTest.java @@ -100,18 +100,18 @@ public class PersistTestsStepTest extends BaseStepTest { } @After - public void tearDown() throws Exception { + public void tearDown() { MyBatis.closeQuietly(session); } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return sut; } @Test - public void no_test_in_database_and_batch_report() throws Exception { + public void no_test_in_database_and_batch_report() { sut.execute(new ComputationContext(new BatchReportReader(reportDir), newProjectDto())); assertThat(dbClient.fileSourceDao().selectTest(TEST_FILE_UUID_1)).isNull(); @@ -119,7 +119,7 @@ public class PersistTestsStepTest extends BaseStepTest { } @Test - public void insert_several_tests_in_a_report() throws Exception { + public void insert_several_tests_in_a_report() { BatchReportWriter writer = new BatchReportWriter(reportDir); List batchTests = Arrays.asList( newTest(1), newTest(2) @@ -147,7 +147,7 @@ public class PersistTestsStepTest extends BaseStepTest { } @Test - public void insert_all_data_of_a_test() throws Exception { + public void insert_all_data_of_a_test() { BatchReportWriter writer = new BatchReportWriter(reportDir); writer.writeTests(TEST_FILE_REF_1, Arrays.asList(newTest(1))); writer.writeCoverageDetails(TEST_FILE_REF_1, Arrays.asList(newCoverageDetail(1, MAIN_FILE_REF_1))); @@ -174,7 +174,7 @@ public class PersistTestsStepTest extends BaseStepTest { } @Test - public void insert_tests_without_coverage_details() throws Exception { + public void insert_tests_without_coverage_details() { BatchReportWriter writer = new BatchReportWriter(reportDir); List batchTests = Arrays.asList(newTest(1)); writer.writeTests(TEST_FILE_REF_1, batchTests); @@ -190,7 +190,7 @@ public class PersistTestsStepTest extends BaseStepTest { } @Test - public void insert_coverage_details_not_taken_into_account() throws Exception { + public void insert_coverage_details_not_taken_into_account() { BatchReportWriter writer = new BatchReportWriter(reportDir); List batchTests = Arrays.asList(newTest(1)); writer.writeTests(TEST_FILE_REF_1, batchTests); @@ -209,7 +209,7 @@ public class PersistTestsStepTest extends BaseStepTest { } @Test - public void aggregate_coverage_details() throws Exception { + public void aggregate_coverage_details() { BatchReportWriter writer = new BatchReportWriter(reportDir); writer.writeTests(TEST_FILE_REF_1, Arrays.asList(newTest(1))); writer.writeCoverageDetails(TEST_FILE_REF_1, Arrays.asList( @@ -224,7 +224,7 @@ public class PersistTestsStepTest extends BaseStepTest { } @Test - public void update_existing_test() throws Exception { + public void update_existing_test() { // ARRANGE dbClient.fileSourceDao().insert(session, new FileSourceDto() .setProjectUuid(PROJECT_UUID) @@ -295,7 +295,7 @@ public class PersistTestsStepTest extends BaseStepTest { .build(); } - private BatchReportWriter initBasicReport() throws IOException { + private BatchReportWriter initBasicReport() { BatchReportWriter writer = new BatchReportWriter(reportDir); writer.writeMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java index a2588058de4..6130d31a06d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java @@ -47,7 +47,7 @@ public class PurgeDatastoresStepTest extends BaseStepTest { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void call_purge_method_of_the_purge_task() throws IOException { + public void call_purge_method_of_the_purge_task() { ComponentDto project = mock(ComponentDto.class); when(project.getId()).thenReturn(123L); when(project.uuid()).thenReturn("UUID-1234"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeRemovedViewsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeRemovedViewsStepTest.java index 86fce27ddb2..a8ebac72f81 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeRemovedViewsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeRemovedViewsStepTest.java @@ -90,7 +90,7 @@ public class PurgeRemovedViewsStepTest extends BaseStepTest { } @Test - public void only_support_views() throws Exception { + public void only_support_views() { assertThat(sut.supportedProjectQualifiers()).containsOnly(Qualifiers.VIEW); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java index 3742441d5b2..f9bb05e8ec0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SendIssueNotificationsStepTest.java @@ -61,7 +61,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest { } @Test - public void do_not_send_notifications_if_no_subscribers() throws Exception { + public void do_not_send_notifications_if_no_subscribers() { when(context.getProject().uuid()).thenReturn("PROJECT_UUID"); when(notifService.hasProjectSubscribersForTypes("PROJECT_UUID", SendIssueNotificationsStep.NOTIF_TYPES)).thenReturn(false); @@ -71,7 +71,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest { } @Test - public void send_notifications_if_subscribers() throws Exception { + public void send_notifications_if_subscribers() { issueCache.newAppender().append(new DefaultIssue() .setSeverity(Severity.BLOCKER)).close(); @@ -86,7 +86,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest { } @Override - protected ComputationStep step() throws IOException { + protected ComputationStep step() { return sut; } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java index cc4dfa9be6b..49b444e255d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java @@ -55,7 +55,7 @@ public class SwitchSnapshotStepTest { } @Test - public void one_switch_with_a_snapshot_and_his_children() throws IOException { + public void one_switch_with_a_snapshot_and_his_children() { db.prepareDbUnit(getClass(), "snapshots.xml"); BatchReport.Metadata metadata = BatchReport.Metadata.newBuilder() diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComputationWebServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComputationWebServiceTest.java index 02b436940f0..309a3c1ddf3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComputationWebServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComputationWebServiceTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.mock; public class ComputationWebServiceTest { @Test - public void define() throws Exception { + public void define() { ComputationWebService ws = new ComputationWebService(new ComputationWsAction() { @Override public void define(WebService.NewController controller) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/HistoryWsActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/HistoryWsActionMediumTest.java index d04c2c21cf7..db73d970b68 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/HistoryWsActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/HistoryWsActionMediumTest.java @@ -46,7 +46,7 @@ public class HistoryWsActionMediumTest { ActivityService activityService; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); sut = tester.get(HistoryWsAction.class); activityService = tester.get(ActivityService.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java index 2be42fa3111..1fe9fcce857 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java @@ -43,7 +43,7 @@ public class IsQueueEmptyWebServiceTest { Response response; @Before - public void before() throws Exception { + public void before() { queue = mock(ReportQueue.class); sut = new IsQueueEmptyWebService.IsQueueEmptyWsAction(queue); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/QueueWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/QueueWsActionTest.java index ebf3bf043f4..4183ce8e525 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/QueueWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/QueueWsActionTest.java @@ -41,7 +41,7 @@ public class QueueWsActionTest { private ReportQueue queue; @Before - public void setup() throws Exception { + public void setup() { queue = mock(ReportQueue.class); tester = new WsTester(new ComputationWebService(new QueueWsAction(queue))); } @@ -64,7 +64,7 @@ public class QueueWsActionTest { } @Test - public void define() throws Exception { + public void define() { assertThat(tester.controller(ComputationWebService.API_ENDPOINT).action("queue")).isNotNull(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitReportWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitReportWsActionTest.java index e88d651d591..fe16f557961 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitReportWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitReportWsActionTest.java @@ -50,7 +50,7 @@ public class SubmitReportWsActionTest { } @Test - public void define_metadata() throws Exception { + public void define_metadata() { WebService.Context context = new WebService.Context(); WebService.NewController controller = context.createController("api/computation"); sut.define(controller); diff --git a/server/sonar-server/src/test/java/org/sonar/server/config/ws/PropertiesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/config/ws/PropertiesWsTest.java index 3cec6c83eb5..6a45d64d036 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/config/ws/PropertiesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/config/ws/PropertiesWsTest.java @@ -31,7 +31,7 @@ public class PropertiesWsTest { WsTester tester = new WsTester(new PropertiesWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/properties"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/dashboard/db/WidgetDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/dashboard/db/WidgetDaoTest.java index baea10daf89..65af6e084cb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/dashboard/db/WidgetDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/dashboard/db/WidgetDaoTest.java @@ -45,7 +45,7 @@ public class WidgetDaoTest { private DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { dao = new WidgetDao(dbTester.myBatis()); session = dbTester.myBatis().openSession(false); } @@ -56,7 +56,7 @@ public class WidgetDaoTest { } @Test - public void should_select_all() throws Exception { + public void should_select_all() { dbTester.prepareDbUnit(this.getClass(), "before.xml"); session.commit(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java index 2d825b1a423..d2d4826b37d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/BaseDaoTest.java @@ -59,7 +59,7 @@ public class BaseDaoTest { } @Before - public void before() throws Exception { + public void before() { this.session = db.myBatis().openSession(false); this.dao = new FakeDao(System2.INSTANCE); } @@ -78,7 +78,7 @@ public class BaseDaoTest { } @Test - public void can_insert_and_select_by_key() throws Exception { + public void can_insert_and_select_by_key() { long t0 = System.currentTimeMillis() - 1000; String key = Uuids.create(); @@ -108,7 +108,7 @@ public class BaseDaoTest { } @Test - public void synchronize_to_es_after_date() throws Exception { + public void synchronize_to_es_after_date() { long t0 = System.currentTimeMillis() - 1000; String key = Uuids.create(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java index 3ef5c7281fe..c2d769a524a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java @@ -31,7 +31,7 @@ public class EmbeddedDatabaseFactoryTest { Settings settings = new Settings(); @Test - public void should_start_and_stop_tcp_h2_database() throws Exception { + public void should_start_and_stop_tcp_h2_database() { settings.setProperty(DatabaseProperties.PROP_URL, "jdbc:h2:tcp:localhost"); final EmbeddedDatabase embeddedDatabase = mock(EmbeddedDatabase.class); @@ -50,7 +50,7 @@ public class EmbeddedDatabaseFactoryTest { } @Test - public void should_not_start_mem_h2_database() throws Exception { + public void should_not_start_mem_h2_database() { settings.setProperty(DatabaseProperties.PROP_URL, "jdbc:h2:mem"); final EmbeddedDatabase embeddedDatabase = mock(EmbeddedDatabase.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseTest.java index 954f480dadd..7ae85ef8a39 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseTest.java @@ -41,7 +41,7 @@ public class EmbeddedDatabaseTest { public ExpectedException throwable = ExpectedException.none(); @Test(timeout = 5000) - public void should_start_and_stop() throws IOException { + public void should_start_and_stop() { int port = NetworkUtils.freePort(); EmbeddedDatabase database = new EmbeddedDatabase(testSettings(port)); @@ -59,7 +59,7 @@ public class EmbeddedDatabaseTest { } @Test - public void should_return_embedded_data_directory() throws Exception { + public void should_return_embedded_data_directory() { Settings settings = testSettings(0); EmbeddedDatabase database = new EmbeddedDatabase(settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java index df297adf618..e4380a7e28c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/ResultSetIteratorTest.java @@ -51,7 +51,7 @@ public class ResultSetIteratorTest { } @After - public void tearDown() throws Exception { + public void tearDown() { DbUtils.closeQuietly(connection); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/AddColumnsBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/AddColumnsBuilderTest.java index f5e2d4516fd..ba94a71598b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/AddColumnsBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/AddColumnsBuilderTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class AddColumnsBuilderTest { @Test - public void add_columns_on_h2() throws Exception { + public void add_columns_on_h2() { assertThat(new AddColumnsBuilder(new H2(), "issues") .addColumn(new AddColumnsBuilder.ColumnDef() .setName("date_in_ms") @@ -43,7 +43,7 @@ public class AddColumnsBuilderTest { } @Test - public void add_columns_on_mysql() throws Exception { + public void add_columns_on_mysql() { assertThat(new AddColumnsBuilder(new MySql(), "issues") .addColumn(new AddColumnsBuilder.ColumnDef() .setName("date_in_ms") @@ -58,7 +58,7 @@ public class AddColumnsBuilderTest { } @Test - public void add_columns_on_oracle() throws Exception { + public void add_columns_on_oracle() { assertThat(new AddColumnsBuilder(new Oracle(), "issues") .addColumn(new AddColumnsBuilder.ColumnDef() .setName("date_in_ms") @@ -73,7 +73,7 @@ public class AddColumnsBuilderTest { } @Test - public void add_columns_on_postgresql() throws Exception { + public void add_columns_on_postgresql() { assertThat(new AddColumnsBuilder(new PostgreSql(), "issues") .addColumn(new AddColumnsBuilder.ColumnDef() .setName("date_in_ms") @@ -88,7 +88,7 @@ public class AddColumnsBuilderTest { } @Test - public void add_columns_on_mssql() throws Exception { + public void add_columns_on_mssql() { assertThat(new AddColumnsBuilder(new MsSql(), "issues") .addColumn(new AddColumnsBuilder.ColumnDef() .setName("date_in_ms") @@ -103,7 +103,7 @@ public class AddColumnsBuilderTest { } @Test - public void fail_when_column_name_is_in_upper_case() throws Exception { + public void fail_when_column_name_is_in_upper_case() { try { new AddColumnsBuilder.ColumnDef() .setName("DATE_IN_MS") @@ -116,7 +116,7 @@ public class AddColumnsBuilderTest { } @Test - public void fail_when_column_name_contains_invalid_character() throws Exception { + public void fail_when_column_name_contains_invalid_character() { try { new AddColumnsBuilder.ColumnDef() .setName("date-in/ms") diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java index 1c975a4f7e5..339a8b6672d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/BaseDataChangeTest.java @@ -50,7 +50,7 @@ public class BaseDataChangeTest extends AbstractDaoTestCase { public ExpectedException thrown = ExpectedException.none(); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table persons"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DatabaseMigratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DatabaseMigratorTest.java index 20ca936aefc..877455432af 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DatabaseMigratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DatabaseMigratorTest.java @@ -52,12 +52,12 @@ public class DatabaseMigratorTest extends AbstractDaoTestCase { DatabaseMigrator migrator; @Before - public void setUp() throws Exception { + public void setUp() { migrator = new DatabaseMigrator(dbClient, migrations, serverUpgradeStatus, null); } @Test - public void should_support_only_creation_of_h2_database() throws Exception { + public void should_support_only_creation_of_h2_database() { when(dbClient.database().getDialect()).thenReturn(new MySql()); assertThat(migrator.createDatabase()).isFalse(); @@ -65,7 +65,7 @@ public class DatabaseMigratorTest extends AbstractDaoTestCase { } @Test - public void fail_if_execute_unknown_migration() throws Exception { + public void fail_if_execute_unknown_migration() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Database migration not found: org.xxx.UnknownMigration"); @@ -73,14 +73,14 @@ public class DatabaseMigratorTest extends AbstractDaoTestCase { } @Test - public void execute_migration() throws Exception { + public void execute_migration() { assertThat(FakeMigrationStep.executed).isFalse(); migrator.executeMigration(FakeMigrationStep.class.getName()); assertThat(FakeMigrationStep.executed).isTrue(); } @Test - public void should_create_schema_on_h2() throws Exception { + public void should_create_schema_on_h2() { Dialect supportedDialect = new H2(); when(dbClient.database().getDialect()).thenReturn(supportedDialect); Connection connection = mock(Connection.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DropColumnsBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DropColumnsBuilderTest.java index 316718d716c..6c1e67945b8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DropColumnsBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/DropColumnsBuilderTest.java @@ -27,31 +27,31 @@ import static org.assertj.core.api.Assertions.assertThat; public class DropColumnsBuilderTest { @Test - public void drop_columns_on_mysql() throws Exception { + public void drop_columns_on_mysql() { assertThat(new DropColumnsBuilder(new MySql(), "issues", "date_in_ms", "name") .build()).isEqualTo("ALTER TABLE issues DROP COLUMN date_in_ms, DROP COLUMN name"); } @Test - public void drop_columns_on_oracle() throws Exception { + public void drop_columns_on_oracle() { assertThat(new DropColumnsBuilder(new Oracle(), "issues", "date_in_ms", "name") .build()).isEqualTo("ALTER TABLE issues DROP (date_in_ms, name)"); } @Test - public void drop_columns_on_postgresql() throws Exception { + public void drop_columns_on_postgresql() { assertThat(new DropColumnsBuilder(new PostgreSql(), "issues", "date_in_ms", "name") .build()).isEqualTo("ALTER TABLE issues DROP COLUMN date_in_ms, DROP COLUMN name"); } @Test - public void drop_columns_on_mssql() throws Exception { + public void drop_columns_on_mssql() { assertThat(new DropColumnsBuilder(new MsSql(), "issues", "date_in_ms", "name") .build()).isEqualTo("ALTER TABLE issues DROP COLUMN date_in_ms, name"); } @Test(expected = IllegalStateException.class) - public void fail_to_drop_columns_on_h2() throws Exception { + public void fail_to_drop_columns_on_h2() { new DropColumnsBuilder(new H2(), "issues", "date_in_ms", "name") .build(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepsTest.java index ca1955c43ea..75ab0635c8f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepsTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MigrationStepsTest { @Test - public void check_number_of_migrations() throws Exception { + public void check_number_of_migrations() { assertThat(MigrationSteps.CLASSES).isNotEmpty(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationConcurrentAccessTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationConcurrentAccessTest.java index b4b9c767484..4c1c0914dc0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationConcurrentAccessTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationConcurrentAccessTest.java @@ -78,7 +78,7 @@ public class PlatformDatabaseMigrationConcurrentAccessTest { private PlatformDatabaseMigration underTest = new PlatformDatabaseMigration(rubyBridge, executorService, platform); @After - public void tearDown() throws Exception { + public void tearDown() { pool.shutdownNow(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationTest.java index 2d98d836989..42a77b8ffc2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/PlatformDatabaseMigrationTest.java @@ -58,22 +58,22 @@ public class PlatformDatabaseMigrationTest { private PlatformDatabaseMigration underTest = new PlatformDatabaseMigration(rubyBridge, executorService, platform); @Test - public void status_is_NONE_when_component_is_created() throws Exception { + public void status_is_NONE_when_component_is_created() { assertThat(underTest.status()).isEqualTo(DatabaseMigration.Status.NONE); } @Test - public void startedAt_is_null_when_component_is_created() throws Exception { + public void startedAt_is_null_when_component_is_created() { assertThat(underTest.startedAt()).isNull(); } @Test - public void failureError_is_null_when_component_is_created() throws Exception { + public void failureError_is_null_when_component_is_created() { assertThat(underTest.failureError()).isNull(); } @Test - public void startit_calls_databasemigration_trigger_in_a_separate_thread() throws Exception { + public void startit_calls_databasemigration_trigger_in_a_separate_thread() { when(rubyBridge.databaseMigration()).thenReturn(rubyDatabaseMigration); when(rubyBridge.railsRoutes()).thenReturn(rubyRailsRoutes); @@ -88,7 +88,7 @@ public class PlatformDatabaseMigrationTest { } @Test - public void status_is_SUCCEEDED_and_failure_is_null_when_trigger_runs_without_an_exception() throws Exception { + public void status_is_SUCCEEDED_and_failure_is_null_when_trigger_runs_without_an_exception() { when(rubyBridge.databaseMigration()).thenReturn(rubyDatabaseMigration); when(rubyBridge.railsRoutes()).thenReturn(rubyRailsRoutes); @@ -100,7 +100,7 @@ public class PlatformDatabaseMigrationTest { } @Test - public void status_is_FAILED_and_failure_stores_the_exception_when_trigger_throws_an_exception() throws Exception { + public void status_is_FAILED_and_failure_stores_the_exception_when_trigger_throws_an_exception() { mockTriggerThrowsError(); underTest.startIt(); @@ -111,7 +111,7 @@ public class PlatformDatabaseMigrationTest { } @Test - public void successive_calls_to_startIt_reset_status_startedAt_and_failureError() throws Exception { + public void successive_calls_to_startIt_reset_status_startedAt_and_failureError() { mockTriggerThrowsError(); underTest.startIt(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ProgressTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ProgressTest.java index 4ce1d029507..4574dc06b22 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ProgressTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ProgressTest.java @@ -28,7 +28,7 @@ import static org.mockito.Mockito.*; public class ProgressTest { @Test - public void log_progress() throws Exception { + public void log_progress() { Logger logger = mock(Logger.class); ArgumentCaptor argument = ArgumentCaptor.forClass(String.class); @@ -47,7 +47,7 @@ public class ProgressTest { } @Test - public void log_remaining_time() throws Exception { + public void log_remaining_time() { Logger logger = mock(Logger.class); ArgumentCaptor argument = ArgumentCaptor.forClass(String.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationConvertersTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationConvertersTest.java index 99fa0dde46f..5120255a1f4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationConvertersTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationConvertersTest.java @@ -36,19 +36,19 @@ import static org.mockito.Mockito.when; public class ViolationConvertersTest { @Test - public void default_number_of_threads() throws Exception { + public void default_number_of_threads() { assertThat(new ViolationConverters(new Settings()).numberOfThreads()).isEqualTo(ViolationConverters.DEFAULT_THREADS); } @Test - public void configure_number_of_threads() throws Exception { + public void configure_number_of_threads() { Settings settings = new Settings(); settings.setProperty(ViolationConverters.THREADS_PROPERTY, 2); assertThat(new ViolationConverters(settings).numberOfThreads()).isEqualTo(2); } @Test - public void number_of_threads_should_not_be_negative() throws Exception { + public void number_of_threads_should_not_be_negative() { try { Settings settings = new Settings(); settings.setProperty(ViolationConverters.THREADS_PROPERTY, -2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationMigrationTest.java index debda9a7f17..869dff59537 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v36/ViolationMigrationTest.java @@ -32,7 +32,7 @@ public class ViolationMigrationTest { public static DbTester db = new DbTester().schema(ViolationMigrationTest.class, "schema.sql"); @Test - public void migrate_violations() throws Exception { + public void migrate_violations() { db.prepareDbUnit(getClass(), "migrate_violations.xml"); new ViolationMigrationStep(db.database(), new Settings()).execute(); @@ -42,7 +42,7 @@ public class ViolationMigrationTest { } @Test - public void no_violations_to_migrate() throws Exception { + public void no_violations_to_migrate() { db.prepareDbUnit(getClass(), "no_violations_to_migrate.xml"); new ViolationMigrationStep(db.database(), new Settings()).execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java index 9ec7e533efc..fed7264f748 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java @@ -53,7 +53,7 @@ public class ConvertIssueDebtToMinutesMigrationStepTest { ConvertIssueDebtToMinutesMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime()); when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java index f92e48eb2cf..60e7bb11af5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java @@ -44,7 +44,7 @@ public class DevelopmentCostMeasuresMigrationStepTest { DevelopmentCostMeasuresMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); migration = new DevelopmentCostMeasuresMigrationStep(db.database(), propertiesDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java index 1f8e3e2b451..de38b9eb7e5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java @@ -50,7 +50,7 @@ public class IssueChangelogMigrationStepTest { IssueChangelogMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime()); when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); @@ -69,7 +69,7 @@ public class IssueChangelogMigrationStepTest { } @Test - public void convert_data_containing_only_debt_change() throws Exception { + public void convert_data_containing_only_debt_change() { assertThat(migration.convertChangelog("technicalDebt=1|2")).isEqualTo("technicalDebt=1|2"); assertThat(migration.convertChangelog("technicalDebt=100|200")).isEqualTo("technicalDebt=60|120"); assertThat(migration.convertChangelog("technicalDebt=10000|20000")).isEqualTo("technicalDebt=480|960"); @@ -79,21 +79,21 @@ public class IssueChangelogMigrationStepTest { } @Test - public void convert_data_beginning_with_debt_change() throws Exception { + public void convert_data_beginning_with_debt_change() { assertThat(migration.convertChangelog("technicalDebt=100|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|120,status=RESOLVED|REOPENED"); assertThat(migration.convertChangelog("technicalDebt=|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=|120,status=RESOLVED|REOPENED"); assertThat(migration.convertChangelog("technicalDebt=100|,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|,status=RESOLVED|REOPENED"); } @Test - public void convert_data_finishing_with_debt_change() throws Exception { + public void convert_data_finishing_with_debt_change() { assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120"); assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120"); assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|"); } @Test - public void convert_data_with_debt_change_in_the_middle() throws Exception { + public void convert_data_with_debt_change_in_the_middle() { assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120,resolution="); assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120,resolution="); assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|,resolution="); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java index bc8b1f0f5f4..8a47e64b282 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java @@ -44,7 +44,7 @@ public class NotResolvedIssuesOnRemovedComponentsMigrationStepTest { NotResolvedIssuesOnRemovedComponentsMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-09").getTime()); migration = new NotResolvedIssuesOnRemovedComponentsMigrationStep(db.database(), system2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java index 2ab4f606e94..c1d7f9932af 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java @@ -33,7 +33,7 @@ public class RequirementMeasuresMigrationStepTest { RequirementMeasuresMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { migration = new RequirementMeasuresMigrationStep(db.database()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java index bb83cac65f3..1adb672c4a0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java @@ -44,7 +44,7 @@ public class TechnicalDebtMeasuresMigrationStepTest { TechnicalDebtMeasuresMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); migration = new TechnicalDebtMeasuresMigrationStep(db.database(), propertiesDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java index d1dbd9a48f5..5dcb16bfdf4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java @@ -41,7 +41,7 @@ public class WorkDurationConvertorTest { WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao); @Test - public void convert_from_long() throws Exception { + public void convert_from_long() { convertor.init(); when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); @@ -52,13 +52,13 @@ public class WorkDurationConvertorTest { } @Test - public void convert_from_long_use_default_value_for_hours_in_day_when_no_property() throws Exception { + public void convert_from_long_use_default_value_for_hours_in_day_when_no_property() { convertor.init(); assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE); } @Test - public void fail_convert_from_long_on_bad_hours_in_day_property() throws Exception { + public void fail_convert_from_long_on_bad_hours_in_day_property() { when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("-2")); WorkDurationConvertor workDurationConvertor = new WorkDurationConvertor(propertiesDao); try { @@ -70,7 +70,7 @@ public class WorkDurationConvertorTest { } @Test - public void convert_from_days() throws Exception { + public void convert_from_days() { convertor.init(); when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); @@ -82,7 +82,7 @@ public class WorkDurationConvertorTest { } @Test - public void fail_it_init_has_not_been_called() throws Exception { + public void fail_it_init_has_not_been_called() { when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java index 94971c2b84d..78730a3b0be 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java @@ -46,7 +46,7 @@ public class ChangeLogMigrationTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(DateUtils.parseDate("2014-03-13").getTime()); dao = new ActivityDao(db.myBatis(), system2); dbClient = new DbClient(db.database(), db.myBatis(), dao); @@ -60,7 +60,7 @@ public class ChangeLogMigrationTest { } @Test - public void migrate() throws Exception { + public void migrate() { db.prepareDbUnit(getClass(), "active_rules_changes.xml"); migration.execute(); assertThat(db.countRowsOfTable("activities")).isEqualTo(5); @@ -70,7 +70,7 @@ public class ChangeLogMigrationTest { } @Test - public void migrate_when_no_changelog() throws Exception { + public void migrate_when_no_changelog() { db.prepareDbUnit(getClass(), "migrate_when_no_changelog.xml"); migration.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java index 0510b0f1910..ee404bc07e8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java @@ -40,7 +40,7 @@ public class ConvertProfileMeasuresMigrationTest { ConvertProfileMeasuresMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { DbClient dbClient = new DbClient(db.database(), db.myBatis()); migration = new ConvertProfileMeasuresMigrationStep(dbClient); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java index 84aecc0e14d..2ff095da737 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java @@ -42,7 +42,7 @@ public class FeedQProfileDatesMigrationTest { FeedQProfileDatesMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table active_rule_changes"); db.executeUpdateSql("truncate table active_rule_param_changes"); DbClient dbClient = new DbClient(db.database(), db.myBatis()); @@ -52,7 +52,7 @@ public class FeedQProfileDatesMigrationTest { } @Test - public void feed_created_at_and_updated_at() throws Exception { + public void feed_created_at_and_updated_at() { db.prepareDbUnit(getClass(), "feed_created_at_and_updated_at.xml"); migration.execute(); @@ -63,7 +63,7 @@ public class FeedQProfileDatesMigrationTest { } @Test - public void use_default_dates_when_no_changes() throws Exception { + public void use_default_dates_when_no_changes() { db.prepareDbUnit(getClass(), "use_default_dates_when_no_changes.xml"); migration.execute(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java index 67331c22225..92b817e8dc9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java @@ -44,7 +44,7 @@ public class IssueActionPlanKeyMigrationTest { IssueActionPlanKeyMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-28").getTime()); migration = new IssueActionPlanKeyMigrationStep(db.database(), system2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java index 33f7683fbbb..aa86b64d69d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java @@ -36,7 +36,7 @@ public class MeasureDataMigrationTest { MeasureDataMigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { migration = new MeasureDataMigrationStep(db.database()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java index 797b71f360d..d9af88e441e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java @@ -39,7 +39,7 @@ public class AddMissingRuleParameterDefaultValuesMigrationTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table rules_parameters"); db.executeUpdateSql("truncate table active_rules"); db.executeUpdateSql("truncate table active_rule_parameters"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java index ef1efb8ebff..e0c22d4ddb2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java @@ -41,7 +41,7 @@ public class DeleteMeasuresOnDeletedProfilesMigrationTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { DbClient dbClient = new DbClient(db.database(), db.myBatis()); migration = new DeleteMeasuresOnDeletedProfilesMigrationStep(dbClient); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/AddMissingCustomRuleParametersMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/AddMissingCustomRuleParametersMigrationTest.java index c55f58310c0..6234aae32bd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/AddMissingCustomRuleParametersMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/AddMissingCustomRuleParametersMigrationTest.java @@ -40,7 +40,7 @@ public class AddMissingCustomRuleParametersMigrationTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table rules"); db.executeUpdateSql("truncate table rules_parameters"); DbClient dbClient = new DbClient(db.database(), db.myBatis()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/DeleteUnescapedActivitiesTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/DeleteUnescapedActivitiesTest.java index 510281bde6c..79d62c49ac6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/DeleteUnescapedActivitiesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v451/DeleteUnescapedActivitiesTest.java @@ -42,7 +42,7 @@ public class DeleteUnescapedActivitiesTest { } @Test - public void is_unescaped() throws Exception { + public void is_unescaped() { assertThat(DeleteUnescapedActivities.isUnescaped( "ruleKey=findbugs:PT_RELATIVE_PATH_TRAVERSAL;profileKey=java-findbugs-74105;severity=MAJOR;" + "key=java-findbugs-74105:findbugs:PT_RELATIVE_PATH_TRAVERSAL")) diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java index 1434e2c11cb..d45cfc7a4ec 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java @@ -50,7 +50,7 @@ public class FeedFileSourcesTest { System2 system; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table metrics"); db.executeUpdateSql("truncate table snapshots"); db.executeUpdateSql("truncate table snapshot_sources"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/InsertProjectsAuthorizationUpdatedAtMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/InsertProjectsAuthorizationUpdatedAtMigrationTest.java index f10e6e93793..23fdd41681f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/InsertProjectsAuthorizationUpdatedAtMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/InsertProjectsAuthorizationUpdatedAtMigrationTest.java @@ -39,7 +39,7 @@ public class InsertProjectsAuthorizationUpdatedAtMigrationTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table projects"); migration = new InsertProjectsAuthorizationUpdatedAtMigrationStep(db.database(), system); when(system.now()).thenReturn(123456789L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java index 6337cda22c1..7adde185508 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/PopulateProjectsUuidColumnsMigrationTest.java @@ -48,7 +48,7 @@ public class PopulateProjectsUuidColumnsMigrationTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table projects"); db.executeUpdateSql("truncate table snapshots"); dbClient = new DbClient(db.database(), db.myBatis()); @@ -58,7 +58,7 @@ public class PopulateProjectsUuidColumnsMigrationTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/RemoveSortFieldFromIssueFiltersMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/RemoveSortFieldFromIssueFiltersMigrationTest.java index 8c7cf3fac79..e71a69da294 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/RemoveSortFieldFromIssueFiltersMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/RemoveSortFieldFromIssueFiltersMigrationTest.java @@ -39,7 +39,7 @@ public class RemoveSortFieldFromIssueFiltersMigrationTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table issue_filters"); migration = new RemoveSortFieldFromIssueFiltersMigrationStep(db.database(), system); when(system.now()).thenReturn(DateUtils.parseDate("2014-10-29").getTime()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/ReplaceIssueFiltersProjectKeyByUuidTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/ReplaceIssueFiltersProjectKeyByUuidTest.java index 5f48b08215f..06494e4d46c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/ReplaceIssueFiltersProjectKeyByUuidTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/ReplaceIssueFiltersProjectKeyByUuidTest.java @@ -39,7 +39,7 @@ public class ReplaceIssueFiltersProjectKeyByUuidTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table issue_filters"); migration = new ReplaceIssueFiltersProjectKeyByUuid(db.database(), system); when(system.now()).thenReturn(DateUtils.parseDate("2014-10-29").getTime()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddIssuesColumnsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddIssuesColumnsTest.java index e882b4a6fcc..784401f29cb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddIssuesColumnsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddIssuesColumnsTest.java @@ -35,7 +35,7 @@ public class AddIssuesColumnsTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { migration = new AddIssuesColumns(db.database()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddNewCharacteristicsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddNewCharacteristicsTest.java index 34fbbef067a..f5cc219ca1b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddNewCharacteristicsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/AddNewCharacteristicsTest.java @@ -43,7 +43,7 @@ public class AddNewCharacteristicsTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table characteristics"); when(system.now()).thenReturn(DateUtils.parseDate("2015-02-15").getTime()); @@ -87,7 +87,7 @@ public class AddNewCharacteristicsTest { } @Test - public void fail_if_usability_exists_as_sub_characteristic() throws Exception { + public void fail_if_usability_exists_as_sub_characteristic() { db.prepareDbUnit(getClass(), "fail_if_usability_exists_as_sub_characteristic.xml"); try { @@ -101,7 +101,7 @@ public class AddNewCharacteristicsTest { } @Test - public void fail_if_compliance_already_exists_as_characteristic() throws Exception { + public void fail_if_compliance_already_exists_as_characteristic() { db.prepareDbUnit(getClass(), "fail_if_compliance_already_exists_as_characteristic.xml"); try { @@ -115,7 +115,7 @@ public class AddNewCharacteristicsTest { } @Test - public void fail_if_compliance_already_exists_under_wrong_characteristic() throws Exception { + public void fail_if_compliance_already_exists_under_wrong_characteristic() { db.prepareDbUnit(getClass(), "fail_if_compliance_already_exists_under_wrong_characteristic.xml"); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/CopyScmAccountsFromAuthorsToUsersTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/CopyScmAccountsFromAuthorsToUsersTest.java index 9b690506ed1..225008d884f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/CopyScmAccountsFromAuthorsToUsersTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/CopyScmAccountsFromAuthorsToUsersTest.java @@ -43,7 +43,7 @@ public class CopyScmAccountsFromAuthorsToUsersTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table authors"); db.executeUpdateSql("truncate table users"); migration = new CopyScmAccountsFromAuthorsToUsers(db.database(), system); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/DropIssuesColumnsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/DropIssuesColumnsTest.java index 0280ffe0af6..a510574d1ee 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/DropIssuesColumnsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/DropIssuesColumnsTest.java @@ -35,13 +35,13 @@ public class DropIssuesColumnsTest { Database database; @Before - public void setUp() throws Exception { + public void setUp() { database = mock(Database.class); migration = new DropIssuesColumns(database); } @Test - public void generate_sql_on_postgresql() throws Exception { + public void generate_sql_on_postgresql() { when(database.getDialect()).thenReturn(new PostgreSql()); assertThat(migration.generateSql()).isEqualTo( "ALTER TABLE issues DROP COLUMN issue_creation_date, DROP COLUMN issue_update_date, DROP COLUMN issue_close_date, DROP COLUMN component_id, DROP COLUMN root_component_id" diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedEventsLongDatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedEventsLongDatesTest.java index c15cdfe64aa..6bfce09f823 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedEventsLongDatesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedEventsLongDatesTest.java @@ -37,7 +37,7 @@ public class FeedEventsLongDatesTest { public static DbTester db = new DbTester().schema(FeedEventsLongDatesTest.class, "schema.sql"); @Before - public void before() throws Exception { + public void before() { db.prepareDbUnit(getClass(), "before.xml"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueComponentUuidsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueComponentUuidsTest.java index e4cb5219d2e..cdc3c049bb9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueComponentUuidsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueComponentUuidsTest.java @@ -32,7 +32,7 @@ public class FeedIssueComponentUuidsTest { FeedIssueComponentUuids sut; @Before - public void setUp() throws Exception { + public void setUp() { db.truncateTables(); sut = new FeedIssueComponentUuids(db.database()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueTagsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueTagsTest.java index d237432e09a..9eae280d327 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueTagsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedIssueTagsTest.java @@ -41,7 +41,7 @@ public class FeedIssueTagsTest { System2 system; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table rules"); db.executeUpdateSql("truncate table issues"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedManualMeasuresLongDatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedManualMeasuresLongDatesTest.java index 1333710b31c..0e29d0d78f4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedManualMeasuresLongDatesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedManualMeasuresLongDatesTest.java @@ -37,7 +37,7 @@ public class FeedManualMeasuresLongDatesTest { public static DbTester db = new DbTester().schema(FeedManualMeasuresLongDatesTest.class, "schema.sql"); @Before - public void before() throws Exception { + public void before() { db.prepareDbUnit(getClass(), "before.xml"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedSemaphoresLongDatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedSemaphoresLongDatesTest.java index 010cca9be66..09edce288fe 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedSemaphoresLongDatesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/FeedSemaphoresLongDatesTest.java @@ -37,7 +37,7 @@ public class FeedSemaphoresLongDatesTest { public static DbTester db = new DbTester().schema(FeedSemaphoresLongDatesTest.class, "schema.sql"); @Before - public void before() throws Exception { + public void before() { db.prepareDbUnit(getClass(), "before.xml"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RemovePermissionsOnModulesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RemovePermissionsOnModulesMigrationTest.java index 0dff23a0fb5..49b62c3a8e2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RemovePermissionsOnModulesMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RemovePermissionsOnModulesMigrationTest.java @@ -33,7 +33,7 @@ public class RemovePermissionsOnModulesMigrationTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { migration = new RemovePermissionsOnModulesMigrationStep(db.database()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RenameComponentRelatedParamsInIssueFiltersMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RenameComponentRelatedParamsInIssueFiltersMigrationTest.java index 86906e6ab5e..ace0591da3b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RenameComponentRelatedParamsInIssueFiltersMigrationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/RenameComponentRelatedParamsInIssueFiltersMigrationTest.java @@ -39,7 +39,7 @@ public class RenameComponentRelatedParamsInIssueFiltersMigrationTest { System2 system = mock(System2.class); @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table issue_filters"); migration = new RenameComponentRelatedParamsInIssueFilters(db.database(), system); when(system.now()).thenReturn(DateUtils.parseDate("2014-10-29").getTime()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/UpdateProjectsModuleUuidPathTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/UpdateProjectsModuleUuidPathTest.java index e1d680d8464..bb2d0567eeb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/UpdateProjectsModuleUuidPathTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v51/UpdateProjectsModuleUuidPathTest.java @@ -37,7 +37,7 @@ public class UpdateProjectsModuleUuidPathTest { System2 system; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table projects"); migration = new UpdateProjectsModuleUuidPath(db.database()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesColumnsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesColumnsTest.java index c95338db9fe..205e90838c7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesColumnsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesColumnsTest.java @@ -35,7 +35,7 @@ public class AddDependenciesColumnsTest { AddDependenciesColumns migration; @Before - public void setUp() throws Exception { + public void setUp() { migration = new AddDependenciesColumns(db.database()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesComponentUuidColumnsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesComponentUuidColumnsTest.java index 99e041a75b1..a0b8ce006c0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesComponentUuidColumnsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/AddDependenciesComponentUuidColumnsTest.java @@ -35,7 +35,7 @@ public class AddDependenciesComponentUuidColumnsTest { AddDependenciesComponentUuidColumns migration; @Before - public void setUp() throws Exception { + public void setUp() { migration = new AddDependenciesComponentUuidColumns(db.database()); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java index 3147195b99c..117771c293c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/DropDependenciesComponentColumnsTest.java @@ -36,13 +36,13 @@ public class DropDependenciesComponentColumnsTest { Database database; @Before - public void setUp() throws Exception { + public void setUp() { database = mock(Database.class); migration = new DropDependenciesComponentColumns(database); } @Test - public void generate_sql_on_postgresql() throws Exception { + public void generate_sql_on_postgresql() { when(database.getDialect()).thenReturn(new PostgreSql()); assertThat(migration.generateSql()).isEqualTo( "ALTER TABLE dependencies DROP COLUMN from_resource_id, DROP COLUMN to_resource_id" diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedDependenciesComponentUuidsTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedDependenciesComponentUuidsTest.java index ab46ea1551e..383d5515c7a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedDependenciesComponentUuidsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedDependenciesComponentUuidsTest.java @@ -34,7 +34,7 @@ public class FeedDependenciesComponentUuidsTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table dependencies"); db.executeUpdateSql("truncate table projects"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedEventsComponentUuidTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedEventsComponentUuidTest.java index 26412c877fc..42d8fc3eaf8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedEventsComponentUuidTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedEventsComponentUuidTest.java @@ -34,7 +34,7 @@ public class FeedEventsComponentUuidTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table events"); db.executeUpdateSql("truncate table projects"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedFileSourcesDataTypeTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedFileSourcesDataTypeTest.java index f770363e269..b8f0cf1f6f4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedFileSourcesDataTypeTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedFileSourcesDataTypeTest.java @@ -34,7 +34,7 @@ public class FeedFileSourcesDataTypeTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table file_sources"); migration = new FeedFileSourcesDataType(db.database()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedProjectLinksComponentUuidTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedProjectLinksComponentUuidTest.java index 76c888b19b3..593d87f5c40 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedProjectLinksComponentUuidTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/FeedProjectLinksComponentUuidTest.java @@ -34,7 +34,7 @@ public class FeedProjectLinksComponentUuidTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table project_links"); migration = new FeedProjectLinksComponentUuid(db.database()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/MoveProjectProfileAssociationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/MoveProjectProfileAssociationTest.java index fdf30cacfe2..5b2545ba8bb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/MoveProjectProfileAssociationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v52/MoveProjectProfileAssociationTest.java @@ -34,7 +34,7 @@ public class MoveProjectProfileAssociationTest { MigrationStep migration; @Before - public void setUp() throws Exception { + public void setUp() { db.executeUpdateSql("truncate table projects"); db.executeUpdateSql("truncate table project_qprofiles"); db.executeUpdateSql("truncate table properties"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtMediumTest.java index d01b7299644..1fd391301e3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtMediumTest.java @@ -38,13 +38,13 @@ public class DebtMediumTest { public static ServerTester serverTester = new ServerTester(); @Before - public void setUp() throws Exception { + public void setUp() { serverTester.clearDbAndIndexes(); serverTester.get(Platform.class).executeStartupTasks(); } @Test - public void find_default_characteristics() throws Exception { + public void find_default_characteristics() { DebtModelService debtModelService = serverTester.get(DebtModelService.class); // Only root characteristics @@ -55,7 +55,7 @@ public class DebtMediumTest { } @Test - public void create_characteristic() throws Exception { + public void create_characteristic() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); DebtModelService debtModelService = serverTester.get(DebtModelService.class); @@ -72,7 +72,7 @@ public class DebtMediumTest { } @Test - public void create_sub_characteristic() throws Exception { + public void create_sub_characteristic() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); DebtModelService debtModelService = serverTester.get(DebtModelService.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java index 5988ce6db05..1e837e369dd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java @@ -121,7 +121,7 @@ public class DebtModelBackupTest { DebtModelBackup debtModelBackup; @Before - public void setUp() throws Exception { + public void setUp() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); when(system2.now()).thenReturn(now.getTime()); @@ -149,7 +149,7 @@ public class DebtModelBackupTest { } @Test - public void backup() throws Exception { + public void backup() { when(dao.selectEnabledCharacteristics(session)).thenReturn(newArrayList( new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability updated").setOrder(2), new CharacteristicDto().setId(2).setKey("COMPILER").setName("Compiler updated").setParentId(1) @@ -195,7 +195,7 @@ public class DebtModelBackupTest { } @Test - public void backup_with_disabled_rules() throws Exception { + public void backup_with_disabled_rules() { when(dao.selectEnabledCharacteristics(session)).thenReturn(newArrayList( new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability updated").setOrder(2), new CharacteristicDto().setId(2).setKey("COMPILER").setName("Compiler updated").setParentId(1) @@ -217,7 +217,7 @@ public class DebtModelBackupTest { } @Test - public void backup_with_rule_having_default_linear_and_overridden_offset() throws Exception { + public void backup_with_rule_having_default_linear_and_overridden_offset() { when(dao.selectEnabledCharacteristics(session)).thenReturn(newArrayList( new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability updated").setOrder(2), new CharacteristicDto().setId(2).setKey("COMPILER").setName("Compiler updated").setParentId(1) @@ -255,7 +255,7 @@ public class DebtModelBackupTest { } @Test - public void backup_from_language() throws Exception { + public void backup_from_language() { when(dao.selectEnabledCharacteristics(session)).thenReturn(newArrayList( new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability updated").setOrder(2), new CharacteristicDto().setId(2).setKey("COMPILER").setName("Compiler updated").setParentId(1) @@ -293,7 +293,7 @@ public class DebtModelBackupTest { } @Test - public void create_characteristics_when_restoring_characteristics() throws Exception { + public void create_characteristics_when_restoring_characteristics() { when(dao.selectEnabledCharacteristics(session)).thenReturn(Collections.emptyList()); debtModelBackup.restoreCharacteristics( @@ -326,7 +326,7 @@ public class DebtModelBackupTest { } @Test - public void update_characteristics_when_restoring_characteristics() throws Exception { + public void update_characteristics_when_restoring_characteristics() { when(dao.selectEnabledCharacteristics(session)).thenReturn(newArrayList( // Order and name have changed new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability updated").setOrder(2).setCreatedAt(oldDate).setUpdatedAt(oldDate), @@ -363,7 +363,7 @@ public class DebtModelBackupTest { } @Test - public void update_parent_when_restoring_characteristics() throws Exception { + public void update_parent_when_restoring_characteristics() { when(dao.selectEnabledCharacteristics(session)).thenReturn(newArrayList( // Parent has changed new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability updated").setParentId(1).setOrder(1).setCreatedAt(oldDate).setUpdatedAt(oldDate), @@ -394,7 +394,7 @@ public class DebtModelBackupTest { } @Test - public void disable_no_more_existing_characteristics_when_restoring_characteristics() throws Exception { + public void disable_no_more_existing_characteristics_when_restoring_characteristics() { CharacteristicDto dto1 = new CharacteristicDto().setId(1).setKey("PORTABILITY").setName("Portability").setOrder(1); CharacteristicDto dto2 = new CharacteristicDto().setId(2).setKey("COMPILER").setName("Compiler").setParentId(1); @@ -407,7 +407,7 @@ public class DebtModelBackupTest { } @Test - public void reset_model() throws Exception { + public void reset_model() { when(characteristicsXMLImporter.importXML(any(Reader.class))).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -468,7 +468,7 @@ public class DebtModelBackupTest { } @Test - public void reset_model_when_no_default_value() throws Exception { + public void reset_model_when_no_default_value() { when(characteristicsXMLImporter.importXML(any(Reader.class))).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -520,7 +520,7 @@ public class DebtModelBackupTest { } @Test - public void reset_model_on_custom_rules() throws Exception { + public void reset_model_on_custom_rules() { when(characteristicsXMLImporter.importXML(any(Reader.class))).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -582,7 +582,7 @@ public class DebtModelBackupTest { } @Test - public void reset_model_do_not_load_rule_definitions_if_no_rule() throws Exception { + public void reset_model_do_not_load_rule_definitions_if_no_rule() { when(characteristicsXMLImporter.importXML(any(Reader.class))).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -608,7 +608,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml() throws Exception { + public void restore_from_xml() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -639,7 +639,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml_disable_rule_debt_when_not_in_xml_and_rule_have_default_debt_values() throws Exception { + public void restore_from_xml_disable_rule_debt_when_not_in_xml_and_rule_have_default_debt_values() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -663,7 +663,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml_and_language() throws Exception { + public void restore_from_xml_and_language() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -697,7 +697,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml_and_language_disable_no_more_existing_characteristics() throws Exception { + public void restore_from_xml_and_language_disable_no_more_existing_characteristics() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1))); @@ -713,7 +713,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml_and_language_with_rule_not_in_xml() throws Exception { + public void restore_from_xml_and_language_with_rule_not_in_xml() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -743,7 +743,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml_add_warning_message_when_rule_from_xml_is_not_found() throws Exception { + public void restore_from_xml_add_warning_message_when_rule_from_xml_is_not_found() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); @@ -766,7 +766,7 @@ public class DebtModelBackupTest { } @Test - public void restore_from_xml_add_error_message_when_illegal_argument_exception() throws Exception { + public void restore_from_xml_add_error_message_when_illegal_argument_exception() { when(characteristicsXMLImporter.importXML(anyString())).thenReturn(new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("PORTABILITY").setName("Portability").setOrder(1)) .addSubCharacteristic(new DefaultDebtCharacteristic().setKey("COMPILER").setName("Compiler"), "PORTABILITY")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelLookupTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelLookupTest.java index 202e3c7f2b3..9c3c3905720 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelLookupTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelLookupTest.java @@ -49,7 +49,7 @@ public class DebtModelLookupTest { DebtModelLookup service; @Before - public void setUp() throws Exception { + public void setUp() { service = new DebtModelLookup(dao); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java index 9f580a290ee..e9c5cc9b571 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java @@ -109,7 +109,7 @@ public class DebtModelOperationsTest { DebtModelOperations service; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(now.getTime()); MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java index f6d21825030..51bf42d8ff8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java @@ -78,7 +78,7 @@ public class DebtModelPluginRepositoryTest { } @Test - public void contributing_plugin_list() throws Exception { + public void contributing_plugin_list() { initModel(); Collection contributingPluginList = modelFinder.getContributingPluginList(); assertThat(contributingPluginList.size()).isEqualTo(2); @@ -86,7 +86,7 @@ public class DebtModelPluginRepositoryTest { } @Test - public void get_content_for_xml_file() throws Exception { + public void get_content_for_xml_file() { initModel(); Reader xmlFileReader = null; try { @@ -103,26 +103,26 @@ public class DebtModelPluginRepositoryTest { } @Test - public void return_xml_file_path_for_plugin() throws Exception { + public void return_xml_file_path_for_plugin() { initModel(); assertThat(modelFinder.getXMLFilePath("foo")).isEqualTo(TEST_XML_PREFIX_PATH + "foo-model.xml"); } @Test - public void contain_default_model() throws Exception { + public void contain_default_model() { modelFinder = new DebtModelPluginRepository(mock(PluginRepository.class)); modelFinder.start(); assertThat(modelFinder.getContributingPluginKeyToClassLoader().keySet()).containsOnly("technical-debt"); } - private void initModel() throws MalformedURLException { + private void initModel() { Map contributingPluginKeyToClassLoader = Maps.newHashMap(); contributingPluginKeyToClassLoader.put("csharp", newClassLoader()); contributingPluginKeyToClassLoader.put("java", newClassLoader()); modelFinder = new DebtModelPluginRepository(contributingPluginKeyToClassLoader, TEST_XML_PREFIX_PATH); } - private ClassLoader newClassLoader() throws MalformedURLException { + private ClassLoader newClassLoader() { ClassLoader loader = mock(ClassLoader.class); when(loader.getResourceAsStream(anyString())).thenAnswer(new Answer() { public InputStream answer(InvocationOnMock invocation) throws Throwable { diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java index e5309e9f8d8..9de5ffc3805 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java @@ -42,7 +42,7 @@ public class DebtModelServiceTest { DebtModelService service; @Before - public void setUp() throws Exception { + public void setUp() { service = new DebtModelService(debtModelOperations, debtModelLookup, debtModelBackup); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelXMLExporterTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelXMLExporterTest.java index 08e5e653345..071a390ded6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelXMLExporterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelXMLExporterTest.java @@ -78,7 +78,7 @@ public class DebtModelXMLExporterTest { } @Test - public void sort_root_characteristics_by_order_and_sub_characteristics_by_name() throws Exception { + public void sort_root_characteristics_by_order_and_sub_characteristics_by_name() { DebtModel debtModel = new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("EFFICIENCY").setName("Efficiency").setOrder(4)) .addRootCharacteristic(new DefaultDebtCharacteristic().setKey("USABILITY").setName("Usability").setOrder(3)) @@ -100,7 +100,7 @@ public class DebtModelXMLExporterTest { } @Test - public void pretty_print_exported_xml() throws Exception { + public void pretty_print_exported_xml() { DebtModel debtModel = new DebtModel() .addRootCharacteristic(new DefaultDebtCharacteristic().setId(1).setKey("USABILITY").setName("Usability").setOrder(1)) .addRootCharacteristic(new DefaultDebtCharacteristic().setId(2).setKey("EFFICIENCY").setName("Efficiency").setOrder(2)) diff --git a/server/sonar-server/src/test/java/org/sonar/server/design/db/FileDependencyDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/design/db/FileDependencyDaoTest.java index e9b515b0c0d..da650e69627 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/design/db/FileDependencyDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/design/db/FileDependencyDaoTest.java @@ -45,19 +45,19 @@ public class FileDependencyDaoTest { FileDependencyDao dao; @Before - public void setup() throws Exception { + public void setup() { dbTester.truncateTables(); session = dbTester.myBatis().openSession(false); dao = new FileDependencyDao(); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void select_from_parents() throws Exception { + public void select_from_parents() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List dtos = dao.selectFromParents(session, "MNOP", "QRST", 1L); @@ -76,14 +76,14 @@ public class FileDependencyDaoTest { } @Test - public void select_all() throws Exception { + public void select_all() { dbTester.prepareDbUnit(getClass(), "shared.xml"); assertThat(dao.selectAll(session)).hasSize(3); } @Test - public void insert() throws Exception { + public void insert() { dao.insert(session, new FileDependencyDto() .setFromComponentUuid("ABCD") .setToComponentUuid("EFGH") diff --git a/server/sonar-server/src/test/java/org/sonar/server/design/ws/DependenciesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/design/ws/DependenciesWsTest.java index 0549e70e4d8..32afbfee42a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/design/ws/DependenciesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/design/ws/DependenciesWsTest.java @@ -34,13 +34,13 @@ public class DependenciesWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new DependenciesWs(new ShowAction(mock(DbClient.class)))); controller = tester.controller("api/dependencies"); } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.description()).isNull(); assertThat(controller.since()).isEqualTo("5.2"); @@ -48,7 +48,7 @@ public class DependenciesWsTest { } @Test - public void define_search_action() throws Exception { + public void define_search_action() { WebService.Action action = controller.action("show"); assertThat(action).isNotNull(); assertThat(action.isPost()).isFalse(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/design/ws/ShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/design/ws/ShowActionTest.java index b541b9940b7..9f1837bde9f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/design/ws/ShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/design/ws/ShowActionTest.java @@ -69,7 +69,7 @@ public class ShowActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao(), new SnapshotDao(System2.INSTANCE), new FileDependencyDao()); session = dbClient.openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsJsonWriterTest.java b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsJsonWriterTest.java index 18fd62b7fec..e72e7b03a3e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsJsonWriterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsJsonWriterTest.java @@ -55,7 +55,7 @@ public class DuplicationsJsonWriterTest { ComponentDto project; @Before - public void setUp() throws Exception { + public void setUp() { project = ComponentTesting.newProjectDto() .setId(1L) .setName("SonarQube") @@ -66,7 +66,7 @@ public class DuplicationsJsonWriterTest { } @Test - public void write_duplications() throws Exception { + public void write_duplications() { String key1 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyDeleteQuery.java"; ComponentDto file1 = ComponentTesting.newFileDto(project).setId(10L).setKey(key1).setLongName("PropertyDeleteQuery").setParentProjectId(5L); String key2 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyUpdateQuery.java"; @@ -125,7 +125,7 @@ public class DuplicationsJsonWriterTest { } @Test - public void write_duplications_without_sub_project() throws Exception { + public void write_duplications_without_sub_project() { String key1 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyDeleteQuery.java"; ComponentDto file1 = ComponentTesting.newFileDto(project).setId(10L).setKey(key1).setLongName("PropertyDeleteQuery"); String key2 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyUpdateQuery.java"; @@ -173,7 +173,7 @@ public class DuplicationsJsonWriterTest { } @Test - public void write_duplications_with_a_removed_component() throws Exception { + public void write_duplications_with_a_removed_component() { String key1 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyDeleteQuery.java"; ComponentDto file1 = ComponentTesting.newFileDto(project).setId(10L).setKey(key1).setLongName("PropertyDeleteQuery"); @@ -214,7 +214,7 @@ public class DuplicationsJsonWriterTest { } @Test - public void write_nothing_when_no_data() throws Exception { + public void write_nothing_when_no_data() { test(Collections.emptyList(), "{\"duplications\": [], \"files\": {}}"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsParserTest.java b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsParserTest.java index a51a0412405..a4f43944929 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsParserTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsParserTest.java @@ -63,7 +63,7 @@ public class DuplicationsParserTest { ComponentDto project2; @Before - public void setUp() throws Exception { + public void setUp() { project1 = ComponentTesting.newProjectDto() .setId(1L) .setName("SonarQube") @@ -91,7 +91,7 @@ public class DuplicationsParserTest { } @Test - public void empty_list_when_no_data() throws Exception { + public void empty_list_when_no_data() { assertThat(parser.parse(currentFile, null, session)).isEmpty(); } @@ -198,7 +198,7 @@ public class DuplicationsParserTest { } @Test - public void compare_duplications() throws Exception { + public void compare_duplications() { ComponentDto currentFile = ComponentTesting.newFileDto(project1).setId(11L); ComponentDto fileOnSameProject = ComponentTesting.newFileDto(project1).setId(12L); ComponentDto fileOnDifferentProject = ComponentTesting.newFileDto(project2).setId(13L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java index a2a0fa8983e..87652c229dc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java @@ -36,7 +36,7 @@ public class DuplicationsWsTest { new ShowAction(mock(DbClient.class), mock(ComponentDao.class), mock(MeasureDao.class), mock(DuplicationsParser.class), mock(DuplicationsJsonWriter.class)))); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/duplications"); assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("4.4"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java index db137bb750e..eb19639dc10 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java @@ -71,7 +71,7 @@ public class ShowActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.openSession(false)).thenReturn(session); tester = new WsTester(new DuplicationsWs(new ShowAction(dbClient, componentDao, measureDao, parser, duplicationsJsonWriter))); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java index 93692d16570..94c4638c084 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/BulkIndexerTest.java @@ -39,7 +39,7 @@ public class BulkIndexerTest { public EsTester esTester = new EsTester().addDefinitions(new FakeIndexDefinition().setReplicas(1)); @Test - public void index_nothing() throws Exception { + public void index_nothing() { esTester.truncateIndices(); BulkIndexer indexer = new BulkIndexer(esTester.client(), FakeIndexDefinition.INDEX); @@ -50,7 +50,7 @@ public class BulkIndexerTest { } @Test - public void index_documents() throws Exception { + public void index_documents() { BulkIndexer indexer = new BulkIndexer(esTester.client(), FakeIndexDefinition.INDEX); indexer.start(); indexer.add(newIndexRequest(42)); @@ -65,7 +65,7 @@ public class BulkIndexerTest { } @Test - public void large_indexing() throws Exception { + public void large_indexing() { // index has one replica assertThat(replicas()).isEqualTo(1); @@ -110,7 +110,7 @@ public class BulkIndexerTest { } @Test - public void disable_refresh() throws Exception { + public void disable_refresh() { BulkIndexer indexer = new BulkIndexer(esTester.client(), FakeIndexDefinition.INDEX) .setDisableRefresh(true); indexer.start(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/DefaultIndexSettingsTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/DefaultIndexSettingsTest.java index 36e98501ff1..4d11b0fa1dd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/DefaultIndexSettingsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/DefaultIndexSettingsTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DefaultIndexSettingsTest { @Test - public void defaults() throws Exception { + public void defaults() { ImmutableMap map = DefaultIndexSettings.defaults().build().getAsMap(); assertThat(map).isNotEmpty(); @@ -39,7 +39,7 @@ public class DefaultIndexSettingsTest { } @Test - public void only_statics() throws Exception { + public void only_statics() { TestUtils.hasOnlyPrivateConstructors(DefaultIndexSettings.class); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java index f65ab01b5b7..9d7e045d50f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/EsClientTest.java @@ -48,7 +48,7 @@ public class EsClientTest { public EsTester es = new EsTester(); @Test - public void proxify_requests() throws Exception { + public void proxify_requests() { EsClient client = es.client(); client.start(); assertThat(client.nativeClient()).isNotNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/EsUtilsTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/EsUtilsTest.java index 4473a02a85e..1a8148b8cb6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/EsUtilsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/EsUtilsTest.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.when; public class EsUtilsTest { @Test - public void convertToDocs_empty() throws Exception { + public void convertToDocs_empty() { SearchHits hits = mock(SearchHits.class, Mockito.RETURNS_MOCKS); List docs = EsUtils.convertToDocs(hits, new Function, BaseDoc>() { @Override @@ -51,7 +51,7 @@ public class EsUtilsTest { } @Test - public void convertToDocs() throws Exception { + public void convertToDocs() { SearchHits hits = mock(SearchHits.class, Mockito.RETURNS_MOCKS); when(hits.getHits()).thenReturn(new SearchHit[]{mock(SearchHit.class)}); List docs = EsUtils.convertToDocs(hits, new Function, BaseDoc>() { @@ -64,12 +64,12 @@ public class EsUtilsTest { } @Test - public void util_class() throws Exception { + public void util_class() { assertThat(TestUtils.hasOnlyPrivateConstructors(EsUtils.class)); } @Test - public void es_date_format() throws Exception { + public void es_date_format() { assertThat(EsUtils.formatDateTime(new Date(1_500_000_000_000L))).startsWith("2017-07-"); assertThat(EsUtils.formatDateTime(null)).isNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionContextTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionContextTest.java index 2fe786325ae..d8f050a2610 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionContextTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionContextTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; public class IndexDefinitionContextTest { @Test - public void create_indices() throws Exception { + public void create_indices() { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); context.create("issues"); @@ -36,7 +36,7 @@ public class IndexDefinitionContextTest { } @Test - public void fail_to_create_twice_the_same_index() throws Exception { + public void fail_to_create_twice_the_same_index() { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); context.create("issues"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java index 20cff8f8548..ab0a94e810b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/IndexDefinitionHashTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class IndexDefinitionHashTest { @Test - public void of() throws Exception { + public void of() { IndexDefinitions.Index indexV1 = new IndexDefinitions.Index(createIndex()); String hashV1 = new IndexDefinitionHash().of(indexV1); assertThat(hashV1).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/NewIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/NewIndexTest.java index 28c7a00750a..7a3152ada9e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/NewIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/NewIndexTest.java @@ -31,7 +31,7 @@ import static org.junit.Assert.fail; public class NewIndexTest { @Test - public void most_basic_index() throws Exception { + public void most_basic_index() { NewIndex index = new NewIndex("issues"); assertThat(index.getName()).isEqualTo("issues"); assertThat(index.getTypes()).isEmpty(); @@ -41,7 +41,7 @@ public class NewIndexTest { } @Test - public void index_name_is_lower_case() throws Exception { + public void index_name_is_lower_case() { try { new NewIndex("Issues"); fail(); @@ -51,7 +51,7 @@ public class NewIndexTest { } @Test - public void define_fields() throws Exception { + public void define_fields() { NewIndex index = new NewIndex("issues"); NewIndex.NewIndexType mapping = index.createType("issue"); mapping.setAttribute("dynamic", "true"); @@ -81,7 +81,7 @@ public class NewIndexTest { } @Test - public void define_string_field() throws Exception { + public void define_string_field() { NewIndex index = new NewIndex("issues"); NewIndex.NewIndexType mapping = index.createType("issue"); mapping.stringFieldBuilder("basic_field").build(); @@ -109,7 +109,7 @@ public class NewIndexTest { } @Test - public void string_doc_values() throws Exception { + public void string_doc_values() { NewIndex index = new NewIndex("issues"); NewIndex.NewIndexType mapping = index.createType("issue"); mapping.stringFieldBuilder("the_doc_value").docValues().build(); @@ -122,7 +122,7 @@ public class NewIndexTest { } @Test - public void analyzed_strings_must_not_be_doc_values() throws Exception { + public void analyzed_strings_must_not_be_doc_values() { NewIndex index = new NewIndex("issues"); NewIndex.NewIndexType mapping = index.createType("issue"); try { @@ -134,7 +134,7 @@ public class NewIndexTest { } @Test - public void do_not_disable_search_on_searchable_fields() throws Exception { + public void do_not_disable_search_on_searchable_fields() { NewIndex index = new NewIndex("issues"); NewIndex.NewIndexType mapping = index.createType("issue"); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/SearchOptionsTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/SearchOptionsTest.java index 6c1db01f582..a1ce70fc6a0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/SearchOptionsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/SearchOptionsTest.java @@ -32,7 +32,7 @@ import static org.junit.Assert.fail; public class SearchOptionsTest { @Test - public void defaults() throws Exception { + public void defaults() { SearchOptions options = new SearchOptions(); assertThat(options.getFacets()).isEmpty(); @@ -43,7 +43,7 @@ public class SearchOptionsTest { } @Test - public void page_shortcut_for_limit_and_offset() throws Exception { + public void page_shortcut_for_limit_and_offset() { SearchOptions options = new SearchOptions().setPage(3, 10); assertThat(options.getLimit()).isEqualTo(10); @@ -51,7 +51,7 @@ public class SearchOptionsTest { } @Test - public void page_starts_at_one() throws Exception { + public void page_starts_at_one() { SearchOptions options = new SearchOptions().setPage(1, 10); assertThat(options.getLimit()).isEqualTo(10); assertThat(options.getOffset()).isEqualTo(0); @@ -59,7 +59,7 @@ public class SearchOptionsTest { } @Test - public void with_zero_page_size() throws Exception { + public void with_zero_page_size() { SearchOptions options = new SearchOptions().setPage(1, 0); assertThat(options.getLimit()).isEqualTo(SearchOptions.MAX_LIMIT); assertThat(options.getOffset()).isEqualTo(0); @@ -67,7 +67,7 @@ public class SearchOptionsTest { } @Test - public void page_must_be_strictly_positive() throws Exception { + public void page_must_be_strictly_positive() { try { new SearchOptions().setPage(0, 10); fail(); @@ -77,13 +77,13 @@ public class SearchOptionsTest { } @Test - public void use_max_limit_if_negative() throws Exception { + public void use_max_limit_if_negative() { SearchOptions options = new SearchOptions().setPage(2, -1); assertThat(options.getLimit()).isEqualTo(SearchOptions.MAX_LIMIT); } @Test - public void max_limit() throws Exception { + public void max_limit() { SearchOptions options = new SearchOptions().setLimit(42); assertThat(options.getLimit()).isEqualTo(42); @@ -92,20 +92,20 @@ public class SearchOptionsTest { } @Test - public void disable_limit() throws Exception { + public void disable_limit() { SearchOptions options = new SearchOptions().disableLimit(); assertThat(options.getLimit()).isEqualTo(999999); } @Test - public void max_page_size() throws Exception { + public void max_page_size() { SearchOptions options = new SearchOptions().setPage(3, QueryContext.MAX_LIMIT + 10); assertThat(options.getOffset()).isEqualTo(QueryContext.MAX_LIMIT * 2); assertThat(options.getLimit()).isEqualTo(QueryContext.MAX_LIMIT); } @Test - public void hasField() throws Exception { + public void hasField() { // parameter is missing -> all the fields are returned by default SearchOptions options = new SearchOptions(); assertThat(options.hasField("repo")).isTrue(); @@ -122,7 +122,7 @@ public class SearchOptionsTest { } @Test - public void writeJson() throws Exception { + public void writeJson() { SearchOptions options = new SearchOptions().setPage(3, 10); StringWriter json = new StringWriter(); JsonWriter jsonWriter = JsonWriter.of(json).beginObject(); @@ -133,7 +133,7 @@ public class SearchOptionsTest { } @Test - public void writeDeprecatedJson() throws Exception { + public void writeDeprecatedJson() { SearchOptions options = new SearchOptions().setPage(3, 10); StringWriter json = new StringWriter(); JsonWriter jsonWriter = JsonWriter.of(json).beginObject(); @@ -144,7 +144,7 @@ public class SearchOptionsTest { } @Test - public void writeDeprecatedJson_exact_nb_of_pages() throws Exception { + public void writeDeprecatedJson_exact_nb_of_pages() { SearchOptions options = new SearchOptions().setPage(3, 10); StringWriter json = new StringWriter(); JsonWriter jsonWriter = JsonWriter.of(json).beginObject(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyBulkRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyBulkRequestBuilderTest.java index f0d0712857b..0106db382a9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyBulkRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyBulkRequestBuilderTest.java @@ -74,17 +74,17 @@ public class ProxyBulkRequestBuilderTest { } @Test(expected = UnsupportedOperationException.class) - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { esTester.client().prepareBulk().get("1"); } @Test(expected = UnsupportedOperationException.class) - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { esTester.client().prepareBulk().get(TimeValue.timeValueMinutes(1)); } @Test(expected = UnsupportedOperationException.class) - public void execute_is_not_yet_implemented() throws Exception { + public void execute_is_not_yet_implemented() { esTester.client().prepareBulk().execute(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClearCacheRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClearCacheRequestBuilderTest.java index abaf9cf7e01..02d3082f445 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClearCacheRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClearCacheRequestBuilderTest.java @@ -76,7 +76,7 @@ public class ProxyClearCacheRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareClearCache().get("1"); fail(); @@ -86,7 +86,7 @@ public class ProxyClearCacheRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareClearCache().get(TimeValue.timeValueMinutes(1)); fail(); @@ -96,7 +96,7 @@ public class ProxyClearCacheRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareClearCache().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterHealthRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterHealthRequestBuilderTest.java index f784e6d092c..a7f0a88414a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterHealthRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterHealthRequestBuilderTest.java @@ -67,7 +67,7 @@ public class ProxyClusterHealthRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareHealth().get("1"); fail(); @@ -77,7 +77,7 @@ public class ProxyClusterHealthRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareHealth().get(TimeValue.timeValueMinutes(1)); fail(); @@ -87,7 +87,7 @@ public class ProxyClusterHealthRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareHealth().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStateRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStateRequestBuilderTest.java index ba11fd38f7b..ae01674efbd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStateRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStateRequestBuilderTest.java @@ -63,7 +63,7 @@ public class ProxyClusterStateRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareState().get("1"); fail(); @@ -73,7 +73,7 @@ public class ProxyClusterStateRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareState().get(TimeValue.timeValueMinutes(1)); fail(); @@ -83,7 +83,7 @@ public class ProxyClusterStateRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareState().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStatsRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStatsRequestBuilderTest.java index 6d8a293cd01..742c9fcfdaf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStatsRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyClusterStatsRequestBuilderTest.java @@ -62,7 +62,7 @@ public class ProxyClusterStatsRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareClusterStats().get("1"); fail(); @@ -72,7 +72,7 @@ public class ProxyClusterStatsRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareClusterStats().get(TimeValue.timeValueMinutes(1)); fail(); @@ -82,7 +82,7 @@ public class ProxyClusterStatsRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareClusterStats().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCountRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCountRequestBuilderTest.java index 88b26fa6483..625902f7246 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCountRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCountRequestBuilderTest.java @@ -61,7 +61,7 @@ public class ProxyCountRequestBuilderTest { } @Test - public void fail_to_count_bad_query() throws Exception { + public void fail_to_count_bad_query() { try { esTester.client().prepareCount("unknown_index1, unknown_index2").setTypes("unknown_type").get(); fail(); @@ -72,7 +72,7 @@ public class ProxyCountRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareCount(FakeIndexDefinition.INDEX).get("1"); fail(); @@ -82,7 +82,7 @@ public class ProxyCountRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareCount(FakeIndexDefinition.INDEX).get(TimeValue.timeValueMinutes(1)); fail(); @@ -92,7 +92,7 @@ public class ProxyCountRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareCount(FakeIndexDefinition.INDEX).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCreateIndexRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCreateIndexRequestBuilderTest.java index 4f57c0aba93..36255f8de54 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCreateIndexRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyCreateIndexRequestBuilderTest.java @@ -63,7 +63,7 @@ public class ProxyCreateIndexRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareCreate(generateNewIndexName()).get("1"); fail(); @@ -73,7 +73,7 @@ public class ProxyCreateIndexRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareCreate(generateNewIndexName()).get(TimeValue.timeValueMinutes(1)); fail(); @@ -83,7 +83,7 @@ public class ProxyCreateIndexRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareCreate(generateNewIndexName()).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteByQueryRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteByQueryRequestBuilderTest.java index 6cd0df505de..3b387ddf91a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteByQueryRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteByQueryRequestBuilderTest.java @@ -63,7 +63,7 @@ public class ProxyDeleteByQueryRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareDeleteByQuery().get("1"); fail(); @@ -73,7 +73,7 @@ public class ProxyDeleteByQueryRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareDeleteByQuery().get(TimeValue.timeValueMinutes(1)); fail(); @@ -83,7 +83,7 @@ public class ProxyDeleteByQueryRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareDeleteByQuery().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteRequestBuilderTest.java index f22d22a60c8..30e3f20eaf3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyDeleteRequestBuilderTest.java @@ -57,7 +57,7 @@ public class ProxyDeleteRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareDelete("fakes", "fake", "the_id").get("1"); fail(); @@ -67,7 +67,7 @@ public class ProxyDeleteRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareDelete("fakes", "fake", "the_id").get(TimeValue.timeValueMinutes(1)); fail(); @@ -77,7 +77,7 @@ public class ProxyDeleteRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareDelete("fakes", "fake", "the_id").execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyFlushRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyFlushRequestBuilderTest.java index 86b2960d80e..c75961b7c48 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyFlushRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyFlushRequestBuilderTest.java @@ -60,7 +60,7 @@ public class ProxyFlushRequestBuilderTest { } @Test - public void fail_to_refresh() throws Exception { + public void fail_to_refresh() { try { esTester.client().prepareFlush("unknown").get(); fail(); @@ -71,7 +71,7 @@ public class ProxyFlushRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareFlush(FakeIndexDefinition.INDEX).get("1"); fail(); @@ -81,7 +81,7 @@ public class ProxyFlushRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareFlush(FakeIndexDefinition.INDEX).get(TimeValue.timeValueMinutes(1)); fail(); @@ -91,7 +91,7 @@ public class ProxyFlushRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareFlush(FakeIndexDefinition.INDEX).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyGetRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyGetRequestBuilderTest.java index 8c1621ba6b4..56dd883747b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyGetRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyGetRequestBuilderTest.java @@ -63,7 +63,7 @@ public class ProxyGetRequestBuilderTest { } @Test - public void fail_to_get_bad_query() throws Exception { + public void fail_to_get_bad_query() { GetRequestBuilder requestBuilder = esTester.client().prepareGet() .setIndex("unknown") .setType("test") @@ -78,7 +78,7 @@ public class ProxyGetRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareGet().get("1"); fail(); @@ -88,7 +88,7 @@ public class ProxyGetRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareGet().get(TimeValue.timeValueMinutes(1)); fail(); @@ -98,7 +98,7 @@ public class ProxyGetRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareGet().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndexRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndexRequestBuilderTest.java index f445f8bbc27..94e44f3e7dc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndexRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndexRequestBuilderTest.java @@ -61,7 +61,7 @@ public class ProxyIndexRequestBuilderTest { } @Test - public void fail_if_bad_query() throws Exception { + public void fail_if_bad_query() { IndexRequestBuilder requestBuilder = esTester.client().prepareIndex("unknownIndex", "unknownType"); try { requestBuilder.get(); @@ -73,7 +73,7 @@ public class ProxyIndexRequestBuilderTest { } @Test - public void fail_if_bad_query_with_basic_profiling() throws Exception { + public void fail_if_bad_query_with_basic_profiling() { IndexRequestBuilder requestBuilder = esTester.client().prepareIndex("unknownIndex", "unknownType"); try { requestBuilder.get(); @@ -85,7 +85,7 @@ public class ProxyIndexRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareIndex(FakeIndexDefinition.INDEX, FakeIndexDefinition.TYPE).get("1"); fail(); @@ -95,7 +95,7 @@ public class ProxyIndexRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareIndex(FakeIndexDefinition.INDEX, FakeIndexDefinition.TYPE).get(TimeValue.timeValueMinutes(1)); fail(); @@ -105,7 +105,7 @@ public class ProxyIndexRequestBuilderTest { } @Test - public void do_not_support_execute_method() throws Exception { + public void do_not_support_execute_method() { try { esTester.client().prepareIndex(FakeIndexDefinition.INDEX, FakeIndexDefinition.TYPE).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesExistsRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesExistsRequestBuilderTest.java index 56ffd572599..a45c3102147 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesExistsRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesExistsRequestBuilderTest.java @@ -56,7 +56,7 @@ public class ProxyIndicesExistsRequestBuilderTest { } @Test - public void fail_to_exists() throws Exception { + public void fail_to_exists() { try { esTester.client().prepareIndicesExist().get(); @@ -74,7 +74,7 @@ public class ProxyIndicesExistsRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareIndicesExist().get("1"); fail(); @@ -84,7 +84,7 @@ public class ProxyIndicesExistsRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareIndicesExist().get(TimeValue.timeValueMinutes(1)); fail(); @@ -94,7 +94,7 @@ public class ProxyIndicesExistsRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareIndicesExist().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesStatsRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesStatsRequestBuilderTest.java index c9470f3fdae..87ad6b8e18c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesStatsRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyIndicesStatsRequestBuilderTest.java @@ -61,7 +61,7 @@ public class ProxyIndicesStatsRequestBuilderTest { } @Test - public void fail_to_stats() throws Exception { + public void fail_to_stats() { try { esTester.client().prepareStats("unknown").get(); fail(); @@ -72,7 +72,7 @@ public class ProxyIndicesStatsRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareStats(FakeIndexDefinition.INDEX).get("1"); fail(); @@ -82,7 +82,7 @@ public class ProxyIndicesStatsRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareStats(FakeIndexDefinition.INDEX).get(TimeValue.timeValueMinutes(1)); fail(); @@ -92,7 +92,7 @@ public class ProxyIndicesStatsRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareStats(FakeIndexDefinition.INDEX).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyMultiGetRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyMultiGetRequestBuilderTest.java index 482a197cfbd..bf0ec8d9eef 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyMultiGetRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyMultiGetRequestBuilderTest.java @@ -74,7 +74,7 @@ public class ProxyMultiGetRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareMultiGet().get("1"); fail(); @@ -84,7 +84,7 @@ public class ProxyMultiGetRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareMultiGet().get(TimeValue.timeValueMinutes(1)); fail(); @@ -94,7 +94,7 @@ public class ProxyMultiGetRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareMultiGet().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyNodesStatsRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyNodesStatsRequestBuilderTest.java index f94c744c226..1035a9bc743 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyNodesStatsRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyNodesStatsRequestBuilderTest.java @@ -61,7 +61,7 @@ public class ProxyNodesStatsRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareNodesStats(FakeIndexDefinition.INDEX).get("1"); fail(); @@ -71,7 +71,7 @@ public class ProxyNodesStatsRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareNodesStats(FakeIndexDefinition.INDEX).get(TimeValue.timeValueMinutes(1)); fail(); @@ -81,7 +81,7 @@ public class ProxyNodesStatsRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareNodesStats(FakeIndexDefinition.INDEX).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyPutMappingRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyPutMappingRequestBuilderTest.java index 7a1aaaa6272..e9639abe0c0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyPutMappingRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyPutMappingRequestBuilderTest.java @@ -76,7 +76,7 @@ public class ProxyPutMappingRequestBuilderTest { } @Test - public void fail_on_bad_query() throws Exception { + public void fail_on_bad_query() { try { esTester.client().preparePutMapping().get(); fail(); @@ -87,7 +87,7 @@ public class ProxyPutMappingRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().preparePutMapping().get("1"); fail(); @@ -97,7 +97,7 @@ public class ProxyPutMappingRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().preparePutMapping().get(TimeValue.timeValueMinutes(1)); fail(); @@ -107,7 +107,7 @@ public class ProxyPutMappingRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().preparePutMapping().execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyRefreshRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyRefreshRequestBuilderTest.java index 089c7ebde80..3f6e39b59e4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyRefreshRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxyRefreshRequestBuilderTest.java @@ -63,7 +63,7 @@ public class ProxyRefreshRequestBuilderTest { } @Test - public void fail_to_refresh() throws Exception { + public void fail_to_refresh() { try { esTester.client().prepareRefresh("unknown").get(); fail(); @@ -74,7 +74,7 @@ public class ProxyRefreshRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareRefresh(FakeIndexDefinition.INDEX).get("1"); fail(); @@ -84,7 +84,7 @@ public class ProxyRefreshRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareRefresh(FakeIndexDefinition.INDEX).get(TimeValue.timeValueMinutes(1)); fail(); @@ -94,7 +94,7 @@ public class ProxyRefreshRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareRefresh(FakeIndexDefinition.INDEX).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchRequestBuilderTest.java index 8603d06183f..717c370b35e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchRequestBuilderTest.java @@ -62,7 +62,7 @@ public class ProxySearchRequestBuilderTest { } @Test - public void fail_to_search_bad_query() throws Exception { + public void fail_to_search_bad_query() { try { esTester.client().prepareSearch(FakeIndexDefinition.INDEX).setQuery("bad query").get(); fail(); @@ -73,7 +73,7 @@ public class ProxySearchRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareSearch(FakeIndexDefinition.INDEX).get("1"); fail(); @@ -83,7 +83,7 @@ public class ProxySearchRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareSearch(FakeIndexDefinition.INDEX).get(TimeValue.timeValueMinutes(1)); fail(); @@ -93,7 +93,7 @@ public class ProxySearchRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareSearch(FakeIndexDefinition.INDEX).execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchScrollRequestBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchScrollRequestBuilderTest.java index 2b984e53eb4..d3daefcd30c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchScrollRequestBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/request/ProxySearchScrollRequestBuilderTest.java @@ -69,7 +69,7 @@ public class ProxySearchScrollRequestBuilderTest { } @Test - public void fail_to_search_bad_query() throws Exception { + public void fail_to_search_bad_query() { try { esTester.client().prepareSearchScroll("unknown").get(); fail(); @@ -80,7 +80,7 @@ public class ProxySearchScrollRequestBuilderTest { } @Test - public void get_with_string_timeout_is_not_yet_implemented() throws Exception { + public void get_with_string_timeout_is_not_yet_implemented() { try { esTester.client().prepareSearchScroll("scrollId").get("1"); fail(); @@ -90,7 +90,7 @@ public class ProxySearchScrollRequestBuilderTest { } @Test - public void get_with_time_value_timeout_is_not_yet_implemented() throws Exception { + public void get_with_time_value_timeout_is_not_yet_implemented() { try { esTester.client().prepareSearchScroll("scrollId").get(TimeValue.timeValueMinutes(1)); fail(); @@ -100,7 +100,7 @@ public class ProxySearchScrollRequestBuilderTest { } @Test - public void execute_should_throw_an_unsupported_operation_exception() throws Exception { + public void execute_should_throw_an_unsupported_operation_exception() { try { esTester.client().prepareSearchScroll("scrollId").execute(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/event/db/EventDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/event/db/EventDaoTest.java index 9068f1cce32..7639a6260bc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/event/db/EventDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/event/db/EventDaoTest.java @@ -45,19 +45,19 @@ public class EventDaoTest { EventDao dao; @Before - public void setup() throws Exception { + public void setup() { dbTester.truncateTables(); session = dbTester.myBatis().openSession(false); dao = new EventDao(); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void select_by_component_uuid() throws Exception { + public void select_by_component_uuid() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List dtos = dao.selectByComponentUuid(session, "ABCD"); @@ -79,7 +79,7 @@ public class EventDaoTest { } @Test - public void return_different_categories() throws Exception { + public void return_different_categories() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List dtos = dao.selectByComponentUuid(session, "ABCD"); @@ -87,7 +87,7 @@ public class EventDaoTest { } @Test - public void insert() throws Exception { + public void insert() { dbTester.prepareDbUnit(getClass(), "empty.xml"); dao.insert(session, new EventDto() @@ -106,7 +106,7 @@ public class EventDaoTest { } @Test - public void delete() throws Exception { + public void delete() { dbTester.prepareDbUnit(getClass(), "delete.xml"); dao.delete(session, 1L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/exceptions/BadRequestExceptionTest.java b/server/sonar-server/src/test/java/org/sonar/server/exceptions/BadRequestExceptionTest.java index 3708610ccfd..8a9137903c9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/exceptions/BadRequestExceptionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/exceptions/BadRequestExceptionTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class BadRequestExceptionTest { @Test - public void text_error() throws Exception { + public void text_error() { BadRequestException exception = new BadRequestException("error"); assertThat(exception.getMessage()).isEqualTo("error"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/exceptions/MessageTest.java b/server/sonar-server/src/test/java/org/sonar/server/exceptions/MessageTest.java index 4196a58ce29..ea17a0554ce 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/exceptions/MessageTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/exceptions/MessageTest.java @@ -56,7 +56,7 @@ public class MessageTest { } @Test - public void to_string() throws Exception { + public void to_string() { assertThat(Message.of("key1", "param1").toString()).isEqualTo("Message{key=key1, params=[param1]}"); assertThat(Message.of("key1").toString()).isEqualTo("Message{key=key1, params=[]}"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/exceptions/VerificationsTest.java b/server/sonar-server/src/test/java/org/sonar/server/exceptions/VerificationsTest.java index 7d5398d215c..aa520c2e7c5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/exceptions/VerificationsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/exceptions/VerificationsTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; public class VerificationsTest { @Test - public void check() throws Exception { + public void check() { // no exception Verifications.check(true, "my.l10n.key", "foo", "bar"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/AddTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/AddTagsActionTest.java index d92f272fc19..d525662371c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/AddTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/AddTagsActionTest.java @@ -73,7 +73,7 @@ public class AddTagsActionTest { } @Test - public void should_fail_if_tag_is_not_valid() throws Exception { + public void should_fail_if_tag_is_not_valid() { throwable.expect(IllegalArgumentException.class); throwable.expectMessage("Tag 'th ag' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/AssignActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/AssignActionTest.java index 26ac975139a..559837dd716 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/AssignActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/AssignActionTest.java @@ -74,7 +74,7 @@ public class AssignActionTest { } @Test - public void should_fail_if_assignee_is_not_verified() throws Exception { + public void should_fail_if_assignee_is_not_verified() { throwable.expect(IllegalArgumentException.class); throwable.expectMessage("Assignee is missing from the execution parameters"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java index 245e45234d6..b8a09996861 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java @@ -99,32 +99,32 @@ public class InternalRubyIssueServiceTest { } @Test - public void get_issue_by_key() throws Exception { + public void get_issue_by_key() { service.getIssueByKey("ABCD"); verify(issueService).getByKey("ABCD"); } @Test - public void list_transitions_by_issue_key() throws Exception { + public void list_transitions_by_issue_key() { service.listTransitions("ABCD"); verify(issueService).listTransitions(eq("ABCD")); } @Test - public void list_transitions_by_issue() throws Exception { + public void list_transitions_by_issue() { Issue issue = new DefaultIssue().setKey("ABCD"); service.listTransitions(issue); verify(issueService).listTransitions(eq(issue)); } @Test - public void list_status() throws Exception { + public void list_status() { service.listStatus(); verify(issueService).listStatus(); } @Test - public void list_resolutions() throws Exception { + public void list_resolutions() { assertThat(service.listResolutions()).isEqualTo(Issue.RESOLUTIONS); } @@ -151,7 +151,7 @@ public class InternalRubyIssueServiceTest { } @Test - public void do_transition() throws Exception { + public void do_transition() { service.doTransition("ABCD", Issue.STATUS_RESOLVED); verify(issueService).doTransition(eq("ABCD"), eq(Issue.STATUS_RESOLVED)); } @@ -695,14 +695,14 @@ public class InternalRubyIssueServiceTest { } @Test - public void list_tags() throws Exception { + public void list_tags() { List tags = Arrays.asList("tag1", "tag2", "tag3"); when(issueService.listTags(null, 0)).thenReturn(tags); assertThat(service.listTags()).isEqualTo(tags); } @Test - public void list_tags_for_component() throws Exception { + public void list_tags_for_component() { Map tags = ImmutableMap.of("tag1", 1L, "tag2", 2L, "tag3", 3L); int pageSize = 42; IssueQuery query = IssueQuery.builder().build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueBulkChangeServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueBulkChangeServiceMediumTest.java index 65fe47c44cf..62340cd33f7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueBulkChangeServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueBulkChangeServiceMediumTest.java @@ -74,7 +74,7 @@ public class IssueBulkChangeServiceMediumTest { UserSession userSession; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); session = db.openSession(false); @@ -108,7 +108,7 @@ public class IssueBulkChangeServiceMediumTest { } @Test - public void bulk_change() throws Exception { + public void bulk_change() { UserDto user = new UserDto().setLogin("fred").setName("Fred"); db.userDao().insert(session, user); @@ -130,7 +130,7 @@ public class IssueBulkChangeServiceMediumTest { } @Test - public void bulk_change_on_500_issues() throws Exception { + public void bulk_change_on_500_issues() { List issueKeys = newArrayList(); for (int i = 0; i < 500; i++) { IssueDto issue = IssueTesting.newDto(rule, file, project).setStatus(Issue.STATUS_OPEN); @@ -152,7 +152,7 @@ public class IssueBulkChangeServiceMediumTest { } @Test - public void fail_if_bulk_change_on_more_than_500_issues() throws Exception { + public void fail_if_bulk_change_on_more_than_500_issues() { List issueKeys = newArrayList(); for (int i = 0; i < 510; i++) { issueKeys.add("issue-" + i); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogServiceTest.java index 2c56df4a070..d4d333d171b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueChangelogServiceTest.java @@ -57,12 +57,12 @@ public class IssueChangelogServiceTest { IssueChangelogService service; @Before - public void setUp() throws Exception { + public void setUp() { service = new IssueChangelogService(changeDao, userFinder, issueService, formatter); } @Test - public void load_changelog_and_related_users() throws Exception { + public void load_changelog_and_related_users() { FieldDiffs userChange = new FieldDiffs().setUserLogin("arthur").setDiff("severity", "MAJOR", "BLOCKER"); FieldDiffs scanChange = new FieldDiffs().setDiff("status", "RESOLVED", "CLOSED"); when(changeDao.selectChangelogByIssue("ABCDE")).thenReturn(Arrays.asList(userChange, scanChange)); @@ -80,7 +80,7 @@ public class IssueChangelogServiceTest { } @Test - public void format_diffs() throws Exception { + public void format_diffs() { FieldDiffs diffs = new FieldDiffs().setUserLogin("arthur").setDiff("severity", "MAJOR", "BLOCKER"); MockUserSession.set(); service.formatDiffs(diffs); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceMediumTest.java index ccbd8422d61..f95030fe975 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceMediumTest.java @@ -70,7 +70,7 @@ public class IssueCommentServiceMediumTest { ComponentDto file; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); indexClient = tester.get(IndexClient.class); @@ -105,7 +105,7 @@ public class IssueCommentServiceMediumTest { } @Test - public void add_comment() throws Exception { + public void add_comment() { IssueDto issue = IssueTesting.newDto(rule, file, project); tester.get(IssueDao.class).insert(session, issue); session.commit(); @@ -119,7 +119,7 @@ public class IssueCommentServiceMediumTest { } @Test - public void add_comment_on_removed_issue() throws Exception { + public void add_comment_on_removed_issue() { RuleDto removedRule = RuleTesting.newDto(RuleKey.of("removed", "rule")).setStatus(RuleStatus.REMOVED); tester.get(RuleDao.class).insert(session, removedRule); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceTest.java index 90fcbff51b3..39bb1d63e0d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueCommentServiceTest.java @@ -91,19 +91,19 @@ public class IssueCommentServiceTest { } @Test - public void find_comments() throws Exception { + public void find_comments() { issueCommentService.findComments("ABCD"); verify(changeDao).selectCommentsByIssues(session, newArrayList("ABCD")); } @Test - public void should_find_comment() throws Exception { + public void should_find_comment() { issueCommentService.findComment("ABCD"); verify(changeDao).selectCommentByKey("ABCD"); } @Test - public void should_add_comment() throws Exception { + public void should_add_comment() { IssueDto issueDto = IssueTesting.newDto(RuleTesting.newXooX1().setId(500), ComponentTesting.newFileDto(ComponentTesting.newProjectDto()), ComponentTesting.newProjectDto()); when(issueService.getByKeyForUpdate(session, "ABCD")).thenReturn(issueDto); when(issueCommentService.findComments(session, "ABCD")).thenReturn(newArrayList(new DefaultIssueComment())); @@ -115,7 +115,7 @@ public class IssueCommentServiceTest { } @Test - public void should_be_logged_when_adding_comment() throws Exception { + public void should_be_logged_when_adding_comment() { throwable.expect(UnauthorizedException.class); MockUserSession.set().setLogin(null); @@ -127,7 +127,7 @@ public class IssueCommentServiceTest { } @Test - public void should_prevent_adding_empty_comment() throws Exception { + public void should_prevent_adding_empty_comment() { throwable.expect(BadRequestException.class); issueCommentService.addComment("myIssue", " ", MockUserSession.get()); @@ -137,7 +137,7 @@ public class IssueCommentServiceTest { } @Test - public void should_prevent_adding_null_comment() throws Exception { + public void should_prevent_adding_null_comment() { throwable.expect(BadRequestException.class); issueCommentService.addComment("myIssue", null, MockUserSession.get()); @@ -147,7 +147,7 @@ public class IssueCommentServiceTest { } @Test - public void fail_if_comment_not_inserted_in_db() throws Exception { + public void fail_if_comment_not_inserted_in_db() { IssueDto issueDto = IssueTesting.newDto(RuleTesting.newXooX1().setId(500), ComponentTesting.newFileDto(ComponentTesting.newProjectDto()), ComponentTesting.newProjectDto()); when(issueService.getByKeyForUpdate(session, "ABCD")).thenReturn(issueDto); // Comment has not be inserted in db @@ -162,7 +162,7 @@ public class IssueCommentServiceTest { } @Test - public void should_delete_comment() throws Exception { + public void should_delete_comment() { when(changeDao.selectCommentByKey("ABCD")).thenReturn(new DefaultIssueComment().setUserLogin("admin").setIssueKey("EFGH")); issueCommentService.deleteComment("ABCD", MockUserSession.get()); @@ -172,7 +172,7 @@ public class IssueCommentServiceTest { } @Test - public void should_not_delete_not_found_comment() throws Exception { + public void should_not_delete_not_found_comment() { throwable.expect(NotFoundException.class); when(changeDao.selectCommentByKey("ABCD")).thenReturn(null); @@ -183,7 +183,7 @@ public class IssueCommentServiceTest { } @Test - public void should_prevent_delete_others_comment() throws Exception { + public void should_prevent_delete_others_comment() { throwable.expect(ForbiddenException.class); when(changeDao.selectCommentByKey("ABCD")).thenReturn(new DefaultIssueComment().setUserLogin("julien")); @@ -194,7 +194,7 @@ public class IssueCommentServiceTest { } @Test - public void should_update_comment() throws Exception { + public void should_update_comment() { when(changeDao.selectCommentByKey("ABCD")).thenReturn(new DefaultIssueComment().setIssueKey("EFGH").setUserLogin("admin")); issueCommentService.editComment("ABCD", "updated comment", MockUserSession.get()); @@ -204,7 +204,7 @@ public class IssueCommentServiceTest { } @Test - public void should_not_update_not_found_comment() throws Exception { + public void should_not_update_not_found_comment() { throwable.expect(NotFoundException.class); when(changeDao.selectCommentByKey("ABCD")).thenReturn(null); @@ -215,7 +215,7 @@ public class IssueCommentServiceTest { } @Test - public void should_prevent_updating_empty_comment() throws Exception { + public void should_prevent_updating_empty_comment() { throwable.expect(BadRequestException.class); issueCommentService.editComment("ABCD", "", MockUserSession.get()); @@ -224,7 +224,7 @@ public class IssueCommentServiceTest { } @Test - public void should_prevent_updating_null_comment() throws Exception { + public void should_prevent_updating_null_comment() { throwable.expect(BadRequestException.class); issueCommentService.editComment("ABCD", null, MockUserSession.get()); @@ -233,7 +233,7 @@ public class IssueCommentServiceTest { } @Test - public void should_prevent_updating_others_comment() throws Exception { + public void should_prevent_updating_others_comment() { throwable.expect(ForbiddenException.class); when(changeDao.selectCommentByKey("ABCD")).thenReturn(new DefaultIssueComment().setUserLogin("julien")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java index 4e0db201be0..4b1645ef987 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryServiceTest.java @@ -82,7 +82,7 @@ public class IssueQueryServiceTest { IssueQueryService issueQueryService; @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.openSession(false)).thenReturn(session); when(dbClient.componentDao()).thenReturn(componentDao); when(dbClient.authorDao()).thenReturn(authorDao); @@ -242,7 +242,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_component_root_uuids_but_unknown_qualifiers() throws Exception { + public void should_search_in_tree_with_component_root_uuids_but_unknown_qualifiers() { Map map = newHashMap(); map.put("componentRootUuids", newArrayList("ABCD")); @@ -254,7 +254,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_component_roots_but_different_qualifiers() throws Exception { + public void should_search_in_tree_with_component_roots_but_different_qualifiers() { Map map = newHashMap(); map.put("componentRoots", newArrayList("org.apache.struts:struts", "org.codehaus.sonar:sonar-server")); @@ -270,7 +270,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_view() throws Exception { + public void should_search_in_tree_with_view() { String viewUuid = "ABCD"; Map map = newHashMap(); map.put("componentRootUuids", newArrayList(viewUuid)); @@ -285,7 +285,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_subview_but_bad_permissions() throws Exception { + public void should_search_in_tree_with_subview_but_bad_permissions() { String subViewUuid = "ABCD"; Map map = newHashMap(); map.put("componentRootUuids", newArrayList(subViewUuid)); @@ -299,7 +299,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_project_uuid() throws Exception { + public void should_search_in_tree_with_project_uuid() { String projectUuid = "ABCD"; Map map = newHashMap(); map.put("componentUuids", newArrayList(projectUuid)); @@ -312,7 +312,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_on_component_only_with_project_key() throws Exception { + public void should_search_on_component_only_with_project_key() { String projectKey = "org.apache.struts:struts"; String projectUuid = "ABCD"; Map map = newHashMap(); @@ -329,7 +329,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_on_developer() throws Exception { + public void should_search_on_developer() { String devUuid = "DEV:anakin.skywalker"; String login1 = "anakin@skywalker.name"; String login2 = "darth.vader"; @@ -344,7 +344,7 @@ public class IssueQueryServiceTest { } @Test - public void should_override_authors_when_searching_on_developer() throws Exception { + public void should_override_authors_when_searching_on_developer() { String devUuid = "DEV:anakin.skywalker"; String login = "anakin@skywalker.name"; Map map = newHashMap(); @@ -358,7 +358,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_on_developer_technical_project() throws Exception { + public void should_search_on_developer_technical_project() { String projectUuid = "sample1"; String devUuid = "DEV:anakin.skywalker"; String login1 = "anakin@skywalker.name"; @@ -383,7 +383,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_module_uuid() throws Exception { + public void should_search_in_tree_with_module_uuid() { String moduleUuid = "ABCD"; Map map = newHashMap(); map.put("componentUuids", newArrayList(moduleUuid)); @@ -396,7 +396,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_in_tree_with_directory_uuid() throws Exception { + public void should_search_in_tree_with_directory_uuid() { String directoryUuid = "ABCD"; String directoryPath = "/some/module/relative/path"; String moduleUuid = "BCDE"; @@ -413,7 +413,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_on_source_file() throws Exception { + public void should_search_on_source_file() { String fileUuid = "ABCD"; Map map = newHashMap(); map.put("componentUuids", newArrayList(fileUuid)); @@ -425,7 +425,7 @@ public class IssueQueryServiceTest { } @Test - public void should_search_on_test_file() throws Exception { + public void should_search_on_test_file() { String fileUuid = "ABCD"; Map map = newHashMap(); map.put("componentUuids", newArrayList(fileUuid)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java index 379dd6395b9..5af86be2654 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryTest.java @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class IssueQueryTest { @Test - public void build_query() throws Exception { + public void build_query() { IssueQuery query = IssueQuery.builder() .issueKeys(newArrayList("ABCDE")) .severities(newArrayList(Severity.BLOCKER)) @@ -81,7 +81,7 @@ public class IssueQueryTest { } @Test - public void build_query_without_dates() throws Exception { + public void build_query_without_dates() { IssueQuery query = IssueQuery.builder() .issueKeys(newArrayList("ABCDE")) .createdAfter(null) @@ -96,7 +96,7 @@ public class IssueQueryTest { } @Test - public void throw_exception_if_sort_is_not_valid() throws Exception { + public void throw_exception_if_sort_is_not_valid() { try { IssueQuery.builder() .sort("UNKNOWN") @@ -107,7 +107,7 @@ public class IssueQueryTest { } @Test - public void collection_params_should_not_be_null_but_empty() throws Exception { + public void collection_params_should_not_be_null_but_empty() { IssueQuery query = IssueQuery.builder() .issueKeys(null) .componentUuids(null) @@ -161,7 +161,7 @@ public class IssueQueryTest { } @Test - public void should_accept_null_sort() throws Exception { + public void should_accept_null_sort() { IssueQuery query = IssueQuery.builder().sort(null).build(); assertThat(query.sort()).isNull(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java index a16bbdbe917..7a12ce178c2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java @@ -87,7 +87,7 @@ public class IssueServiceMediumTest { IssueService service; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); IssueIndex = tester.get(IssueIndex.class); @@ -105,7 +105,7 @@ public class IssueServiceMediumTest { } @Test - public void get_by_key() throws Exception { + public void get_by_key() { RuleDto rule = newRule(); ComponentDto project = newProject(); ComponentDto file = newFile(project); @@ -115,7 +115,7 @@ public class IssueServiceMediumTest { } @Test - public void can_facet() throws Exception { + public void can_facet() { RuleDto rule = newRule(); ComponentDto project = newProject(); ComponentDto file = newFile(project); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java index 53ee7d8d03c..ad8ca76dedd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/PlanActionTest.java @@ -73,7 +73,7 @@ public class PlanActionTest { } @Test - public void should_fail_on_unverified_action_plan() throws Exception { + public void should_fail_on_unverified_action_plan() { throwable.expect(IllegalArgumentException.class); throwable.expectMessage("Action plan is missing from the execution parameters"); @@ -124,7 +124,7 @@ public class PlanActionTest { } @Test - public void should_unplan_if_action_plan_is_empty() throws Exception { + public void should_unplan_if_action_plan_is_empty() { String planKey = ""; Map properties = newHashMap(); properties.put("plan", planKey); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java index 24194997643..7280f972a34 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java @@ -73,7 +73,7 @@ public class RemoveTagsActionTest { } @Test - public void should_fail_if_tag_is_not_valid() throws Exception { + public void should_fail_if_tag_is_not_valid() { throwable.expect(IllegalArgumentException.class); throwable.expectMessage("Tag 'th ag' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/RulesAggregationTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/RulesAggregationTest.java index 9931c01354c..08e41c95fca 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/RulesAggregationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/RulesAggregationTest.java @@ -30,13 +30,13 @@ import static org.assertj.core.api.Assertions.assertThat; public class RulesAggregationTest { @Test - public void empty() throws Exception { + public void empty() { RulesAggregation rulesAggregation = new RulesAggregation(); assertThat(rulesAggregation.rules()).isEmpty(); } @Test - public void count_rules() throws Exception { + public void count_rules() { RulesAggregation rulesAggregation = new RulesAggregation(); RuleKey ruleKey = RuleKey.of("xoo", "S001"); RuleDto ruleDto = RuleTesting.newDto(ruleKey).setName("Rule name"); @@ -51,7 +51,7 @@ public class RulesAggregationTest { } @Test - public void count_rules_with_different_rules() throws Exception { + public void count_rules_with_different_rules() { RulesAggregation rulesAggregation = new RulesAggregation(); RuleDto ruleDto = RuleTesting.newDto(RuleKey.of("xoo", "S001")).setName("Rule name 1"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java index afca99bb5f4..d5bd46f2867 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueStorageTest.java @@ -69,12 +69,12 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void load_component_id_from_db() throws Exception { + public void load_component_id_from_db() { setupData("load_component_id_from_db"); session.commit(); @@ -84,7 +84,7 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase { } @Test - public void load_project_id_from_db() throws Exception { + public void load_project_id_from_db() { setupData("load_project_id_from_db"); session.commit(); @@ -94,7 +94,7 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase { } @Test - public void should_insert_new_issues() throws Exception { + public void should_insert_new_issues() { setupData("should_insert_new_issues"); DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); @@ -128,7 +128,7 @@ public class ServerIssueStorageTest extends AbstractDaoTestCase { } @Test - public void should_update_issues() throws Exception { + public void should_update_issues() { setupData("should_update_issues"); IssueChangeContext context = IssueChangeContext.createUser(new Date(), "emmerik"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java index 433c78b1895..77249d2685a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/actionplan/ActionPlanWsTest.java @@ -32,7 +32,7 @@ public class ActionPlanWsTest { WsTester tester = new WsTester(new ActionPlanWs()); @Test - public void define_controller() throws Exception { + public void define_controller() { WebService.Controller controller = tester.controller("api/action_plans"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); @@ -40,7 +40,7 @@ public class ActionPlanWsTest { } @Test - public void define_search_action() throws Exception { + public void define_search_action() { WebService.Controller controller = tester.controller("api/action_plans"); WebService.Action action = controller.action("search"); @@ -51,7 +51,7 @@ public class ActionPlanWsTest { } @Test - public void define_create_action() throws Exception { + public void define_create_action() { WebService.Controller controller = tester.controller("api/action_plans"); WebService.Action action = controller.action("create"); @@ -61,7 +61,7 @@ public class ActionPlanWsTest { } @Test - public void define_delete_action() throws Exception { + public void define_delete_action() { WebService.Controller controller = tester.controller("api/action_plans"); WebService.Action action = controller.action("delete"); @@ -71,7 +71,7 @@ public class ActionPlanWsTest { } @Test - public void define_update_action() throws Exception { + public void define_update_action() { WebService.Controller controller = tester.controller("api/action_plans"); WebService.Action action = controller.action("update"); @@ -81,7 +81,7 @@ public class ActionPlanWsTest { } @Test - public void define_open_action() throws Exception { + public void define_open_action() { WebService.Controller controller = tester.controller("api/action_plans"); WebService.Action action = controller.action("open"); @@ -91,7 +91,7 @@ public class ActionPlanWsTest { } @Test - public void define_close_action() throws Exception { + public void define_close_action() { WebService.Controller controller = tester.controller("api/action_plans"); WebService.Action action = controller.action("close"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java index 7a6f9a6f0e2..4c89e886a8b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/db/IssueDaoTest.java @@ -40,7 +40,7 @@ public class IssueDaoTest extends AbstractDaoTestCase { private DbSession session; @Before - public void before() throws Exception { + public void before() { this.session = getMyBatis().openSession(false); this.sut = new IssueDao(getMyBatis()); } @@ -130,7 +130,7 @@ public class IssueDaoTest extends AbstractDaoTestCase { } @Test - public void insert() throws Exception { + public void insert() { IssueDto dto = new IssueDto(); dto.setComponent(new ComponentDto().setKey("struts:Action").setId(123L).setUuid("component-uuid")); dto.setProject(new ComponentDto().setKey("struts").setId(100L).setUuid("project-uuid")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/AppActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/AppActionTest.java index 68798c173b7..b36e727f2d7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/AppActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/AppActionTest.java @@ -47,7 +47,7 @@ public class AppActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { action = new AppAction(service, writer); tester = new WsTester(new IssueFilterWs(action, mock(ShowAction.class), mock(FavoritesAction.class))); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/FavoritesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/FavoritesActionTest.java index 35bce350817..4d4b0816f14 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/FavoritesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/FavoritesActionTest.java @@ -48,7 +48,7 @@ public class FavoritesActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { action = new FavoritesAction(service); tester = new WsTester(new IssueFilterWs(mock(AppAction.class), mock(ShowAction.class), action)); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterServiceTest.java index 95041c468b1..5faa9e0163f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterServiceTest.java @@ -391,7 +391,7 @@ public class IssueFilterServiceTest { } @Test - public void should_change_shared_filter_ownership_when_admin() throws Exception { + public void should_change_shared_filter_ownership_when_admin() { IssueFilterDto sharedFilter = new IssueFilterDto().setId(1L).setName("My filter").setUserLogin("former.owner").setShared(true); IssueFilterDto expectedDto = new IssueFilterDto().setName("My filter").setUserLogin("new.owner").setShared(true); @@ -409,7 +409,7 @@ public class IssueFilterServiceTest { } @Test - public void should_deny_filter_ownership_change_when_not_admin() throws Exception { + public void should_deny_filter_ownership_change_when_not_admin() { String currentUser = "dave.loper"; IssueFilterDto sharedFilter = new IssueFilterDto().setId(1L).setName("My filter").setUserLogin(currentUser).setShared(true); @@ -675,7 +675,7 @@ public class IssueFilterServiceTest { } @Test - public void should_create_filter_provided_by_platform() throws Exception { + public void should_create_filter_provided_by_platform() { ArgumentCaptor filterCaptor = ArgumentCaptor.forClass(IssueFilterDto.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWriterTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWriterTest.java index a468eeb70ad..a02a6c1fad0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWriterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWriterTest.java @@ -36,7 +36,7 @@ public class IssueFilterWriterTest { IssueFilterWriter writer = new IssueFilterWriter(); @Test - public void write_filter() throws Exception { + public void write_filter() { UserSession userSession = MockUserSession.set(); test(userSession, new IssueFilterDto() @@ -58,7 +58,7 @@ public class IssueFilterWriterTest { } @Test - public void can_modify_if_logged_user_own_filter() throws Exception { + public void can_modify_if_logged_user_own_filter() { UserSession userSession = MockUserSession.set().setLogin("simon"); test(userSession, new IssueFilterDto() @@ -80,7 +80,7 @@ public class IssueFilterWriterTest { } @Test - public void can_modify_if_logged_user_has_permission() throws Exception { + public void can_modify_if_logged_user_has_permission() { UserSession userSession = MockUserSession.set().setLogin("simon").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); test(userSession, new IssueFilterDto() diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWsTest.java index 6a6e902af5b..f85e678d89f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/IssueFilterWsTest.java @@ -43,13 +43,13 @@ public class IssueFilterWsTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { ws = new IssueFilterWs(new AppAction(service, issueFilterWriter), new ShowAction(service, issueFilterWriter), new FavoritesAction(service)); tester = new WsTester(ws); } @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/issue_filters"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/RegisterIssueFiltersTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/RegisterIssueFiltersTest.java index b91822f3636..4d686c113d2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/RegisterIssueFiltersTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/RegisterIssueFiltersTest.java @@ -46,7 +46,7 @@ public class RegisterIssueFiltersTest { private System2 system; @Before - public void setUp() throws Exception { + public void setUp() { IssueFilterDao issueFilterDao = new IssueFilterDao(db.myBatis()); LoadedTemplateDao loadedTemplateDao = new LoadedTemplateDao(db.myBatis()); system = mock(System2.class); @@ -54,7 +54,7 @@ public class RegisterIssueFiltersTest { } @Test - public void should_do_nothing_if_not_needed() throws Exception { + public void should_do_nothing_if_not_needed() { db.prepareDbUnit(getClass(), "do_nothing.xml"); taskUnderTest.start(); taskUnderTest.stop(); @@ -62,7 +62,7 @@ public class RegisterIssueFiltersTest { } @Test - public void should_register_issue_filters() throws Exception { + public void should_register_issue_filters() { Date now = DateUtils.parseDateTime("2011-04-25T01:15:00+0200"); when(system.now()).thenReturn(now.getTime()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/ShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/ShowActionTest.java index 8c1d38b96e4..7642f62d48a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/filter/ShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/filter/ShowActionTest.java @@ -48,7 +48,7 @@ public class ShowActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { action = new ShowAction(service, writer); tester = new WsTester(new IssueFilterWs(mock(AppAction.class), action, mock(FavoritesAction.class))); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java index 271802674c1..f4a3cfe9f8f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationDaoTest.java @@ -54,12 +54,12 @@ public class IssueAuthorizationDaoTest { } @After - public void tearDown() throws Exception { + public void tearDown() { DbUtils.closeQuietly(connection); } @Test - public void select_all() throws Exception { + public void select_all() { dbTester.prepareDbUnit(getClass(), "shared.xml"); Collection dtos = dao.selectAfterDate(client, connection, 0L); @@ -77,7 +77,7 @@ public class IssueAuthorizationDaoTest { } @Test - public void select_after_date() throws Exception { + public void select_after_date() { dbTester.prepareDbUnit(getClass(), "shared.xml"); Collection dtos = dao.selectAfterDate(client, connection, 1500000000L); @@ -91,7 +91,7 @@ public class IssueAuthorizationDaoTest { } @Test - public void no_authorization() throws Exception { + public void no_authorization() { dbTester.prepareDbUnit(getClass(), "no_authorization.xml"); Collection dtos = dao.selectAfterDate(client, connection, 0L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java index 6bfe8928e9b..9c125a65c2c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java @@ -46,13 +46,13 @@ public class IssueAuthorizationIndexerTest { public static EsTester esTester = new EsTester().addDefinitions(new IssueIndexDefinition(new Settings())); @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); } @Test - public void index_nothing() throws Exception { + public void index_nothing() { IssueAuthorizationIndexer indexer = createIndexer(); indexer.index(); @@ -60,7 +60,7 @@ public class IssueAuthorizationIndexerTest { } @Test - public void index() throws Exception { + public void index() { dbTester.prepareDbUnit(getClass(), "index.xml"); IssueAuthorizationIndexer indexer = createIndexer(); @@ -80,14 +80,14 @@ public class IssueAuthorizationIndexerTest { } @Test - public void do_not_fail_when_deleting_unindexed_project() throws Exception { + public void do_not_fail_when_deleting_unindexed_project() { IssueAuthorizationIndexer indexer = createIndexer(); indexer.deleteProject("UNKNOWN", true); assertThat(esTester.countDocuments("issues", "authorization")).isZero(); } @Test - public void delete_permissions() throws Exception { + public void delete_permissions() { IssueAuthorizationIndexer indexer = createIndexer(); IssueAuthorizationDao.Dto authorization = new IssueAuthorizationDao.Dto("ABC", System.currentTimeMillis()); authorization.addUser("guy"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDefinitionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDefinitionTest.java index 65b41afdedf..869df3280d1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDefinitionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDefinitionTest.java @@ -32,7 +32,7 @@ public class IssueIndexDefinitionTest { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); @Test - public void define() throws Exception { + public void define() { IssueIndexDefinition def = new IssueIndexDefinition(new Settings()); def.define(context); @@ -47,7 +47,7 @@ public class IssueIndexDefinitionTest { } @Test - public void enable_cluster() throws Exception { + public void enable_cluster() { Settings settings = new Settings(); settings.setProperty(ProcessProperties.CLUSTER_ACTIVATE, true); IssueIndexDefinition def = new IssueIndexDefinition(settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java index a1e7ed70107..30b6b500075 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java @@ -71,7 +71,7 @@ public class IssueIndexTest { ViewIndexer viewIndexer; @Before - public void setUp() throws Exception { + public void setUp() { tester.truncateIndices(); issueIndexer = new IssueIndexer(null, tester.client()); issueAuthorizationIndexer = new IssueAuthorizationIndexer(null, tester.client()); @@ -85,7 +85,7 @@ public class IssueIndexTest { } @Test - public void get_by_key() throws Exception { + public void get_by_key() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); IssueDoc issue = IssueTesting.newDoc("ISSUE1", file); @@ -96,7 +96,7 @@ public class IssueIndexTest { } @Test - public void get_by_key_with_attributes() throws Exception { + public void get_by_key_with_attributes() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); IssueDoc issue = IssueTesting.newDoc("ISSUE1", file).setAttributes((KeyValueFormat.format(ImmutableMap.of("jira-issue-key", "SONAR-1234")))); @@ -107,7 +107,7 @@ public class IssueIndexTest { } @Test(expected = IllegalStateException.class) - public void comments_field_is_not_available() throws Exception { + public void comments_field_is_not_available() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); IssueDoc issue = IssueTesting.newDoc("ISSUE1", file); @@ -118,7 +118,7 @@ public class IssueIndexTest { } @Test(expected = IllegalStateException.class) - public void is_new_field_is_not_available() throws Exception { + public void is_new_field_is_not_available() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); IssueDoc issue = IssueTesting.newDoc("ISSUE1", file); @@ -129,12 +129,12 @@ public class IssueIndexTest { } @Test(expected = NotFoundException.class) - public void fail_to_get_unknown_key() throws Exception { + public void fail_to_get_unknown_key() { index.getByKey("unknown"); } @Test - public void filter_by_keys() throws Exception { + public void filter_by_keys() { ComponentDto project = ComponentTesting.newProjectDto(); indexIssues( @@ -147,7 +147,7 @@ public class IssueIndexTest { } @Test - public void filter_by_projects() throws Exception { + public void filter_by_projects() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto module = ComponentTesting.newModuleDto(project); ComponentDto subModule = ComponentTesting.newModuleDto(module); @@ -165,7 +165,7 @@ public class IssueIndexTest { } @Test - public void facets_on_projects() throws Exception { + public void facets_on_projects() { ComponentDto project = ComponentTesting.newProjectDto("ABCD"); ComponentDto project2 = ComponentTesting.newProjectDto("EFGH"); @@ -180,7 +180,7 @@ public class IssueIndexTest { } @Test - public void filter_by_modules() throws Exception { + public void filter_by_modules() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto module = ComponentTesting.newModuleDto(project); ComponentDto subModule = ComponentTesting.newModuleDto(module); @@ -203,7 +203,7 @@ public class IssueIndexTest { } @Test - public void filter_by_components_on_contextualized_search() throws Exception { + public void filter_by_components_on_contextualized_search() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto module = ComponentTesting.newModuleDto(project); ComponentDto subModule = ComponentTesting.newModuleDto(module); @@ -238,7 +238,7 @@ public class IssueIndexTest { } @Test - public void filter_by_components_on_non_contextualized_search() throws Exception { + public void filter_by_components_on_non_contextualized_search() { ComponentDto project = ComponentTesting.newProjectDto("project"); ComponentDto file1 = ComponentTesting.newFileDto(project, "file1"); ComponentDto module = ComponentTesting.newModuleDto(project).setUuid("module"); @@ -268,7 +268,7 @@ public class IssueIndexTest { } @Test - public void facets_on_components() throws Exception { + public void facets_on_components() { ComponentDto project = ComponentTesting.newProjectDto("A"); ComponentDto file1 = ComponentTesting.newFileDto(project, "ABCD"); ComponentDto file2 = ComponentTesting.newFileDto(project, "BCDE"); @@ -288,7 +288,7 @@ public class IssueIndexTest { } @Test - public void filter_by_directories() throws Exception { + public void filter_by_directories() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file1 = ComponentTesting.newFileDto(project).setPath("src/main/xoo/F1.xoo"); ComponentDto file2 = ComponentTesting.newFileDto(project).setPath("F2.xoo"); @@ -303,7 +303,7 @@ public class IssueIndexTest { } @Test - public void facets_on_directories() throws Exception { + public void facets_on_directories() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file1 = ComponentTesting.newFileDto(project).setPath("src/main/xoo/F1.xoo"); ComponentDto file2 = ComponentTesting.newFileDto(project).setPath("F2.xoo"); @@ -318,7 +318,7 @@ public class IssueIndexTest { } @Test - public void filter_by_views() throws Exception { + public void filter_by_views() { ComponentDto project1 = ComponentTesting.newProjectDto(); ComponentDto file1 = ComponentTesting.newFileDto(project1); ComponentDto project2 = ComponentTesting.newProjectDto(); @@ -344,7 +344,7 @@ public class IssueIndexTest { } @Test - public void filter_by_severities() throws Exception { + public void filter_by_severities() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -358,7 +358,7 @@ public class IssueIndexTest { } @Test - public void facets_on_severities() throws Exception { + public void facets_on_severities() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -373,7 +373,7 @@ public class IssueIndexTest { } @Test - public void filter_by_statuses() throws Exception { + public void filter_by_statuses() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -387,7 +387,7 @@ public class IssueIndexTest { } @Test - public void facets_on_statuses() throws Exception { + public void facets_on_statuses() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -402,7 +402,7 @@ public class IssueIndexTest { } @Test - public void filter_by_resolutions() throws Exception { + public void filter_by_resolutions() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -417,7 +417,7 @@ public class IssueIndexTest { } @Test - public void facets_on_resolutions() throws Exception { + public void facets_on_resolutions() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -432,7 +432,7 @@ public class IssueIndexTest { } @Test - public void filter_by_resolved() throws Exception { + public void filter_by_resolved() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -447,7 +447,7 @@ public class IssueIndexTest { } @Test - public void filter_by_action_plans() throws Exception { + public void filter_by_action_plans() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -461,7 +461,7 @@ public class IssueIndexTest { } @Test - public void facets_on_action_plans() throws Exception { + public void facets_on_action_plans() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -475,7 +475,7 @@ public class IssueIndexTest { } @Test - public void filter_by_planned() throws Exception { + public void filter_by_planned() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -490,7 +490,7 @@ public class IssueIndexTest { } @Test - public void filter_by_rules() throws Exception { + public void filter_by_rules() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); RuleKey ruleKey = RuleKey.of("repo", "X1"); @@ -502,7 +502,7 @@ public class IssueIndexTest { } @Test - public void filter_by_languages() throws Exception { + public void filter_by_languages() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); RuleKey ruleKey = RuleKey.of("repo", "X1"); @@ -515,7 +515,7 @@ public class IssueIndexTest { } @Test - public void facets_on_languages() throws Exception { + public void facets_on_languages() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); RuleKey ruleKey = RuleKey.of("repo", "X1"); @@ -528,7 +528,7 @@ public class IssueIndexTest { } @Test - public void filter_by_assignees() throws Exception { + public void filter_by_assignees() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -543,7 +543,7 @@ public class IssueIndexTest { } @Test - public void facets_on_assignees() throws Exception { + public void facets_on_assignees() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -559,7 +559,7 @@ public class IssueIndexTest { } @Test - public void facets_on_assignees_supports_dashes() throws Exception { + public void facets_on_assignees_supports_dashes() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -575,7 +575,7 @@ public class IssueIndexTest { } @Test - public void filter_by_assigned() throws Exception { + public void filter_by_assigned() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -590,7 +590,7 @@ public class IssueIndexTest { } @Test - public void filter_by_reporters() throws Exception { + public void filter_by_reporters() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -604,7 +604,7 @@ public class IssueIndexTest { } @Test - public void filter_by_authors() throws Exception { + public void filter_by_authors() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -619,7 +619,7 @@ public class IssueIndexTest { } @Test - public void facets_on_authors() throws Exception { + public void facets_on_authors() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -635,7 +635,7 @@ public class IssueIndexTest { } @Test - public void filter_by_created_after() throws Exception { + public void filter_by_created_after() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -651,7 +651,7 @@ public class IssueIndexTest { } @Test - public void filter_by_created_before() throws Exception { + public void filter_by_created_before() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -667,7 +667,7 @@ public class IssueIndexTest { } @Test - public void filter_by_created_after_and_before() throws Exception { + public void filter_by_created_after_and_before() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -712,7 +712,7 @@ public class IssueIndexTest { } @Test - public void filter_by_created_before_must_be_lower_than_after() throws Exception { + public void filter_by_created_before_must_be_lower_than_after() { try { index.search(IssueQuery.builder().createdAfter(DateUtils.parseDate("2014-09-20")).createdBefore(DateUtils.parseDate("2014-09-19")).build(), new SearchOptions()); Fail.failBecauseExceptionWasNotThrown(IllegalArgumentException.class); @@ -722,7 +722,7 @@ public class IssueIndexTest { } @Test - public void filter_by_created_after_must_not_be_in_future() throws Exception { + public void filter_by_created_after_must_not_be_in_future() { try { index.search(IssueQuery.builder().createdAfter(new Date(Long.MAX_VALUE)).build(), new SearchOptions()); Fail.failBecauseExceptionWasNotThrown(IllegalArgumentException.class); @@ -732,7 +732,7 @@ public class IssueIndexTest { } @Test - public void filter_by_created_at() throws Exception { + public void filter_by_created_at() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -743,7 +743,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_with_less_than_20_days() throws Exception { + public void facet_on_created_at_with_less_than_20_days() { SearchOptions options = fixtureForCreatedAtFacet(); @@ -766,7 +766,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_with_less_than_20_weeks() throws Exception { + public void facet_on_created_at_with_less_than_20_weeks() { SearchOptions SearchOptions = fixtureForCreatedAtFacet(); @@ -782,7 +782,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_with_less_than_20_months() throws Exception { + public void facet_on_created_at_with_less_than_20_months() { SearchOptions SearchOptions = fixtureForCreatedAtFacet(); @@ -800,7 +800,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_with_more_than_20_months() throws Exception { + public void facet_on_created_at_with_more_than_20_months() { SearchOptions SearchOptions = fixtureForCreatedAtFacet(); Map createdAt = index.search(IssueQuery.builder() @@ -818,7 +818,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_with_bounds_outside_of_data() throws Exception { + public void facet_on_created_at_with_bounds_outside_of_data() { SearchOptions options = fixtureForCreatedAtFacet(); Map createdAt = index.search(IssueQuery.builder() @@ -837,7 +837,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_without_start_bound() throws Exception { + public void facet_on_created_at_without_start_bound() { SearchOptions SearchOptions = fixtureForCreatedAtFacet(); Map createdAt = index.search(IssueQuery.builder() @@ -852,7 +852,7 @@ public class IssueIndexTest { } @Test - public void facet_on_created_at_without_issues() throws Exception { + public void facet_on_created_at_without_issues() { SearchOptions SearchOptions = new SearchOptions().addFacets("createdAt"); Map createdAt = index.search(IssueQuery.builder().build(), @@ -878,7 +878,7 @@ public class IssueIndexTest { } @Test - public void paging() throws Exception { + public void paging() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); for (int i = 0; i < 12; i++) { @@ -901,7 +901,7 @@ public class IssueIndexTest { } @Test - public void search_with_max_limit() throws Exception { + public void search_with_max_limit() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); List issues = newArrayList(); @@ -917,7 +917,7 @@ public class IssueIndexTest { } @Test - public void sort_by_status() throws Exception { + public void sort_by_status() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -940,7 +940,7 @@ public class IssueIndexTest { } @Test - public void sort_by_severity() throws Exception { + public void sort_by_severity() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -969,7 +969,7 @@ public class IssueIndexTest { } @Test - public void sort_by_assignee() throws Exception { + public void sort_by_assignee() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -991,7 +991,7 @@ public class IssueIndexTest { } @Test - public void sort_by_creation_date() throws Exception { + public void sort_by_creation_date() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -1013,7 +1013,7 @@ public class IssueIndexTest { } @Test - public void sort_by_update_date() throws Exception { + public void sort_by_update_date() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -1035,7 +1035,7 @@ public class IssueIndexTest { } @Test - public void sort_by_close_date() throws Exception { + public void sort_by_close_date() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file = ComponentTesting.newFileDto(project); @@ -1060,7 +1060,7 @@ public class IssueIndexTest { } @Test - public void sort_by_file_and_line() throws Exception { + public void sort_by_file_and_line() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto file1 = ComponentTesting.newFileDto(project, "F1").setPath("src/main/xoo/org/sonar/samples/File.xoo"); ComponentDto file2 = ComponentTesting.newFileDto(project, "F2").setPath("src/main/xoo/org/sonar/samples/File2.xoo"); @@ -1101,7 +1101,7 @@ public class IssueIndexTest { } @Test - public void authorized_issues_on_groups() throws Exception { + public void authorized_issues_on_groups() { ComponentDto project1 = ComponentTesting.newProjectDto().setKey("project1"); ComponentDto project2 = ComponentTesting.newProjectDto().setKey("project2"); ComponentDto project3 = ComponentTesting.newProjectDto().setKey("project3"); @@ -1134,7 +1134,7 @@ public class IssueIndexTest { } @Test - public void authorized_issues_on_user() throws Exception { + public void authorized_issues_on_user() { ComponentDto project1 = ComponentTesting.newProjectDto().setKey("project1"); ComponentDto project2 = ComponentTesting.newProjectDto().setKey("project2"); ComponentDto project3 = ComponentTesting.newProjectDto().setKey("project3"); @@ -1163,7 +1163,7 @@ public class IssueIndexTest { } @Test - public void authorized_issues_on_user_and_group() throws Exception { + public void authorized_issues_on_user_and_group() { ComponentDto project1 = ComponentTesting.newProjectDto().setKey("project1"); ComponentDto project2 = ComponentTesting.newProjectDto().setKey("project2"); @@ -1208,7 +1208,7 @@ public class IssueIndexTest { } @Test - public void search_issues_for_batch_return_needed_fields() throws Exception { + public void search_issues_for_batch_return_needed_fields() { ComponentDto project = ComponentTesting.newProjectDto("PROJECT"); ComponentDto file = ComponentTesting.newFileDto(project).setPath("src/File.xoo"); @@ -1244,7 +1244,7 @@ public class IssueIndexTest { } @Test - public void search_issues_for_batch() throws Exception { + public void search_issues_for_batch() { ComponentDto project = ComponentTesting.newProjectDto(); ComponentDto module = ComponentTesting.newModuleDto(project); ComponentDto subModule = ComponentTesting.newModuleDto(module); @@ -1265,7 +1265,7 @@ public class IssueIndexTest { } @Test - public void fail_to_search_issues_for_batch_on_not_allowed_scope() throws Exception { + public void fail_to_search_issues_for_batch_on_not_allowed_scope() { try { index.selectIssuesForBatch(new ComponentDto().setScope(Scopes.DIRECTORY)); failBecauseExceptionWasNotThrown(IllegalStateException.class); @@ -1275,7 +1275,7 @@ public class IssueIndexTest { } @Test - public void search_issues_for_batch_return_only_authorized_issues() throws Exception { + public void search_issues_for_batch_return_only_authorized_issues() { ComponentDto project1 = ComponentTesting.newProjectDto().setKey("project1"); ComponentDto project2 = ComponentTesting.newProjectDto().setKey("project2"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java index 03c7bbb8fc3..13fb8233478 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java @@ -45,20 +45,20 @@ public class IssueIndexerTest { public static EsTester esTester = new EsTester().addDefinitions(new IssueIndexDefinition(new Settings())); @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); } @Test - public void index_nothing() throws Exception { + public void index_nothing() { IssueIndexer indexer = createIndexer(); indexer.index(Iterators.emptyIterator()); assertThat(esTester.countDocuments(IssueIndexDefinition.INDEX, IssueIndexDefinition.TYPE_ISSUE)).isEqualTo(0L); } @Test - public void index_nothing_if_disabled() throws Exception { + public void index_nothing_if_disabled() { dbTester.prepareDbUnit(getClass(), "index.xml"); createIndexer().setEnabled(false).index(); @@ -67,7 +67,7 @@ public class IssueIndexerTest { } @Test - public void index() throws Exception { + public void index() { dbTester.prepareDbUnit(getClass(), "index.xml"); IssueIndexer indexer = createIndexer(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java index 43d0d292a36..5d4ce292bb4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueResultSetIteratorTest.java @@ -54,12 +54,12 @@ public class IssueResultSetIteratorTest { } @After - public void tearDown() throws Exception { + public void tearDown() { DbUtils.closeQuietly(connection); } @Test - public void iterator_over_one_issue() throws Exception { + public void iterator_over_one_issue() { dbTester.prepareDbUnit(getClass(), "one_issue.xml"); IssueResultSetIterator it = IssueResultSetIterator.create(client, connection, 0L); Map issuesByKey = issuesByKey(it); @@ -93,7 +93,7 @@ public class IssueResultSetIteratorTest { } @Test - public void iterator_over_issues() throws Exception { + public void iterator_over_issues() { dbTester.prepareDbUnit(getClass(), "shared.xml"); IssueResultSetIterator it = IssueResultSetIterator.create(client, connection, 0L); Map issuesByKey = issuesByKey(it); @@ -151,7 +151,7 @@ public class IssueResultSetIteratorTest { } @Test - public void extract_directory_path() throws Exception { + public void extract_directory_path() { dbTester.prepareDbUnit(getClass(), "extract_directory_path.xml"); IssueResultSetIterator it = IssueResultSetIterator.create(client, connection, 0L); Map issuesByKey = issuesByKey(it); @@ -173,7 +173,7 @@ public class IssueResultSetIteratorTest { } @Test - public void extract_file_path() throws Exception { + public void extract_file_path() { dbTester.prepareDbUnit(getClass(), "extract_file_path.xml"); IssueResultSetIterator it = IssueResultSetIterator.create(client, connection, 0L); Map issuesByKey = issuesByKey(it); @@ -195,7 +195,7 @@ public class IssueResultSetIteratorTest { } @Test - public void select_after_date() throws Exception { + public void select_after_date() { dbTester.prepareDbUnit(getClass(), "shared.xml"); IssueResultSetIterator it = IssueResultSetIterator.create(client, connection, 1420000000000L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcherTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcherTest.java index 75a84e8c5df..e9dd60ee5b9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcherTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcherTest.java @@ -63,7 +63,7 @@ public class ChangesOnMyIssueNotificationDispatcherTest { } @Test - public void should_not_dispatch_if_other_notification_type() throws Exception { + public void should_not_dispatch_if_other_notification_type() { Notification notification = new Notification("other-notif"); dispatcher.performDispatch(notification, context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcherTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcherTest.java index 0bc96d60002..1046d639205 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcherTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcherTest.java @@ -49,7 +49,7 @@ public class DoNotFixNotificationDispatcherTest { } @Test - public void should_not_dispatch_if_other_notification_type() throws Exception { + public void should_not_dispatch_if_other_notification_type() { Notification notification = new Notification("other"); sut.performDispatch(notification, context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangeNotificationTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangeNotificationTest.java index 328e49456db..f31935d577b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangeNotificationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangeNotificationTest.java @@ -31,7 +31,7 @@ public class IssueChangeNotificationTest { IssueChangeNotification notification = new IssueChangeNotification(); @Test - public void set_issue() throws Exception { + public void set_issue() { DefaultIssue issue = new DefaultIssue() .setKey("ABCD") .setReporter("arthur") @@ -52,7 +52,7 @@ public class IssueChangeNotificationTest { } @Test - public void set_issue_with_current_change_having_no_old_value() throws Exception { + public void set_issue_with_current_change_having_no_old_value() { DefaultIssue issue = new DefaultIssue() .setKey("ABCD") .setReporter("arthur") @@ -70,7 +70,7 @@ public class IssueChangeNotificationTest { } @Test - public void set_issue_with_current_change_having_no_new_value() throws Exception { + public void set_issue_with_current_change_having_no_new_value() { DefaultIssue issue = new DefaultIssue() .setKey("ABCD") .setReporter("arthur") @@ -88,32 +88,32 @@ public class IssueChangeNotificationTest { } @Test - public void set_project() throws Exception { + public void set_project() { IssueChangeNotification result = notification.setProject(new ComponentDto().setKey("MyService").setLongName("My Service")); assertThat(result.getFieldValue("projectKey")).isEqualTo("MyService"); assertThat(result.getFieldValue("projectName")).isEqualTo("My Service"); } @Test - public void set_component() throws Exception { + public void set_component() { IssueChangeNotification result = notification.setComponent(new ComponentDto().setKey("MyService").setLongName("My Service")); assertThat(result.getFieldValue("componentName")).isEqualTo("My Service"); } @Test - public void set_change_author_login() throws Exception { + public void set_change_author_login() { IssueChangeNotification result = notification.setChangeAuthorLogin("stephane"); assertThat(result.getFieldValue("changeAuthor")).isEqualTo("stephane"); } @Test - public void set_rule_name() throws Exception { + public void set_rule_name() { IssueChangeNotification result = notification.setRuleName("Xoo Rule"); assertThat(result.getFieldValue("ruleName")).isEqualTo("Xoo Rule"); } @Test - public void setComment() throws Exception { + public void setComment() { IssueChangeNotification result = notification.setComment("My comment"); assertThat(result.getFieldValue("comment")).isEqualTo("My comment"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java index 8ab8fe56354..8f5bcd612f0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java @@ -100,7 +100,7 @@ public class MyNewIssuesEmailTemplateTest { } @Test - public void message_id() throws Exception { + public void message_id() { Notification notification = newNotification(); EmailMessage message = sut.format(notification); @@ -109,7 +109,7 @@ public class MyNewIssuesEmailTemplateTest { } @Test - public void subject() throws Exception { + public void subject() { Notification notification = newNotification(); EmailMessage message = sut.format(notification); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationDispatcherTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationDispatcherTest.java index ca9b627d598..9aaedf1b994 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationDispatcherTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationDispatcherTest.java @@ -48,7 +48,7 @@ public class MyNewIssuesNotificationDispatcherTest { } @Test - public void do_not_dispatch_if_no_new_notification() throws Exception { + public void do_not_dispatch_if_no_new_notification() { Notification notification = new Notification("other-notif"); sut.performDispatch(notification, context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationTest.java index 840179fa11d..8d31716e692 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/MyNewIssuesNotificationTest.java @@ -35,14 +35,14 @@ public class MyNewIssuesNotificationTest { MyNewIssuesNotification sut = new MyNewIssuesNotification(mock(UserIndex.class), mock(RuleIndex.class), mock(DbClient.class), mock(Durations.class)); @Test - public void set_assignee() throws Exception { + public void set_assignee() { sut.setAssignee("myAssignee"); assertThat(sut.getFieldValue(FIELD_ASSIGNEE)).isEqualTo("myAssignee"); } @Test - public void set_with_a_specific_type() throws Exception { + public void set_with_a_specific_type() { assertThat(sut.getType()).isEqualTo(MyNewIssuesNotification.TYPE); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java index 723f9f5ddbb..abd0556bc3c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java @@ -76,7 +76,7 @@ public class NewIssuesEmailTemplateTest { } @Test - public void message_id() throws Exception { + public void message_id() { Notification notification = newNotification(); EmailMessage message = template.format(notification); @@ -85,7 +85,7 @@ public class NewIssuesEmailTemplateTest { } @Test - public void subject() throws Exception { + public void subject() { Notification notification = newNotification(); EmailMessage message = template.format(notification); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationDispatcherTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationDispatcherTest.java index 5be50dc2393..7240dcc950b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationDispatcherTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationDispatcherTest.java @@ -45,7 +45,7 @@ public class NewIssuesNotificationDispatcherTest { } @Test - public void shouldNotDispatchIfNotNewViolationsNotification() throws Exception { + public void shouldNotDispatchIfNotNewViolationsNotification() { Notification notification = new Notification("other-notif"); dispatcher.performDispatch(notification, context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java index ef9bf673dfa..eae48d534ba 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java @@ -65,7 +65,7 @@ public class NewIssuesNotificationTest { NewIssuesNotification sut = new NewIssuesNotification(userIndex, ruleIndex, dbClient, durations); @Test - public void set_project() throws Exception { + public void set_project() { ComponentDto component = ComponentTesting.newProjectDto() .setLongName("project-long-name") .setUuid("project-uuid") @@ -79,7 +79,7 @@ public class NewIssuesNotificationTest { } @Test - public void set_date() throws Exception { + public void set_date() { Date date = new Date(); sut.setAnalysisDate(date); @@ -88,7 +88,7 @@ public class NewIssuesNotificationTest { } @Test - public void set_statistics() throws Exception { + public void set_statistics() { ComponentDto component = ComponentTesting.newProjectDto() .setLongName("project-long-name"); addIssueNTimes(newIssue1(), 5); @@ -122,7 +122,7 @@ public class NewIssuesNotificationTest { } @Test - public void set_debt() throws Exception { + public void set_debt() { when(durations.format(any(Locale.class), any(Duration.class))).thenReturn("55 min"); sut.setDebt(Duration.create(55)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java index 947e1741492..215297d17ed 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/NewIssuesStatisticsTest.java @@ -35,7 +35,7 @@ public class NewIssuesStatisticsTest { NewIssuesStatistics sut = new NewIssuesStatistics(); @Test - public void add_issues_with_correct_global_statistics() throws Exception { + public void add_issues_with_correct_global_statistics() { DefaultIssue issue = defaultIssue(); sut.add(issue); @@ -61,7 +61,7 @@ public class NewIssuesStatisticsTest { } @Test - public void do_not_have_issues_when_no_issue_added() throws Exception { + public void do_not_have_issues_when_no_issue_added() { assertThat(sut.globalStatistics().hasIssues()).isFalse(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AuthorsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AuthorsActionTest.java index c10978bb6ee..3bc79433700 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AuthorsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AuthorsActionTest.java @@ -45,7 +45,7 @@ public class AuthorsActionTest { IssueService service; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new IssuesWs(new AuthorsAction(service))); controller = tester.controller("api/issues"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java index 4dd53d9bf0f..43e8343e570 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/ComponentTagsActionTest.java @@ -60,7 +60,7 @@ public class ComponentTagsActionTest { } @Test - public void should_define() throws Exception { + public void should_define() { Action action = tester.controller("api/issues").action("component_tags"); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExampleAsString()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueActionsWriterTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueActionsWriterTest.java index d4f10786a6a..ef2f33b5ee0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueActionsWriterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueActionsWriterTest.java @@ -56,12 +56,12 @@ public class IssueActionsWriterTest { IssueActionsWriter writer; @Before - public void setUp() throws Exception { + public void setUp() { writer = new IssueActionsWriter(issueService, actionService); } @Test - public void write_all_standard_actions() throws Exception { + public void write_all_standard_actions() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentUuid("BCDE") @@ -80,7 +80,7 @@ public class IssueActionsWriterTest { } @Test - public void write_plugin_actions() throws Exception { + public void write_plugin_actions() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentKey("sample:src/main/xoo/sample/Sample.xoo") @@ -100,7 +100,7 @@ public class IssueActionsWriterTest { } @Test - public void write_only_comment_action() throws Exception { + public void write_only_comment_action() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentKey("sample:src/main/xoo/sample/Sample.xoo") @@ -118,7 +118,7 @@ public class IssueActionsWriterTest { } @Test - public void write_no_action_if_not_logged() throws Exception { + public void write_no_action_if_not_logged() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentKey("sample:src/main/xoo/sample/Sample.xoo") @@ -132,7 +132,7 @@ public class IssueActionsWriterTest { } @Test - public void write_actions_without_assign_to_me() throws Exception { + public void write_actions_without_assign_to_me() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentKey("sample:src/main/xoo/sample/Sample.xoo") @@ -150,7 +150,7 @@ public class IssueActionsWriterTest { } @Test - public void write_transitions() throws Exception { + public void write_transitions() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentKey("sample:src/main/xoo/sample/Sample.xoo") @@ -167,7 +167,7 @@ public class IssueActionsWriterTest { } @Test - public void write_no_transitions() throws Exception { + public void write_no_transitions() { Issue issue = new DefaultIssue() .setKey("ABCD") .setComponentKey("sample:src/main/xoo/sample/Sample.xoo") diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowActionTest.java index d730f222275..86828306900 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowActionTest.java @@ -125,7 +125,7 @@ public class IssueShowActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.openSession(false)).thenReturn(session); when(dbClient.componentDao()).thenReturn(componentDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueTagsActionTest.java index 3bdf5a1c37b..2df47f7d72c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssueTagsActionTest.java @@ -51,7 +51,7 @@ public class IssueTagsActionTest { } @Test - public void should_define() throws Exception { + public void should_define() { Action action = tester.controller("api/issues").action("tags"); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExampleAsString()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssuesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssuesWsTest.java index e47f7fac894..63971f68f68 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssuesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/IssuesWsTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.verify; public class IssuesWsTest { @Test - public void define_actions() throws Exception { + public void define_actions() { BaseIssuesWsAction action1 = mock(BaseIssuesWsAction.class); BaseIssuesWsAction action2 = mock(BaseIssuesWsAction.class); IssuesWs ws = new IssuesWs(action1, action2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java index 2dca1fa5b79..80f52c213bc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java @@ -65,7 +65,7 @@ public class SearchActionComponentsMediumTest { WsTester wsTester; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); wsTester = tester.get(WsTester.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java index 0db8498e682..ac71b09d645 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java @@ -65,7 +65,7 @@ public class SearchActionMediumTest { WsTester wsTester; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); wsTester = tester.get(WsTester.class); @@ -78,7 +78,7 @@ public class SearchActionMediumTest { } @Test - public void define_action() throws Exception { + public void define_action() { WebService.Controller controller = wsTester.controller("api/issues"); WebService.Action show = controller.action("search"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java index 7ccfb597930..84b445175f3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SetTagsActionTest.java @@ -50,7 +50,7 @@ public class SetTagsActionTest { } @Test - public void should_define() throws Exception { + public void should_define() { Action action = tester.controller("api/issues").action("set_tags"); assertThat(action.description()).isNotEmpty(); assertThat(action.responseExampleAsString()).isNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/language/ws/LanguageWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/language/ws/LanguageWsTest.java index e2de7c20e7e..a7d1d3b28d5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/language/ws/LanguageWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/language/ws/LanguageWsTest.java @@ -57,7 +57,7 @@ public class LanguageWsTest { } @Test - public void should_be_well_defined() throws Exception { + public void should_be_well_defined() { Controller controller = tester.controller(CONTROLLER_LANGUAGES); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterEngineTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterEngineTest.java index 0df8c2bf72e..a068d320e10 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterEngineTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/MeasureFilterEngineTest.java @@ -57,7 +57,7 @@ public class MeasureFilterEngineTest { } @Test - public void keep_error_but_do_not_fail() throws Exception { + public void keep_error_but_do_not_fail() { Map filterMap = ImmutableMap.of("qualifiers", (Object) "TRK"); MeasureFilterFactory factory = mock(MeasureFilterFactory.class); when(factory.create(filterMap)).thenThrow(new IllegalArgumentException()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java index 497fbd3aeef..d1efaeb3835 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java @@ -53,12 +53,12 @@ public class MeasureDaoTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void get_value_by_key() throws Exception { + public void get_value_by_key() { db.prepareDbUnit(getClass(), "shared.xml"); MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc"); @@ -68,7 +68,7 @@ public class MeasureDaoTest { @Test // TODO the string must be longer than 4000 char to be persisted in the data field - public void get_data_by_key() throws Exception { + public void get_data_by_key() { db.prepareDbUnit(getClass(), "shared.xml"); MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "authors_by_line"); @@ -77,7 +77,7 @@ public class MeasureDaoTest { } @Test - public void get_text_value_by_key() throws Exception { + public void get_text_value_by_key() { db.prepareDbUnit(getClass(), "shared.xml"); MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "coverage_line_hits_data"); @@ -86,7 +86,7 @@ public class MeasureDaoTest { } @Test - public void find_by_component_key_and_metrics() throws Exception { + public void find_by_component_key_and_metrics() { db.prepareDbUnit(getClass(), "shared.xml"); List results = sut.findByComponentKeyAndMetricKeys(session, "org.struts:struts-core:src/org/struts/RequestContext.java", @@ -109,7 +109,7 @@ public class MeasureDaoTest { } @Test - public void find_by_component_key_and_metric() throws Exception { + public void find_by_component_key_and_metric() { db.prepareDbUnit(getClass(), "shared.xml"); MeasureDto result = sut.findByComponentKeyAndMetricKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc"); @@ -127,7 +127,7 @@ public class MeasureDaoTest { } @Test - public void exists_by_key() throws Exception { + public void exists_by_key() { db.prepareDbUnit(getClass(), "shared.xml"); assertThat(sut.existsByKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java", "ncloc")).isTrue(); @@ -135,7 +135,7 @@ public class MeasureDaoTest { } @Test - public void insert() throws Exception { + public void insert() { db.prepareDbUnit(getClass(), "empty.xml"); sut.insert(session, new MeasureDto() diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MetricDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MetricDaoTest.java index bae10570671..06039d91cdb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MetricDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MetricDaoTest.java @@ -50,12 +50,12 @@ public class MetricDaoTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void get_by_key() throws Exception { + public void get_by_key() { dbTester.prepareDbUnit(getClass(), "shared.xml"); MetricDto result = dao.selectByKey(session, "coverage"); @@ -83,7 +83,7 @@ public class MetricDaoTest { } @Test - public void get_manual_metric() throws Exception { + public void get_manual_metric() { dbTester.prepareDbUnit(getClass(), "manual_metric.xml"); MetricDto result = dao.selectByKey(session, "manual"); @@ -106,14 +106,14 @@ public class MetricDaoTest { } @Test - public void find_all_enabled() throws Exception { + public void find_all_enabled() { dbTester.prepareDbUnit(getClass(), "shared.xml"); assertThat(dao.selectEnabled(session)).hasSize(2); } @Test - public void insert() throws Exception { + public void insert() { dao.insert(session, new MetricDto() .setId(1) .setKey("coverage") diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ManualMeasuresWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ManualMeasuresWsTest.java index abc4eda6937..dae670cdde7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ManualMeasuresWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ManualMeasuresWsTest.java @@ -31,7 +31,7 @@ public class ManualMeasuresWsTest { WsTester tester = new WsTester(new ManualMeasuresWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/manual_measures"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MetricsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MetricsWsTest.java index 86dd7bfc471..030a28e021a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MetricsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MetricsWsTest.java @@ -31,7 +31,7 @@ public class MetricsWsTest { WsTester tester = new WsTester(new MetricsWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/metrics"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/TimeMachineWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/TimeMachineWsTest.java index fd688197b40..ec0addba29f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/TimeMachineWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/TimeMachineWsTest.java @@ -33,13 +33,13 @@ public class TimeMachineWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new TimeMachineWs()); controller = tester.controller("api/timemachine"); } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("2.10"); assertThat(controller.description()).isNotEmpty(); @@ -47,7 +47,7 @@ public class TimeMachineWsTest { } @Test - public void define_index_action() throws Exception { + public void define_index_action() { WebService.Action action = controller.action("index"); assertThat(action).isNotNull(); assertThat(action.handler()).isInstanceOf(RailsHandler.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/notifications/NotificationServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/notifications/NotificationServiceTest.java index 98f07a6048c..dcdc86e25f9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/notifications/NotificationServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/notifications/NotificationServiceTest.java @@ -210,7 +210,7 @@ public class NotificationServiceTest { } @Test - public void shouldLogEvery10Minutes() throws InterruptedException { + public void shouldLogEvery10Minutes() { setUpMocks(); // Emulate 2 notifications in DB when(manager.getFromQueue()).thenReturn(notification).thenReturn(notification).thenReturn(null); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ApplyPermissionTemplateQueryTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ApplyPermissionTemplateQueryTest.java index 8bb2bbfb571..817bd23cce3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ApplyPermissionTemplateQueryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ApplyPermissionTemplateQueryTest.java @@ -38,7 +38,7 @@ public class ApplyPermissionTemplateQueryTest { public ExpectedException throwable = ExpectedException.none(); @Test - public void should_populate_with_params() throws Exception { + public void should_populate_with_params() { Map params = Maps.newHashMap(); params.put("template_key", "my_template_key"); @@ -51,7 +51,7 @@ public class ApplyPermissionTemplateQueryTest { } @Test - public void should_invalidate_query_with_empty_name() throws Exception { + public void should_invalidate_query_with_empty_name() { throwable.expect(BadRequestException.class); throwable.expectMessage("Permission template is mandatory"); @@ -65,7 +65,7 @@ public class ApplyPermissionTemplateQueryTest { } @Test - public void should_invalidate_query_with_no_components() throws Exception { + public void should_invalidate_query_with_no_components() { throwable.expect(BadRequestException.class); throwable.expectMessage("Please provide at least one entry to which the permission template should be applied"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionServiceMediumTest.java index fcd9d1ecd9e..aba6615812e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionServiceMediumTest.java @@ -62,7 +62,7 @@ public class InternalPermissionServiceMediumTest { ComponentDto project; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); session = db.openSession(false); @@ -79,7 +79,7 @@ public class InternalPermissionServiceMediumTest { } @Test - public void add_project_permission_to_user() throws Exception { + public void add_project_permission_to_user() { // init MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, project.key()); UserDto user = new UserDto().setLogin("john").setName("John"); @@ -100,7 +100,7 @@ public class InternalPermissionServiceMediumTest { } @Test - public void remove_project_permission_to_user() throws Exception { + public void remove_project_permission_to_user() { MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, project.key()); UserDto user1 = new UserDto().setLogin("user1").setName("User1"); @@ -124,7 +124,7 @@ public class InternalPermissionServiceMediumTest { } @Test - public void remove_all_component_user_permissions() throws Exception { + public void remove_all_component_user_permissions() { MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, project.key()); UserDto user = new UserDto().setLogin("user1").setName("User1"); @@ -151,7 +151,7 @@ public class InternalPermissionServiceMediumTest { } @Test - public void add_and_remove_permission_to_group() throws Exception { + public void add_and_remove_permission_to_group() { // init MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, project.key()); GroupDto group = new GroupDto().setName("group1"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionTemplateServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionTemplateServiceTest.java index 94bd72758c8..d5938bb4aa6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionTemplateServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionTemplateServiceTest.java @@ -85,7 +85,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void find_users_with_permission_template() throws Exception { + public void find_users_with_permission_template() { service.findUsersWithPermissionTemplate(ImmutableMap.of( "permission", "user", "template", "my_template", @@ -94,7 +94,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void find_groups_with_permission_template() throws Exception { + public void find_groups_with_permission_template() { service.findGroupsWithPermissionTemplate(ImmutableMap.of( "permission", "user", "template", "my_template", @@ -104,7 +104,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_create_permission_template() throws Exception { + public void should_create_permission_template() { when(permissionTemplateDao.createPermissionTemplate(DEFAULT_KEY, DEFAULT_DESC, DEFAULT_PATTERN)).thenReturn(DEFAULT_TEMPLATE); PermissionTemplate permissionTemplate = service.createPermissionTemplate(DEFAULT_KEY, DEFAULT_DESC, DEFAULT_PATTERN); @@ -116,7 +116,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_enforce_unique_template_name() throws Exception { + public void should_enforce_unique_template_name() { expected.expect(BadRequestException.class); expected.expectMessage("A template with that name already exists"); @@ -126,7 +126,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_reject_empty_name_on_creation() throws Exception { + public void should_reject_empty_name_on_creation() { expected.expect(BadRequestException.class); expected.expectMessage("Name can't be blank"); @@ -134,7 +134,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_reject_invalid_key_pattern_on_creation() throws Exception { + public void should_reject_invalid_key_pattern_on_creation() { expected.expect(BadRequestException.class); expected.expectMessage("Invalid pattern: [azerty. Should be a valid Java regular expression."); @@ -142,7 +142,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_delete_permission_template() throws Exception { + public void should_delete_permission_template() { when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); service.deletePermissionTemplate(1L); @@ -151,7 +151,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_retrieve_permission_template() throws Exception { + public void should_retrieve_permission_template() { List usersPermissions = Lists.newArrayList( buildUserPermission("user_scan", GlobalPermissions.SCAN_EXECUTION), @@ -186,7 +186,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_retrieve_all_permission_templates() throws Exception { + public void should_retrieve_all_permission_templates() { PermissionTemplateDto template1 = new PermissionTemplateDto().setId(1L).setName("template1").setDescription("template1"); PermissionTemplateDto template2 = @@ -202,7 +202,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_retrieve_all_permission_templates_from_project() throws Exception { + public void should_retrieve_all_permission_templates_from_project() { MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, "org.sample.Sample"); PermissionTemplateDto template1 = @@ -220,7 +220,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_update_permission_template() throws Exception { + public void should_update_permission_template() { service.updatePermissionTemplate(1L, "new_name", "new_description", null); @@ -228,7 +228,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_validate_template_name_on_update_if_applicable() throws Exception { + public void should_validate_template_name_on_update_if_applicable() { expected.expect(BadRequestException.class); expected.expectMessage("A template with that name already exists"); @@ -242,7 +242,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_validate_template_key_pattern_on_update_if_applicable() throws Exception { + public void should_validate_template_key_pattern_on_update_if_applicable() { expected.expect(BadRequestException.class); expected.expectMessage("Invalid pattern: [azerty. Should be a valid Java regular expression."); @@ -253,7 +253,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_skip_name_validation_where_not_applicable() throws Exception { + public void should_skip_name_validation_where_not_applicable() { PermissionTemplateDto template1 = new PermissionTemplateDto().setId(1L).setName("template1").setDescription("template1"); PermissionTemplateDto template2 = @@ -266,7 +266,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_add_user_permission() throws Exception { + public void should_add_user_permission() { UserDto userDto = new UserDto().setId(1L).setLogin("user").setName("user"); when(userDao.selectActiveUserByLogin("user")).thenReturn(userDto); when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); @@ -277,7 +277,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_validate_provided_user_login() throws Exception { + public void should_validate_provided_user_login() { expected.expect(BadRequestException.class); expected.expectMessage("Unknown user:"); @@ -288,7 +288,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_remove_user_permission() throws Exception { + public void should_remove_user_permission() { UserDto userDto = new UserDto().setId(1L).setLogin("user").setName("user"); when(userDao.selectActiveUserByLogin("user")).thenReturn(userDto); when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); @@ -299,7 +299,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_add_group_permission() throws Exception { + public void should_add_group_permission() { GroupDto groupDto = new GroupDto().setId(1L).setName("group"); when(userDao.selectGroupByName("group")).thenReturn(groupDto); when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); @@ -310,7 +310,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_validate_provided_group_name() throws Exception { + public void should_validate_provided_group_name() { expected.expect(BadRequestException.class); expected.expectMessage("Unknown group:"); @@ -321,7 +321,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_remove_group_permission() throws Exception { + public void should_remove_group_permission() { GroupDto groupDto = new GroupDto().setId(1L).setName("group"); when(userDao.selectGroupByName("group")).thenReturn(groupDto); when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); @@ -332,7 +332,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_add_permission_to_anyone_group() throws Exception { + public void should_add_permission_to_anyone_group() { when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); service.addGroupPermission(DEFAULT_KEY, DEFAULT_PERMISSION, "Anyone"); @@ -342,7 +342,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_remove_permission_from_anyone_group() throws Exception { + public void should_remove_permission_from_anyone_group() { when(permissionTemplateDao.selectTemplateByKey(DEFAULT_KEY)).thenReturn(DEFAULT_TEMPLATE); service.removeGroupPermission(DEFAULT_KEY, DEFAULT_PERMISSION, "Anyone"); @@ -352,7 +352,7 @@ public class InternalPermissionTemplateServiceTest { } @Test - public void should_remove_group_from_templates() throws Exception { + public void should_remove_group_from_templates() { GroupDto groupDto = new GroupDto().setId(1L).setName("group"); when(userDao.selectGroupByName("group", session)).thenReturn(groupDto); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionChangeTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionChangeTest.java index 87c437fff3c..eae03e956d3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionChangeTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionChangeTest.java @@ -37,7 +37,7 @@ public class PermissionChangeTest { public ExpectedException thrown = ExpectedException.none(); @Test - public void populate_from_params() throws Exception { + public void populate_from_params() { Map params = Maps.newHashMap(); params.put("user", "my_login"); params.put("group", "my_group"); @@ -53,7 +53,7 @@ public class PermissionChangeTest { } @Test - public void validate_user_query() throws Exception { + public void validate_user_query() { Map validUserParams = Maps.newHashMap(); validUserParams.put("user", "my_login"); validUserParams.put("permission", GlobalPermissions.SYSTEM_ADMIN); @@ -63,7 +63,7 @@ public class PermissionChangeTest { } @Test - public void validate_group_query() throws Exception { + public void validate_group_query() { Map validGroupParams = Maps.newHashMap(); validGroupParams.put("group", "my_group"); validGroupParams.put("permission", GlobalPermissions.SYSTEM_ADMIN); @@ -73,7 +73,7 @@ public class PermissionChangeTest { } @Test - public void reject_inconsistent_query() throws Exception { + public void reject_inconsistent_query() { Map inconsistentParams = Maps.newHashMap(); inconsistentParams.put("user", "my_login"); inconsistentParams.put("group", "my_group"); @@ -87,7 +87,7 @@ public class PermissionChangeTest { } @Test - public void detect_missing_user_or_group() throws Exception { + public void detect_missing_user_or_group() { Map inconsistentParams = Maps.newHashMap(); inconsistentParams.put("permission", "admin"); @@ -99,7 +99,7 @@ public class PermissionChangeTest { } @Test - public void detect_missing_permission() throws Exception { + public void detect_missing_permission() { Map inconsistentParams = Maps.newHashMap(); inconsistentParams.put("user", "my_login"); @@ -111,7 +111,7 @@ public class PermissionChangeTest { } @Test - public void validate_global_permission_reference() throws Exception { + public void validate_global_permission_reference() { Map inconsistentParams = Maps.newHashMap(); inconsistentParams.put("user", "my_login"); inconsistentParams.put("permission", "invalid"); @@ -124,7 +124,7 @@ public class PermissionChangeTest { } @Test - public void validate_component_permission_reference() throws Exception { + public void validate_component_permission_reference() { Map inconsistentParams = Maps.newHashMap(); inconsistentParams.put("user", "my_login"); inconsistentParams.put("component", "org.sample.Sample"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionFinderTest.java index 21e311749cf..ecd7e1235c8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionFinderTest.java @@ -55,13 +55,13 @@ public class PermissionFinderTest { PermissionFinder finder; @Before - public void setUp() throws Exception { + public void setUp() { when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setId(100L).setName("org.sample.Sample")); finder = new PermissionFinder(permissionDao, resourceDao, permissionTemplateDao); } @Test - public void find_users() throws Exception { + public void find_users() { when(permissionDao.selectUsers(any(PermissionQuery.class), anyLong(), anyInt(), anyInt())).thenReturn( newArrayList(new UserWithPermissionDto().setName("user1").setPermission("user")) ); @@ -72,7 +72,7 @@ public class PermissionFinderTest { } @Test - public void fail_to_find_users_when_component_not_found() throws Exception { + public void fail_to_find_users_when_component_not_found() { when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(null); try { @@ -84,7 +84,7 @@ public class PermissionFinderTest { } @Test - public void find_users_with_paging() throws Exception { + public void find_users_with_paging() { finder.findUsersWithPermission(PermissionQuery.builder().permission("user").pageIndex(3).pageSize(10).build()); ArgumentCaptor argumentOffset = ArgumentCaptor.forClass(Integer.class); @@ -96,7 +96,7 @@ public class PermissionFinderTest { } @Test - public void find_users_with_paging_having_more_results() throws Exception { + public void find_users_with_paging_having_more_results() { when(permissionDao.selectUsers(any(PermissionQuery.class), anyLong(), anyInt(), anyInt())).thenReturn(newArrayList( new UserWithPermissionDto().setName("user1").setPermission("user"), new UserWithPermissionDto().setName("user2").setPermission("user"), @@ -114,7 +114,7 @@ public class PermissionFinderTest { } @Test - public void find_users_with_paging_having_no_more_results() throws Exception { + public void find_users_with_paging_having_no_more_results() { when(permissionDao.selectUsers(any(PermissionQuery.class), anyLong(), anyInt(), anyInt())).thenReturn(newArrayList( new UserWithPermissionDto().setName("user1").setPermission("user"), new UserWithPermissionDto().setName("user2").setPermission("user"), @@ -133,7 +133,7 @@ public class PermissionFinderTest { } @Test - public void find_groups() throws Exception { + public void find_groups() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn( newArrayList(new GroupWithPermissionDto().setName("users").setPermission("user")) ); @@ -145,7 +145,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_should_be_paginated() throws Exception { + public void find_groups_should_be_paginated() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn(newArrayList( new GroupWithPermissionDto().setName("Anyone").setPermission("user"), new GroupWithPermissionDto().setName("Admin").setPermission("user"), @@ -176,7 +176,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_should_filter_membership() throws Exception { + public void find_groups_should_filter_membership() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn(newArrayList( new GroupWithPermissionDto().setName("Anyone").setPermission("user"), new GroupWithPermissionDto().setName("Admin").setPermission("user"), @@ -194,7 +194,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_with_added_anyone_group() throws Exception { + public void find_groups_with_added_anyone_group() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn( newArrayList(new GroupWithPermissionDto().setName("users").setPermission("user")) ); @@ -208,7 +208,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_without_adding_anyone_group_when_search_text_do_not_matched() throws Exception { + public void find_groups_without_adding_anyone_group_when_search_text_do_not_matched() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn( newArrayList(new GroupWithPermissionDto().setName("users").setPermission("user")) ); @@ -220,7 +220,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_with_added_anyone_group_when_search_text_matched() throws Exception { + public void find_groups_with_added_anyone_group_when_search_text_matched() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn( newArrayList(new GroupWithPermissionDto().setName("MyAnyGroup").setPermission("user")) ); @@ -231,7 +231,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_without_adding_anyone_group_when_out_membership_selected() throws Exception { + public void find_groups_without_adding_anyone_group_when_out_membership_selected() { when(permissionDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn( newArrayList(new GroupWithPermissionDto().setName("users").setPermission("user")) ); @@ -244,7 +244,7 @@ public class PermissionFinderTest { @Test - public void find_users_from_permission_template() throws Exception { + public void find_users_from_permission_template() { when(permissionTemplateDao.selectTemplateByKey(anyString())).thenReturn(new PermissionTemplateDto().setId(1L).setKee("my_template")); when(permissionTemplateDao.selectUsers(any(PermissionQuery.class), anyLong(), anyInt(), anyInt())).thenReturn( @@ -257,7 +257,7 @@ public class PermissionFinderTest { } @Test - public void fail_to_find_users_from_permission_template_when_template_not_found() throws Exception { + public void fail_to_find_users_from_permission_template_when_template_not_found() { when(permissionTemplateDao.selectTemplateByKey(anyString())).thenReturn(null); try { @@ -269,7 +269,7 @@ public class PermissionFinderTest { } @Test - public void find_groups_from_permission_template() throws Exception { + public void find_groups_from_permission_template() { when(permissionTemplateDao.selectTemplateByKey(anyString())).thenReturn(new PermissionTemplateDto().setId(1L).setKee("my_template")); when(permissionTemplateDao.selectGroups(any(PermissionQuery.class), anyLong())).thenReturn( @@ -283,7 +283,7 @@ public class PermissionFinderTest { } @Test - public void fail_to_find_groups_from_permission_template_when_template_not_found() throws Exception { + public void fail_to_find_groups_from_permission_template_when_template_not_found() { when(permissionTemplateDao.selectTemplateByKey(anyString())).thenReturn(null); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryParserTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryParserTest.java index df43f956656..40e9d03ab14 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryParserTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryParserTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class PermissionQueryParserTest { @Test - public void to_query_with_all_params() throws Exception { + public void to_query_with_all_params() { Map params = newHashMap(); params.put("permission", "admin"); params.put("template", "my_template_key"); @@ -52,7 +52,7 @@ public class PermissionQueryParserTest { } @Test - public void to_query_with_include_membership_parameter() throws Exception { + public void to_query_with_include_membership_parameter() { Map params = newHashMap(); params.put("permission", "admin"); params.put("selected", "selected"); @@ -61,7 +61,7 @@ public class PermissionQueryParserTest { } @Test - public void to_query_with_exclude_membership_parameter() throws Exception { + public void to_query_with_exclude_membership_parameter() { Map params = newHashMap(); params.put("permission", "admin"); params.put("selected", "deselected"); @@ -70,7 +70,7 @@ public class PermissionQueryParserTest { } @Test - public void to_query_with_any_membership_parameter() throws Exception { + public void to_query_with_any_membership_parameter() { Map params = newHashMap(); params.put("permission", "admin"); params.put("selected", "all"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryTest.java index f2a57a6c611..21e61307e79 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionQueryTest.java @@ -29,7 +29,7 @@ import static org.junit.Assert.fail; public class PermissionQueryTest { @Test - public void fail_on_null_permission() throws Exception { + public void fail_on_null_permission() { PermissionQuery.Builder builder = PermissionQuery.builder(); builder.permission(null); @@ -42,7 +42,7 @@ public class PermissionQueryTest { } @Test - public void fail_on_invalid_membership() throws Exception { + public void fail_on_invalid_membership() { PermissionQuery.Builder builder = PermissionQuery.builder(); builder.permission("admin"); builder.membership("unknwown"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateTest.java index 20a1e56bd6e..c851589dfa1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class PermissionTemplateTest { @Test - public void should_populate_template_with_permissions() throws Exception { + public void should_populate_template_with_permissions() { PermissionTemplateDto permissionTemplateDto = new PermissionTemplateDto() .setId(1L) diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateUpdaterTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateUpdaterTest.java index ecbb0f091c5..409e59566f6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateUpdaterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateUpdaterTest.java @@ -57,7 +57,7 @@ public class PermissionTemplateUpdaterTest { } @Test - public void should_execute_on_valid_parameters() throws Exception { + public void should_execute_on_valid_parameters() { final PermissionTemplateDao permissionTemplateDao = mock(PermissionTemplateDao.class); when(permissionTemplateDao.selectTemplateByKey("my_template")).thenReturn(new PermissionTemplateDto().setId(1L)); @@ -75,7 +75,7 @@ public class PermissionTemplateUpdaterTest { } @Test - public void should_validate_template_reference() throws Exception { + public void should_validate_template_reference() { expected.expect(BadRequestException.class); expected.expectMessage("Unknown template:"); @@ -92,7 +92,7 @@ public class PermissionTemplateUpdaterTest { } @Test - public void should_validate_permission_reference() throws Exception { + public void should_validate_permission_reference() { expected.expect(BadRequestException.class); expected.expectMessage("Invalid permission:"); @@ -109,7 +109,7 @@ public class PermissionTemplateUpdaterTest { } @Test - public void should_check_that_user_is_logged_in() throws Exception { + public void should_check_that_user_is_logged_in() { expected.expect(UnauthorizedException.class); expected.expectMessage("Authentication is required"); @@ -124,7 +124,7 @@ public class PermissionTemplateUpdaterTest { } @Test - public void should_check_that_user_is_a_system_admin() throws Exception { + public void should_check_that_user_is_a_system_admin() { expected.expect(ForbiddenException.class); expected.expectMessage("Insufficient privileges"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java index 0204f65a18b..72bc14bd674 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/permission/ws/PermissionsWsTest.java @@ -33,12 +33,12 @@ public class PermissionsWsTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new PermissionsWs()); } @Test - public void define_controller() throws Exception { + public void define_controller() { WebService.Controller controller = tester.controller("api/permissions"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); @@ -47,7 +47,7 @@ public class PermissionsWsTest { } @Test - public void define_add_action() throws Exception { + public void define_add_action() { WebService.Controller controller = tester.controller("api/permissions"); WebService.Action action = controller.action("add"); @@ -61,7 +61,7 @@ public class PermissionsWsTest { } @Test - public void define_remove_action() throws Exception { + public void define_remove_action() { WebService.Controller controller = tester.controller("api/permissions"); WebService.Action action = controller.action("remove"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/BackendCleanupMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/BackendCleanupMediumTest.java index ea25bf28e0d..766c8485e8c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/BackendCleanupMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/BackendCleanupMediumTest.java @@ -54,12 +54,12 @@ public class BackendCleanupMediumTest { BackendCleanup backendCleanup; @Before - public void setUp() throws Exception { + public void setUp() { backendCleanup = new BackendCleanup(esTester.client(), dbTester.myBatis()); } @Test - public void clear_db() throws Exception { + public void clear_db() { dbTester.prepareDbUnit(getClass(), "shared.xml"); backendCleanup.clearDb(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/MasterServletFilterTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/MasterServletFilterTest.java index b8423116006..59a21b676b3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/MasterServletFilterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/MasterServletFilterTest.java @@ -69,7 +69,7 @@ public class MasterServletFilterTest { } @Test - public void servlet_container_should_instantiate_only_a_single_master_instance() throws Exception { + public void servlet_container_should_instantiate_only_a_single_master_instance() { new MasterServletFilter(); thrown.expect(IllegalStateException.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java index a896f815fad..cf201343789 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java @@ -43,7 +43,7 @@ public class PersistentSettingsTest { private ServerSettings settings; @Before - public void init() throws URISyntaxException { + public void init() { dao = mock(PropertiesDao.class); settings = new ServerSettings( diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java index be9c53e4d24..a64486ca9d9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/RailsAppsDeployerTest.java @@ -71,7 +71,7 @@ public class RailsAppsDeployerTest { } @Test - public void deployRubyRailsApps_no_apps() throws Exception { + public void deployRubyRailsApps_no_apps() { ServerFileSystem fileSystem = mock(ServerFileSystem.class); File tempDir = this.temp.getRoot(); when(fileSystem.getTempDir()).thenReturn(tempDir); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java index 68a3f260c51..0d0c323392f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java @@ -47,7 +47,7 @@ public class ServerImplTest { ServerImpl server; @Before - public void setUp() throws Exception { + public void setUp() { settings = new Settings().setProperty(ProcessProperties.PATH_HOME, sonarHome.getRoot().getAbsolutePath()); new File(sonarHome.getRoot(), "web/deploy").mkdirs(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java index 6801327f647..1c97740c86b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java @@ -36,7 +36,7 @@ public class ServerSettingsTest { ServerSettings settings; @Before - public void before() throws Exception { + public void before() { properties = new Properties(); properties.put("hello", "world"); properties.put("in_file", "true"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/DatabaseMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/DatabaseMonitorTest.java index 75aa97901f7..ca03a703e34 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/DatabaseMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/DatabaseMonitorTest.java @@ -38,7 +38,7 @@ public class DatabaseMonitorTest { DatabaseMonitor sut; @Before - public void setUp() throws Exception { + public void setUp() { DatabaseVersion dbVersion = new DatabaseVersion(dbTester.myBatis()); DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis()); sut = new DatabaseMonitor(dbVersion, dbClient); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsMonitorTest.java index b633e5493d2..d0aa16dc19c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsMonitorTest.java @@ -37,14 +37,14 @@ public class EsMonitorTest { public static EsTester esTester = new EsTester().addDefinitions(new IssueIndexDefinition(new Settings())); @Test - public void name() throws Exception { + public void name() { EsMonitor monitor = new EsMonitor(esTester.client()); assertThat(monitor.name()).isEqualTo("ElasticSearch"); } @Test - public void cluster_attributes() throws Exception { + public void cluster_attributes() { EsMonitor monitor = new EsMonitor(esTester.client()); LinkedHashMap attributes = monitor.attributes(); assertThat(monitor.getState()).isEqualTo(ClusterHealthStatus.GREEN.name()); @@ -53,7 +53,7 @@ public class EsMonitorTest { } @Test - public void node_attributes() throws Exception { + public void node_attributes() { EsMonitor monitor = new EsMonitor(esTester.client()); LinkedHashMap attributes = monitor.attributes(); Map nodesAttributes = (Map)attributes.get("Nodes"); @@ -66,7 +66,7 @@ public class EsMonitorTest { } @Test - public void index_attributes() throws Exception { + public void index_attributes() { EsMonitor monitor = new EsMonitor(esTester.client()); LinkedHashMap attributes = monitor.attributes(); Map indicesAttributes = (Map)attributes.get("Indices"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/JvmPropertiesMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/JvmPropertiesMonitorTest.java index 332b9b1fe6c..28f3424f838 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/JvmPropertiesMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/JvmPropertiesMonitorTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class JvmPropertiesMonitorTest { @Test - public void attributes() throws Exception { + public void attributes() { JvmPropertiesMonitor sut = new JvmPropertiesMonitor(); LinkedHashMap attributes = sut.attributes(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/PluginsMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/PluginsMonitorTest.java index 3f69c4faf57..ef082c716b2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/PluginsMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/PluginsMonitorTest.java @@ -39,12 +39,12 @@ public class PluginsMonitorTest { PluginsMonitor sut = new PluginsMonitor(new FakePluginRepository());; @Test - public void name() throws Exception { + public void name() { assertThat(sut.name()).isEqualTo("Plugins"); } @Test - public void plugin_name_and_version() throws Exception { + public void plugin_name_and_version() { LinkedHashMap attributes = sut.attributes(); assertThat(attributes).containsKeys("key-1", "key-2"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SonarQubeMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SonarQubeMonitorTest.java index 30ecd2207a7..e411ce656fa 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SonarQubeMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SonarQubeMonitorTest.java @@ -44,7 +44,7 @@ public class SonarQubeMonitorTest { Server server = mock(Server.class); @Test - public void getServerId() throws Exception { + public void getServerId() { when(server.getStartedAt()).thenReturn(DateUtils.parseDate("2015-01-01")); SonarQubeMonitor monitor = new SonarQubeMonitor(settings, new SecurityRealmFactory(settings), server); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SystemMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SystemMonitorTest.java index ba7064ca217..783e2cc1e10 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SystemMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/SystemMonitorTest.java @@ -30,12 +30,12 @@ public class SystemMonitorTest { SystemMonitor sut = new SystemMonitor(); @Test - public void name() throws Exception { + public void name() { assertThat(sut.name()).isEqualTo("System"); } @Test - public void system_properties() throws Exception { + public void system_properties() { LinkedHashMap attributes = sut.attributes(); assertThat(attributes).containsKeys("System Date", "Processors"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/MigrateDbSystemWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/MigrateDbSystemWsActionTest.java index e009211abf8..1090640f063 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/MigrateDbSystemWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/MigrateDbSystemWsActionTest.java @@ -74,7 +74,7 @@ public class MigrateDbSystemWsActionTest { WsTester.TestResponse response = new WsTester.TestResponse(); @Before - public void wireMocksTogether() throws Exception { + public void wireMocksTogether() { when(database.getDialect()).thenReturn(dialect); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/ServerWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/ServerWsTest.java index 5e86ae42024..f9ac6710946 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/ServerWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/ServerWsTest.java @@ -32,7 +32,7 @@ public class ServerWsTest { WsTester tester = new WsTester(new ServerWs()); @Test - public void define_controller() throws Exception { + public void define_controller() { WebService.Controller controller = tester.controller("api/server"); assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("2.10"); @@ -41,7 +41,7 @@ public class ServerWsTest { } @Test - public void define_index_action() throws Exception { + public void define_index_action() { WebService.Controller controller = tester.controller("api/server"); WebService.Action action = controller.action("index"); @@ -52,7 +52,7 @@ public class ServerWsTest { } @Test - public void define_setup_action() throws Exception { + public void define_setup_action() { WebService.Controller controller = tester.controller("api/server"); WebService.Action action = controller.action("setup"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemInfoWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemInfoWsActionTest.java index eeaeaa8dc38..ec567be0b1d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemInfoWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemInfoWsActionTest.java @@ -43,7 +43,7 @@ public class SystemInfoWsActionTest { SystemInfoWsAction sut = new SystemInfoWsAction(monitor1, monitor2); @Test(expected = ForbiddenException.class) - public void should_fail_when_does_not_have_admin_right() throws Exception { + public void should_fail_when_does_not_have_admin_right() { MockUserSession.set() .setLogin("login") .setName("name") @@ -53,7 +53,7 @@ public class SystemInfoWsActionTest { } @Test - public void write_json() throws Exception { + public void write_json() { MockUserSession.set() .setLogin("login") .setName("name") diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemWsTest.java index 1c535200e66..96c2879b88e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/SystemWsTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.mock; public class SystemWsTest { @Test - public void define() throws Exception { + public void define() { SystemRestartWsAction action1 = new SystemRestartWsAction(mock(Settings.class), mock(Platform.class)); SystemInfoWsAction action2 = new SystemInfoWsAction(); SystemWs ws = new SystemWs(action1, action2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesSystemWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesSystemWsActionTest.java index f073f03d56d..24557f8b035 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesSystemWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/platform/ws/UpgradesSystemWsActionTest.java @@ -56,13 +56,13 @@ public class UpgradesSystemWsActionTest { private WsTester.TestResponse response = new WsTester.TestResponse(); @Before - public void wireMocks() throws Exception { + public void wireMocks() { when(updateCenterFactory.getUpdateCenter(anyBoolean())).thenReturn(updateCenter); when(updateCenter.getDate()).thenReturn(DateUtils.parseDateTime("2015-04-24T16:08:36+0200")); } @Test - public void action_updates_is_defined() throws Exception { + public void action_updates_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java index b5e92448752..bf460fffd2b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java @@ -110,7 +110,7 @@ public class PluginDownloaderTest { } @Test - public void download_from_url() throws Exception { + public void download_from_url() { Plugin test = new Plugin("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar"); test.addRelease(test10); @@ -131,7 +131,7 @@ public class PluginDownloaderTest { * SONAR-4685 */ @Test - public void download_from_redirect_url() throws Exception { + public void download_from_redirect_url() { Plugin test = new Plugin("plugin-test"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/redirect?r=release&g=test&a=test&v=1.0&e=jar"); test.addRelease(test10); @@ -181,7 +181,7 @@ public class PluginDownloaderTest { } @Test - public void throw_exception_if_could_not_download() throws Exception { + public void throw_exception_if_could_not_download() { Plugin test = new Plugin("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("file://not_found"); test.addRelease(test10); @@ -198,7 +198,7 @@ public class PluginDownloaderTest { } @Test - public void throw_exception_if_download_fail() throws Exception { + public void throw_exception_if_download_fail() { Plugin test = new Plugin("test"); Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar"); test.addRelease(test10); @@ -266,7 +266,7 @@ public class PluginDownloaderTest { // SONAR-5011 @Test - public void download_common_transitive_dependency() throws Exception { + public void download_common_transitive_dependency() { Plugin test1 = new Plugin("test1"); Release test1R = new Release(test1, "1.0").setDownloadUrl("http://server/test1-1.0.jar"); test1.addRelease(test1R); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/StaticResourcesServletTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/StaticResourcesServletTest.java index 05e4a0855ed..a5c8fe0f841 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/StaticResourcesServletTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/StaticResourcesServletTest.java @@ -36,7 +36,7 @@ public class StaticResourcesServletTest { private HttpServletRequest request; @Before - public void setUp() throws Exception { + public void setUp() { servlet = new StaticResourcesServlet(); request = mock(HttpServletRequest.class); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java index fd4ab2ffb9c..92c7fbab55a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AbstractUpdateCenterBasedPluginsWsActionTest.java @@ -72,7 +72,7 @@ public class AbstractUpdateCenterBasedPluginsWsActionTest { } @Before - public void wireMocksTogether() throws Exception { + public void wireMocksTogether() { when(updateCenterFactory.getUpdateCenter(anyBoolean())).thenReturn(updateCenter); when(updateCenter.getDate()).thenReturn(DateUtils.parseDateTime("2015-04-24T16:08:36+0200")); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailablePluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailablePluginsWsActionTest.java index ac70bc874cd..220975fbfd5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailablePluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/AvailablePluginsWsActionTest.java @@ -55,7 +55,7 @@ public class AvailablePluginsWsActionTest extends AbstractUpdateCenterBasedPlugi private AvailablePluginsWsAction underTest = new AvailablePluginsWsAction(updateCenterFactory, new PluginWSCommons()); @Test - public void action_available_is_defined() throws Exception { + public void action_available_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); @@ -130,7 +130,7 @@ public class AvailablePluginsWsActionTest extends AbstractUpdateCenterBasedPlugi } @Test - public void plugins_are_sorted_by_name_then_key_and_made_unique() throws Exception { + public void plugins_are_sorted_by_name_then_key_and_made_unique() { when(updateCenter.findAvailablePlugins()).thenReturn(of( pluginUpdate("key2", "name2"), pluginUpdate("key1", "name2"), diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllPluginsWsActionTest.java index 808590cc2aa..4ff9f43f340 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/CancelAllPluginsWsActionTest.java @@ -51,12 +51,12 @@ public class CancelAllPluginsWsActionTest { public ExpectedException expectedException = ExpectedException.none(); @Before - public void setUp() throws Exception { + public void setUp() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); } @Test - public void action_cancel_all_is_defined() throws Exception { + public void action_cancel_all_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallPluginsWsActionTest.java index 5eaa8440e1a..dae2573c115 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstallPluginsWsActionTest.java @@ -64,7 +64,7 @@ public class InstallPluginsWsActionTest { public ExpectedException expectedException = ExpectedException.none(); @Before - public void wireMocks() throws Exception { + public void wireMocks() { when(updateCenterFactory.getUpdateCenter(anyBoolean())).thenReturn(updateCenter); MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); @@ -82,7 +82,7 @@ public class InstallPluginsWsActionTest { } @Test - public void action_install_is_defined() throws Exception { + public void action_install_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledPluginsWsActionTest.java index c6470051181..3780d88af00 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/InstalledPluginsWsActionTest.java @@ -50,7 +50,7 @@ public class InstalledPluginsWsActionTest { private PluginMetadata corePlugin = corePlugin("core1", 10); @Test - public void action_installed_is_defined() throws Exception { + public void action_installed_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingPluginsWsActionTest.java index 26e8bfb4cd9..558ed57839a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PendingPluginsWsActionTest.java @@ -61,7 +61,7 @@ public class PendingPluginsWsActionTest { private WsTester.TestResponse response = new WsTester.TestResponse(); @Test - public void action_pending_is_defined() throws Exception { + public void action_pending_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java index 09c5ee87c3c..f2e3ba637dc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregateBuilderTest.java @@ -34,19 +34,19 @@ public class PluginUpdateAggregateBuilderTest { private static final PluginUpdate.Status SOME_STATUS = PluginUpdate.Status.COMPATIBLE; @Test(expected = NullPointerException.class) - public void plugin_can_not_be_null_and_builderFor_enforces_it_with_NPE() throws Exception { + public void plugin_can_not_be_null_and_builderFor_enforces_it_with_NPE() { PluginUpdateAggregateBuilder.builderFor(null); } @Test(expected = IllegalArgumentException.class) - public void add_throws_IAE_when_plugin_is_not_equal_to_the_one_of_the_builder() throws Exception { + public void add_throws_IAE_when_plugin_is_not_equal_to_the_one_of_the_builder() { PluginUpdateAggregateBuilder builder = PluginUpdateAggregateBuilder.builderFor(PLUGIN_1); builder.add(createPluginUpdate(PLUGIN_2)); } @Test - public void add_uses_equals_which_takes_only_key_into_account() throws Exception { + public void add_uses_equals_which_takes_only_key_into_account() { PluginUpdateAggregateBuilder builder = PluginUpdateAggregateBuilder.builderFor(PLUGIN_1); builder.add(createPluginUpdate(new Plugin(PLUGIN_1.getKey()))); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java index b7e6140a562..2ec301c2ad4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginUpdateAggregatorTest.java @@ -38,17 +38,17 @@ public class PluginUpdateAggregatorTest { private PluginUpdateAggregator underTest = new PluginUpdateAggregator(); @Test - public void aggregates_returns_an_empty_collection_when_plugin_collection_is_null() throws Exception { + public void aggregates_returns_an_empty_collection_when_plugin_collection_is_null() { assertThat(underTest.aggregate(null)).isEmpty(); } @Test - public void aggregates_returns_an_empty_collection_when_plugin_collection_is_empty() throws Exception { + public void aggregates_returns_an_empty_collection_when_plugin_collection_is_empty() { assertThat(underTest.aggregate(Collections.emptyList())).isEmpty(); } @Test - public void aggregates_groups_pluginUpdate_per_plugin_key() throws Exception { + public void aggregates_groups_pluginUpdate_per_plugin_key() { Collection aggregates = underTest.aggregate(ImmutableList.of( createPluginUpdate("key1"), createPluginUpdate("key1"), @@ -62,7 +62,7 @@ public class PluginUpdateAggregatorTest { } @Test - public void aggregate_put_pluginUpdates_with_same_plugin_in_the_same_PluginUpdateAggregate() throws Exception { + public void aggregate_put_pluginUpdates_with_same_plugin_in_the_same_PluginUpdateAggregate() { PluginUpdate pluginUpdate1 = createPluginUpdate("key1"); PluginUpdate pluginUpdate2 = createPluginUpdate("key1"); PluginUpdate pluginUpdate3 = createPluginUpdate("key1"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsTest.java index 9c220bb1290..291e58e2d62 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsTest.java @@ -31,7 +31,7 @@ public class PluginsWsTest { private WsTester tester = new WsTester(new PluginsWs(new DummyPluginsWsAction())); @Test - public void defines_controller_and_binds_PluginsWsActions() throws Exception { + public void defines_controller_and_binds_PluginsWsActions() { WebService.Controller controller = tester.controller("api/plugins"); assertThat(controller).isNotNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallPluginsWsActionTest.java index ecc71e4d719..fa8adaa0f98 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UninstallPluginsWsActionTest.java @@ -60,7 +60,7 @@ public class UninstallPluginsWsActionTest { public ExpectedException expectedException = ExpectedException.none(); @Before - public void setUp() throws Exception { + public void setUp() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); } @@ -76,7 +76,7 @@ public class UninstallPluginsWsActionTest { } @Test - public void action_uninstall_is_defined() throws Exception { + public void action_uninstall_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatePluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatePluginsWsActionTest.java index 021cacb08c6..82a1f39c29d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatePluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatePluginsWsActionTest.java @@ -66,7 +66,7 @@ public class UpdatePluginsWsActionTest { public ExpectedException expectedException = ExpectedException.none(); @Before - public void setUp() throws Exception { + public void setUp() { when(updateCenterFactory.getUpdateCenter(anyBoolean())).thenReturn(updateCenter); MockUserSession.set().setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); @@ -84,7 +84,7 @@ public class UpdatePluginsWsActionTest { } @Test - public void action_update_is_defined() throws Exception { + public void action_update_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesPluginsWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesPluginsWsActionTest.java index de7722b5f81..4784b7cedae 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesPluginsWsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/UpdatesPluginsWsActionTest.java @@ -75,7 +75,7 @@ public class UpdatesPluginsWsActionTest extends AbstractUpdateCenterBasedPlugins ); @Test - public void action_updatable_is_defined() throws Exception { + public void action_updatable_is_defined() { WsTester wsTester = new WsTester(); WebService.NewController newController = wsTester.context().createController(DUMMY_CONTROLLER_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsFactoryTest.java index 1ca4a8cc6d6..367d92d895b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsFactoryTest.java @@ -48,21 +48,21 @@ public class ProjectSettingsFactoryTest { } @Test - public void newProjectSettings_returns_a_ProjectSettings() throws Exception { + public void newProjectSettings_returns_a_ProjectSettings() { Settings projectSettings = sut.newProjectSettings(1L); assertThat(projectSettings).isInstanceOf(ProjectSettings.class); } @Test - public void transform_empty_list_into_empty_map() throws Exception { + public void transform_empty_list_into_empty_map() { Map propertyMap = sut.getPropertyMap(Lists.newArrayList()); assertThat(propertyMap).isEmpty(); } @Test - public void transform_list_of_properties_in_map_key_value() throws Exception { + public void transform_list_of_properties_in_map_key_value() { PropertyDto property1 = new PropertyDto().setKey("1").setValue("val1"); PropertyDto property2 = new PropertyDto().setKey("2").setValue("val2"); PropertyDto property3 = new PropertyDto().setKey("3").setValue("val3"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsTest.java b/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsTest.java index b8f99fcc2a2..5ecc5917959 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/properties/ProjectSettingsTest.java @@ -38,12 +38,12 @@ public class ProjectSettingsTest { private Settings settings; @Before - public void before() throws Exception { + public void before() { this.settings = mock(Settings.class); } @Test - public void call_global_settings_method_when_no_project_specific_settings() throws Exception { + public void call_global_settings_method_when_no_project_specific_settings() { this.sut = new ProjectSettings(settings, Maps.newHashMap()); sut.getInt("anyKey"); @@ -56,7 +56,7 @@ public class ProjectSettingsTest { } @Test(expected = NumberFormatException.class) - public void getInt_property_throws_exception_when_value_is_not_formatted_correctly() throws Exception { + public void getInt_property_throws_exception_when_value_is_not_formatted_correctly() { HashMap properties = Maps.newHashMap(); properties.put("intKey", "wrongIntValue"); this.sut = new ProjectSettings(settings, properties); @@ -65,7 +65,7 @@ public class ProjectSettingsTest { } @Test - public void getInt_property_return_0_when_empty_property() throws Exception { + public void getInt_property_return_0_when_empty_property() { HashMap properties = Maps.newHashMap(); properties.put("intKey", ""); this.sut = new ProjectSettings(settings, properties); @@ -76,7 +76,7 @@ public class ProjectSettingsTest { } @Test - public void getInt_property_return_the_int_value() throws Exception { + public void getInt_property_return_the_int_value() { HashMap properties = Maps.newHashMap(); properties.put("intKey", "123"); this.sut = new ProjectSettings(settings, properties); @@ -87,7 +87,7 @@ public class ProjectSettingsTest { } @Test - public void getString_returns_String_property() throws Exception { + public void getString_returns_String_property() { HashMap properties = Maps.newHashMap(); properties.put("stringKey", "stringValue"); this.sut = new ProjectSettings(settings, properties); @@ -98,7 +98,7 @@ public class ProjectSettingsTest { } @Test - public void getBoolean_returns_exception_when_value_is_not_formatted_correctly() throws Exception { + public void getBoolean_returns_exception_when_value_is_not_formatted_correctly() { HashMap properties = Maps.newHashMap(); properties.put("boolKey", "wronglyFormattedBoolean"); this.sut = new ProjectSettings(settings, properties); @@ -109,7 +109,7 @@ public class ProjectSettingsTest { } @Test - public void getBoolean_returns_false_when_value_is_empty() throws Exception { + public void getBoolean_returns_false_when_value_is_empty() { HashMap properties = Maps.newHashMap(); properties.put("boolKey", ""); this.sut = new ProjectSettings(settings, properties); @@ -120,7 +120,7 @@ public class ProjectSettingsTest { } @Test - public void getBoolean_returns_true_when_value_is_true_ignoring_case() throws Exception { + public void getBoolean_returns_true_when_value_is_true_ignoring_case() { HashMap properties = Maps.newHashMap(); properties.put("boolKey1", "true"); properties.put("boolKey2", "True"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/QualityGatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/QualityGatesTest.java index 0e7c397ceb4..aa1432ea3ad 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/QualityGatesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/QualityGatesTest.java @@ -107,14 +107,14 @@ public class QualityGatesTest { } @Test - public void should_list_qgates() throws Exception { + public void should_list_qgates() { List allQgates = Lists.newArrayList(new QualityGateDto().setName("Gate One"), new QualityGateDto().setName("Gate Two")); when(dao.selectAll()).thenReturn(allQgates); assertThat(qGates.list()).isEqualTo(allQgates); } @Test - public void should_create_qgate() throws Exception { + public void should_create_qgate() { String name = "SG-1"; QualityGateDto sg1 = qGates.create(name); assertThat(sg1.getName()).isEqualTo(name); @@ -124,32 +124,32 @@ public class QualityGatesTest { } @Test(expected = ForbiddenException.class) - public void should_fail_create_on_anonymous() throws Exception { + public void should_fail_create_on_anonymous() { UserSessionTestUtils.setUserSession(unauthenticatedUserSession); assertThat(qGates.currentUserHasWritePermission()).isFalse(); qGates.create("polop"); } @Test(expected = ForbiddenException.class) - public void should_fail_create_on_missing_permission() throws Exception { + public void should_fail_create_on_missing_permission() { UserSessionTestUtils.setUserSession(unauthorizedUserSession); qGates.create("polop"); } @Test(expected = BadRequestException.class) - public void should_fail_create_on_empty_name() throws Exception { + public void should_fail_create_on_empty_name() { qGates.create(""); } @Test(expected = BadRequestException.class) - public void should_fail_create_on_duplicate_name() throws Exception { + public void should_fail_create_on_duplicate_name() { String name = "SG-1"; when(dao.selectByName(name)).thenReturn(new QualityGateDto().setName(name).setId(42L)); qGates.create(name); } @Test - public void should_get_qgate_by_id() throws Exception { + public void should_get_qgate_by_id() { long id = 42L; final String name = "Golden"; QualityGateDto existing = new QualityGateDto().setId(id).setName(name); @@ -159,7 +159,7 @@ public class QualityGatesTest { } @Test - public void should_get_qgate_by_name() throws Exception { + public void should_get_qgate_by_name() { long id = 42L; final String name = "Golden"; QualityGateDto existing = new QualityGateDto().setId(id).setName(name); @@ -169,12 +169,12 @@ public class QualityGatesTest { } @Test(expected = NotFoundException.class) - public void should_fail_to_find_qgate_by_name() throws Exception { + public void should_fail_to_find_qgate_by_name() { qGates.get("Does not exist"); } @Test - public void should_rename_qgate() throws Exception { + public void should_rename_qgate() { long id = 42L; String name = "SG-1"; QualityGateDto existing = new QualityGateDto().setId(id).setName("Golden"); @@ -187,7 +187,7 @@ public class QualityGatesTest { } @Test - public void should_allow_rename_with_same_name() throws Exception { + public void should_allow_rename_with_same_name() { long id = 42L; String name = "SG-1"; QualityGateDto existing = new QualityGateDto().setId(id).setName(name); @@ -200,12 +200,12 @@ public class QualityGatesTest { } @Test(expected = NotFoundException.class) - public void should_fail_rename_on_inexistent_qgate() throws Exception { + public void should_fail_rename_on_inexistent_qgate() { qGates.rename(42L, "Unknown"); } @Test(expected = BadRequestException.class) - public void should_fail_rename_on_duplicate_name() throws Exception { + public void should_fail_rename_on_duplicate_name() { long id = 42L; String name = "SG-1"; QualityGateDto existing = new QualityGateDto().setId(id).setName("Golden"); @@ -215,7 +215,7 @@ public class QualityGatesTest { } @Test - public void should_select_default_qgate() throws Exception { + public void should_select_default_qgate() { long defaultId = 42L; String defaultName = "Default Name"; when(dao.selectById(defaultId)).thenReturn(new QualityGateDto().setId(defaultId).setName(defaultName)); @@ -228,13 +228,13 @@ public class QualityGatesTest { } @Test - public void should_unset_default_qgate() throws Exception { + public void should_unset_default_qgate() { qGates.setDefault(null); verify(propertiesDao).deleteGlobalProperty("sonar.qualitygate"); } @Test - public void should_delete_qgate() throws Exception { + public void should_delete_qgate() { long idToDelete = 42L; String name = "To Delete"; QualityGateDto toDelete = new QualityGateDto().setId(idToDelete).setName(name); @@ -248,7 +248,7 @@ public class QualityGatesTest { } @Test - public void should_delete_qgate_if_non_default() throws Exception { + public void should_delete_qgate_if_non_default() { long idToDelete = 42L; String name = "To Delete"; QualityGateDto toDelete = new QualityGateDto().setId(idToDelete).setName(name); @@ -263,7 +263,7 @@ public class QualityGatesTest { } @Test - public void should_delete_qgate_even_if_default() throws Exception { + public void should_delete_qgate_even_if_default() { long idToDelete = 42L; String name = "To Delete"; QualityGateDto toDelete = new QualityGateDto().setId(idToDelete).setName(name); @@ -279,7 +279,7 @@ public class QualityGatesTest { } @Test - public void should_return_default_qgate_if_set() throws Exception { + public void should_return_default_qgate_if_set() { String defaultName = "Sonar way"; long defaultId = 42L; when(propertiesDao.selectGlobalProperty("sonar.qualitygate")).thenReturn(new PropertyDto().setValue(Long.toString(defaultId))); @@ -289,7 +289,7 @@ public class QualityGatesTest { } @Test - public void should_return_null_default_qgate_if_unset() throws Exception { + public void should_return_null_default_qgate_if_unset() { when(propertiesDao.selectGlobalProperty("sonar.qualitygate")).thenReturn(new PropertyDto().setValue("")); assertThat(qGates.getDefault()).isNull(); } @@ -455,7 +455,7 @@ public class QualityGatesTest { } @Test - public void should_list_conditions() throws Exception { + public void should_list_conditions() { long qGateId = 42L; long metric1Id = 1L; String metric1Key = "polop"; @@ -478,7 +478,7 @@ public class QualityGatesTest { } @Test(expected = IllegalStateException.class) - public void should_do_a_sanity_check_when_listing_conditions() throws Exception { + public void should_do_a_sanity_check_when_listing_conditions() { long qGateId = 42L; long metric1Id = 1L; String metric1Key = "polop"; @@ -494,7 +494,7 @@ public class QualityGatesTest { } @Test - public void should_delete_condition() throws Exception { + public void should_delete_condition() { long idToDelete = 42L; QualityGateConditionDto toDelete = new QualityGateConditionDto().setId(idToDelete); when(conditionDao.selectById(idToDelete)).thenReturn(toDelete); @@ -504,7 +504,7 @@ public class QualityGatesTest { } @Test(expected = NotFoundException.class) - public void should_fail_delete_condition() throws Exception { + public void should_fail_delete_condition() { qGates.deleteCondition(42L); } @@ -563,7 +563,7 @@ public class QualityGatesTest { } @Test - public void should_copy_qgate() throws Exception { + public void should_copy_qgate() { String name = "Atlantis"; long sourceId = 42L; final long destId = 43L; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QGatesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QGatesWsTest.java index 6e531cac71c..0eea3c11b57 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QGatesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QGatesWsTest.java @@ -75,7 +75,7 @@ public class QGatesWsTest { } @Test - public void define_ws() throws Exception { + public void define_ws() { Controller controller = tester.controller("api/qualitygates"); assertThat(controller).isNotNull(); assertThat(controller.path()).isEqualTo("api/qualitygates"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java index 4abb34861d6..e9278558413 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ActiveRuleBackendMediumTest.java @@ -82,7 +82,7 @@ public class ActiveRuleBackendMediumTest { } @Test - public void synchronize_index() throws Exception { + public void synchronize_index() { Date beginning = new Date(); @@ -147,7 +147,7 @@ public class ActiveRuleBackendMediumTest { } @Test - public void insert_and_index_active_rule_param() throws InterruptedException { + public void insert_and_index_active_rule_param() { // insert and index QualityProfileDto profileDto = QProfileTesting.newXooP1(); db.qualityProfileDao().insert(dbSession, profileDto); @@ -195,7 +195,7 @@ public class ActiveRuleBackendMediumTest { } @Test - public void find_active_rules() throws Exception { + public void find_active_rules() { QualityProfileDto profile1 = QProfileTesting.newXooP1(); QualityProfileDto profile2 = QProfileTesting.newXooP2(); db.qualityProfileDao().insert(dbSession, profile1, profile2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInProfilesTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInProfilesTest.java index b0769b244e5..ff387a6e10b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInProfilesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInProfilesTest.java @@ -31,12 +31,12 @@ public class BuiltInProfilesTest { BuiltInProfiles cache; @Before - public void setUp() throws Exception { + public void setUp() { cache = new BuiltInProfiles(); } @Test - public void add_profiles() throws Exception { + public void add_profiles() { cache.put("java", "Default"); cache.put("java", "Sonar Way"); cache.put("js", "Default"); @@ -46,7 +46,7 @@ public class BuiltInProfilesTest { } @Test - public void not_add_same_profile_name() throws Exception { + public void not_add_same_profile_name() { cache.put("java", "Default"); cache.put("java", "Default"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperMediumTest.java index 173d7a60ccf..454835e56f3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperMediumTest.java @@ -73,7 +73,7 @@ public class QProfileBackuperMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @@ -110,7 +110,7 @@ public class QProfileBackuperMediumTest { } @Test - public void fail_to_backup_unknown_profile() throws Exception { + public void fail_to_backup_unknown_profile() { try { tester.get(QProfileBackuper.class).backup("unknown", new StringWriter()); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonMediumTest.java index 12ba968260e..9652b9b7ef1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonMediumTest.java @@ -80,12 +80,12 @@ public class QProfileComparisonMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @Test - public void compare_empty_profiles() throws Exception { + public void compare_empty_profiles() { QProfileComparisonResult result = comparison.compare(left.getKey(), right.getKey()); assertThat(result.left().getKey()).isEqualTo(left.getKey()); assertThat(result.right().getKey()).isEqualTo(right.getKey()); @@ -97,7 +97,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_same() throws Exception { + public void compare_same() { RuleActivation commonActivation = new RuleActivation(xooRule1.getKey()) .setSeverity(Severity.CRITICAL) .setParameter("min", "7") @@ -117,7 +117,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_only_left() throws Exception { + public void compare_only_left() { ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()), left); dbSession.commit(); @@ -132,7 +132,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_only_right() throws Exception { + public void compare_only_right() { ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()), right); dbSession.commit(); @@ -147,7 +147,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_disjoint() throws Exception { + public void compare_disjoint() { ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()), left); ruleActivator.activate(dbSession, new RuleActivation(xooRule2.getKey()), right); dbSession.commit(); @@ -163,7 +163,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_modified_severity() throws Exception { + public void compare_modified_severity() { ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()).setSeverity(Severity.CRITICAL), left); ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()).setSeverity(Severity.BLOCKER), right); dbSession.commit(); @@ -184,7 +184,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_modified_param() throws Exception { + public void compare_modified_param() { ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()).setParameter("max", "20"), left); ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()).setParameter("max", "30"), right); dbSession.commit(); @@ -208,7 +208,7 @@ public class QProfileComparisonMediumTest { } @Test - public void compare_different_params() throws Exception { + public void compare_different_params() { ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()).setParameter("max", "20"), left); ruleActivator.activate(dbSession, new RuleActivation(xooRule1.getKey()).setParameter("min", "5"), right); dbSession.commit(); @@ -231,12 +231,12 @@ public class QProfileComparisonMediumTest { } @Test(expected = IllegalArgumentException.class) - public void fail_on_unknown_left() throws Exception { + public void fail_on_unknown_left() { comparison.compare("polop", right.getKey()); } @Test(expected = IllegalArgumentException.class) - public void fail_on_unknown_right() throws Exception { + public void fail_on_unknown_right() { comparison.compare(left.getKey(), "polop"); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileCopierMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileCopierMediumTest.java index 3f5575b3f48..87a3dc9f4ec 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileCopierMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileCopierMediumTest.java @@ -79,12 +79,12 @@ public class QProfileCopierMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @Test - public void create_target_profile() throws Exception { + public void create_target_profile() { // source RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); @@ -100,7 +100,7 @@ public class QProfileCopierMediumTest { } @Test - public void update_target_profile() throws Exception { + public void update_target_profile() { // source with x1 activated RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); @@ -128,7 +128,7 @@ public class QProfileCopierMediumTest { } @Test - public void create_target_profile_with_same_parent_than_source() throws Exception { + public void create_target_profile_with_same_parent_than_source() { // two profiles : parent and its child db.qualityProfileDao().insert(dbSession, QProfileTesting.newXooP2().setParentKee(QProfileTesting.XOO_P1_KEY)); @@ -149,7 +149,7 @@ public class QProfileCopierMediumTest { } @Test - public void fail_to_copy_on_self() throws Exception { + public void fail_to_copy_on_self() { RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); activation.setParameter("max", "7"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java index dbb5983b2b1..cb0271b1bfb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java @@ -72,19 +72,19 @@ public class QProfileExportersTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @Test - public void exportersForLanguage() throws Exception { + public void exportersForLanguage() { assertThat(exporters.exportersForLanguage("xoo")).hasSize(2); assertThat(exporters.exportersForLanguage("java")).hasSize(1); assertThat(exporters.exportersForLanguage("java").get(0)).isInstanceOf(StandardExporter.class); } @Test - public void mimeType() throws Exception { + public void mimeType() { assertThat(exporters.mimeType("xootool")).isEqualTo("plain/custom"); // default mime type @@ -120,12 +120,12 @@ public class QProfileExportersTest { } @Test - public void profile_importers_for_language() throws Exception { + public void profile_importers_for_language() { assertThat(exporters.findProfileImportersForLanguage("xoo")).hasSize(3); } @Test - public void import_xml() throws Exception { + public void import_xml() { QualityProfileDto profileDto = QProfileTesting.newDto(QProfileName.createFor("xoo", "import_xml"), "import_xml"); db.qualityProfileDao().insert(dbSession, profileDto); dbSession.commit(); @@ -143,7 +143,7 @@ public class QProfileExportersTest { } @Test - public void import_xml_return_messages() throws Exception { + public void import_xml_return_messages() { QProfileResult result = exporters.importXml(QProfileTesting.newXooP1(), "XooProfileImporterWithMessages", "", dbSession); dbSession.commit(); @@ -152,7 +152,7 @@ public class QProfileExportersTest { } @Test - public void fail_to_import_xml_when_error_in_importer() throws Exception { + public void fail_to_import_xml_when_error_in_importer() { try { exporters.importXml(QProfileTesting.newXooP1(), "XooProfileImporterWithError", "", dbSession); fail(); @@ -162,7 +162,7 @@ public class QProfileExportersTest { } @Test - public void fail_to_import_xml_on_unknown_importer() throws Exception { + public void fail_to_import_xml_on_unknown_importer() { try { exporters.importXml(QProfileTesting.newXooP1(), "Unknown", "", dbSession); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java index d9e2c1af4d5..db41edd60b6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java @@ -64,7 +64,7 @@ public class QProfileFactoryMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileNameTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileNameTest.java index d978d3dbac3..b855fc9b878 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileNameTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileNameTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class QProfileNameTest { @Test - public void equals_and_hashcode() throws Exception { + public void equals_and_hashcode() { QProfileName xooP1 = new QProfileName("xoo", "p1"); assertThat(xooP1).isEqualTo(xooP1); assertThat(xooP1).isNotEqualTo(new QProfileName("xoo", "p2")); @@ -40,7 +40,7 @@ public class QProfileNameTest { } @Test - public void to_string() throws Exception { + public void to_string() { assertThat(new QProfileName("xoo", "p1").toString()).isEqualTo("{lang=xoo, name=p1}"); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java index 161d2757def..2710183163e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java @@ -80,26 +80,26 @@ public class QProfileProjectOperationsMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @Test - public void add_project() throws Exception { + public void add_project() { projectOperations.addProject(profile.getKey(), project.uuid(), authorizedProfileAdminUserSession); assertThat(factory.getByProjectAndLanguage(PROJECT_KEY, profile.getLanguage())).isNotNull(); } @Test - public void add_project_with_only_project_admin_permission() throws Exception { + public void add_project_with_only_project_admin_permission() { projectOperations.addProject(profile.getKey(), project.uuid(), authorizedProjectAdminUserSession); assertThat(factory.getByProjectAndLanguage(PROJECT_KEY, profile.getLanguage())).isNotNull(); } @Test - public void remove_project_from_project_id() throws Exception { + public void remove_project_from_project_id() { projectOperations.addProject(profile.getKey(), project.uuid(), authorizedProfileAdminUserSession); assertThat(factory.getByProjectAndLanguage(PROJECT_KEY, profile.getLanguage())).isNotNull(); @@ -108,7 +108,7 @@ public class QProfileProjectOperationsMediumTest { } @Test - public void remove_project_from_language() throws Exception { + public void remove_project_from_language() { projectOperations.addProject(profile.getKey(), project.uuid(), authorizedProfileAdminUserSession); assertThat(factory.getByProjectAndLanguage(PROJECT_KEY, profile.getLanguage())).isNotNull(); @@ -117,7 +117,7 @@ public class QProfileProjectOperationsMediumTest { } @Test - public void remove_all_projects() throws Exception { + public void remove_all_projects() { ComponentDto project1 = new ComponentDto() .setUuid("BCDE") .setKey("project1") diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileResetMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileResetMediumTest.java index dd5ae63ef58..b3d89740951 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileResetMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileResetMediumTest.java @@ -69,7 +69,7 @@ public class QProfileResetMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @@ -89,7 +89,7 @@ public class QProfileResetMediumTest { } @Test - public void reset_language_profile() throws Exception { + public void reset_language_profile() { RulesProfile defProfile = RulesProfile.create("Basic", ServerTester.Xoo.KEY); defProfile.activateRule( org.sonar.api.rules.Rule.create("xoo", "x1").setParams(newArrayList(new RuleParam().setKey("acceptWhitespace"))), @@ -137,7 +137,7 @@ public class QProfileResetMediumTest { } @Test - public void reset_language_profile_param_when_rule_definition_has_changed() throws Exception { + public void reset_language_profile_param_when_rule_definition_has_changed() { RulesProfile defProfile = RulesProfile.create("Basic", ServerTester.Xoo.KEY); defProfile.activateRule(org.sonar.api.rules.Rule.create("xoo", "x1"), null); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java index 034bb052ef9..8ed0fea39b5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileServiceMediumTest.java @@ -93,12 +93,12 @@ public class QProfileServiceMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @Test - public void create_profile() throws Exception { + public void create_profile() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); QualityProfileDto profile = service.create(QProfileName.createFor("xoo", "New Profile"), null).profile(); @@ -109,7 +109,7 @@ public class QProfileServiceMediumTest { } @Test - public void create_profile_with_xml() throws Exception { + public void create_profile_with_xml() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); db.ruleDao().insert(dbSession, RuleTesting.newDto(RuleKey.of("xoo", "R1")).setLanguage("xoo").setSeverity("MINOR")); @@ -127,7 +127,7 @@ public class QProfileServiceMediumTest { } @Test - public void count_by_all_profiles() throws Exception { + public void count_by_all_profiles() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); service.activate(XOO_P1_KEY, new RuleActivation(RuleTesting.XOO_X1).setSeverity("BLOCKER")); @@ -159,7 +159,7 @@ public class QProfileServiceMediumTest { } @Test - public void count_by_deprecated() throws Exception { + public void count_by_deprecated() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); // create deprecated rule @@ -177,7 +177,7 @@ public class QProfileServiceMediumTest { } @Test - public void search_qprofile_activity() throws InterruptedException { + public void search_qprofile_activity() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("david"); UserDto user = new UserDto().setLogin("david").setName("David").setEmail("dav@id.com").setCreatedAt(System.currentTimeMillis()).setUpdatedAt(System.currentTimeMillis()); @@ -210,7 +210,7 @@ public class QProfileServiceMediumTest { } @Test - public void search_qprofile_activity_without_severity() throws InterruptedException { + public void search_qprofile_activity_without_severity() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); RuleKey ruleKey = RuleKey.of("xoo", "deleted_rule"); @@ -229,7 +229,7 @@ public class QProfileServiceMediumTest { } @Test - public void search_qprofile_activity_with_user_not_found() throws InterruptedException { + public void search_qprofile_activity_with_user_not_found() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("david"); // We need an actual rule in DB to test RuleName in Activity @@ -252,7 +252,7 @@ public class QProfileServiceMediumTest { } @Test - public void search_qprofile_activity_with_rule_not_found() throws InterruptedException { + public void search_qprofile_activity_with_rule_not_found() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); RuleKey ruleKey = RuleKey.of("xoo", "deleted_rule"); @@ -273,7 +273,7 @@ public class QProfileServiceMediumTest { } @Test - public void search_activity_by_qprofile() throws InterruptedException { + public void search_activity_by_qprofile() { tester.get(ActivityService.class).save( ActiveRuleChange.createFor(ActiveRuleChange.Type.ACTIVATED, ActiveRuleKey.of(XOO_P1_KEY, RuleTesting.XOO_X1)).toActivity()); @@ -291,7 +291,7 @@ public class QProfileServiceMediumTest { } @Test - public void search_activity_by_qprofile_having_dashes_in_keys() throws InterruptedException { + public void search_activity_by_qprofile_having_dashes_in_keys() { tester.get(ActivityService.class).save( ActiveRuleChange.createFor(ActiveRuleChange.Type.ACTIVATED, ActiveRuleKey.of("java-default", RuleTesting.XOO_X1)).toActivity()); tester.get(ActivityService.class).save( @@ -308,7 +308,7 @@ public class QProfileServiceMediumTest { } @Test - public void set_default() throws Exception { + public void set_default() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN).setLogin("me"); assertThat(service.getDefault("xoo")).isNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileTest.java index 56397bbb30f..4fb83dae022 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileTest.java @@ -37,13 +37,13 @@ public class QProfileTest { } @Test - public void to_string() throws Exception { + public void to_string() { assertThat(new QProfile().setId(1).setName("Default").setLanguage("java").setParent("Parent").toString()) .contains("[id=1,key=,name=Default,language=java,parent=Parent,isDefault=false]"); } @Test - public void is_inherited() throws Exception { + public void is_inherited() { assertThat(new QProfile().setId(1).setName("Default").setLanguage("java").setParent("Parent").isInherited()).isTrue(); assertThat(new QProfile().setId(1).setName("Default").setLanguage("java").setParent(null).isInherited()).isFalse(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfilesTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfilesTest.java index a313b0f104c..853e5240325 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfilesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfilesTest.java @@ -46,94 +46,94 @@ public class QProfilesTest { QProfiles qProfiles; @Before - public void setUp() throws Exception { + public void setUp() { qProfiles = new QProfiles(projectOperations, projectLookup, profileLookup); } @Test - public void search_profile_by_id() throws Exception { + public void search_profile_by_id() { qProfiles.profile(1); verify(profileLookup).profile(1); } @Test - public void search_profile_by_name_and_language() throws Exception { + public void search_profile_by_name_and_language() { qProfiles.profile("Default", "java"); verify(profileLookup).profile("Default", "java"); } @Test - public void search_profiles() throws Exception { + public void search_profiles() { qProfiles.allProfiles(); verify(profileLookup).allProfiles(); } @Test - public void search_profiles_by_language() throws Exception { + public void search_profiles_by_language() { qProfiles.profilesByLanguage("java"); verify(profileLookup).profiles("java"); } @Test - public void search_parent_profile() throws Exception { + public void search_parent_profile() { QProfile profile = new QProfile().setId(1).setParent("Parent").setLanguage("java"); qProfiles.parent(profile); verify(profileLookup).parent(profile); } @Test - public void search_children() throws Exception { + public void search_children() { QProfile profile = new QProfile(); qProfiles.children(profile); verify(profileLookup).children(profile); } @Test - public void search_ancestors() throws Exception { + public void search_ancestors() { QProfile profile = new QProfile(); qProfiles.ancestors(profile); verify(profileLookup).ancestors(profile); } @Test - public void projects() throws Exception { + public void projects() { qProfiles.projects(1); verify(projectLookup).projects(1); } @Test - public void count_projects() throws Exception { + public void count_projects() { QProfile profile = new QProfile(); qProfiles.countProjects(profile); verify(projectLookup).countProjects(profile); } @Test - public void get_profiles_from_project_and_language() throws Exception { + public void get_profiles_from_project_and_language() { qProfiles.findProfileByProjectAndLanguage(1, "java"); verify(projectLookup).findProfileByProjectAndLanguage(1, "java"); } @Test - public void add_project() throws Exception { + public void add_project() { qProfiles.addProject("sonar-way-java", "ABCD"); verify(projectOperations).addProject(eq("sonar-way-java"), eq("ABCD"), any(UserSession.class)); } @Test - public void remove_project_by_quality_profile_key() throws Exception { + public void remove_project_by_quality_profile_key() { qProfiles.removeProject("sonar-way-java", "ABCD"); verify(projectOperations).removeProject(eq("sonar-way-java"), eq("ABCD"), any(UserSession.class)); } @Test - public void remove_project_by_language() throws Exception { + public void remove_project_by_language() { qProfiles.removeProjectByLanguage("java", 10L); verify(projectOperations).removeProject(eq("java"), eq(10L), any(UserSession.class)); } @Test - public void remove_all_projects() throws Exception { + public void remove_all_projects() { qProfiles.removeAllProjects("sonar-way-java"); verify(projectOperations).removeAllProjects(eq("sonar-way-java"), any(UserSession.class)); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesMediumTest.java index 8009d36adb5..72f03220320 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesMediumTest.java @@ -52,7 +52,7 @@ public class RegisterQualityProfilesMediumTest { DbSession dbSession; @After - public void tearDown() throws Exception { + public void tearDown() { if (dbSession != null) { dbSession.close(); } @@ -62,7 +62,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void register_existing_profile_definitions() throws Exception { + public void register_existing_profile_definitions() { tester = new ServerTester().addXoo().addComponents(XooRulesDefinition.class, XooProfileDefinition.class); tester.start(); dbSession = dbClient().openSession(false); @@ -105,7 +105,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void register_profile_definitions() throws Exception { + public void register_profile_definitions() { tester = new ServerTester().addXoo().addComponents(XooRulesDefinition.class, XooProfileDefinition.class); tester.start(); dbSession = dbClient().openSession(false); @@ -140,7 +140,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void do_not_register_profile_if_missing_language() throws Exception { + public void do_not_register_profile_if_missing_language() { // xoo language is not installed tester = new ServerTester().addComponents(XooRulesDefinition.class, XooProfileDefinition.class); tester.start(); @@ -152,7 +152,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void fail_if_two_definitions_are_marked_as_default_on_the_same_language() throws Exception { + public void fail_if_two_definitions_are_marked_as_default_on_the_same_language() { tester = new ServerTester().addXoo().addComponents(new SimpleProfileDefinition("one", true), new SimpleProfileDefinition("two", true)); try { @@ -163,7 +163,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void mark_profile_as_default() throws Exception { + public void mark_profile_as_default() { tester = new ServerTester().addXoo().addComponents(new SimpleProfileDefinition("one", false), new SimpleProfileDefinition("two", true)); tester.start(); @@ -171,7 +171,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void use_sonar_way_as_default_profile_if_none_are_marked_as_default() throws Exception { + public void use_sonar_way_as_default_profile_if_none_are_marked_as_default() { tester = new ServerTester().addXoo().addComponents(new SimpleProfileDefinition("Sonar way", false), new SimpleProfileDefinition("Other way", false)); tester.start(); @@ -179,7 +179,7 @@ public class RegisterQualityProfilesMediumTest { } @Test - public void do_not_reset_default_profile_if_still_valid() throws Exception { + public void do_not_reset_default_profile_if_still_valid() { tester = new ServerTester().addXoo().addComponents(new SimpleProfileDefinition("one", true), new SimpleProfileDefinition("two", false)); tester.start(); @@ -200,7 +200,7 @@ public class RegisterQualityProfilesMediumTest { * Probably for db migration */ @Test - public void clean_up_profiles_if_missing_loaded_template() throws Exception { + public void clean_up_profiles_if_missing_loaded_template() { tester = new ServerTester().addXoo().addComponents(XooRulesDefinition.class, XooProfileDefinition.class); tester.start(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java index 927bcbedbf2..b0c5ba6c340 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java @@ -111,12 +111,12 @@ public class RuleActivatorMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } @Test - public void activate() throws Exception { + public void activate() { RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); activation.setParameter("max", "7"); @@ -133,7 +133,7 @@ public class RuleActivatorMediumTest { } @Test - public void activate_with_profile_dto() throws Exception { + public void activate_with_profile_dto() { RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); activation.setParameter("max", "7"); @@ -150,7 +150,7 @@ public class RuleActivatorMediumTest { } @Test - public void activate_with_default_severity_and_parameter() throws Exception { + public void activate_with_default_severity_and_parameter() { activate(new RuleActivation(RuleTesting.XOO_X1), XOO_P1_KEY); assertThat(countActiveRules(XOO_P1_KEY)).isEqualTo(1); @@ -162,7 +162,7 @@ public class RuleActivatorMediumTest { * SONAR-5841 */ @Test - public void activate_with_empty_parameter_having_no_default_value() throws Exception { + public void activate_with_empty_parameter_having_no_default_value() { activate(new RuleActivation(RuleTesting.XOO_X1) .setParameter("min", ""), XOO_P1_KEY); @@ -177,7 +177,7 @@ public class RuleActivatorMediumTest { * SONAR-5841 */ @Test - public void activate_with_empty_parameters() throws Exception { + public void activate_with_empty_parameters() { activate(new RuleActivation(RuleTesting.XOO_X1) .setParameters(ImmutableMap.of("max", "", "min", "")), XOO_P1_KEY); @@ -192,7 +192,7 @@ public class RuleActivatorMediumTest { * SONAR-5840 */ @Test - public void activate_rule_with_negative_integer_value_on_parameter_having_no_default_value() throws Exception { + public void activate_rule_with_negative_integer_value_on_parameter_having_no_default_value() { activate(new RuleActivation(RuleTesting.XOO_X1) .setParameter("min", "-10"), XOO_P1_KEY); @@ -204,7 +204,7 @@ public class RuleActivatorMediumTest { } @Test - public void activation_ignores_unsupported_parameters() throws Exception { + public void activation_ignores_unsupported_parameters() { RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setParameter("xxx", "yyy"); activate(activation, XOO_P1_KEY); @@ -214,7 +214,7 @@ public class RuleActivatorMediumTest { } @Test - public void update_activation_severity_and_parameters() throws Exception { + public void update_activation_severity_and_parameters() { // initial activation RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); @@ -233,7 +233,7 @@ public class RuleActivatorMediumTest { } @Test - public void update_activation_with_parameter_without_default_value() throws Exception { + public void update_activation_with_parameter_without_default_value() { // initial activation -> param "max" has a default value RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); @@ -253,7 +253,7 @@ public class RuleActivatorMediumTest { } @Test - public void update_activation_but_new_parameter() throws Exception { + public void update_activation_but_new_parameter() { // initial activation ActiveRuleKey activeRuleKey = ActiveRuleKey.of(XOO_P1_KEY, RuleTesting.XOO_X1); RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); @@ -278,7 +278,7 @@ public class RuleActivatorMediumTest { } @Test - public void ignore_activation_without_changes() throws Exception { + public void ignore_activation_without_changes() { // initial activation RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); @@ -292,7 +292,7 @@ public class RuleActivatorMediumTest { } @Test - public void do_not_change_severity_and_params_if_unset_and_already_activated() throws Exception { + public void do_not_change_severity_and_params_if_unset_and_already_activated() { // initial activation ActiveRuleKey activeRuleKey = ActiveRuleKey.of(XOO_P1_KEY, RuleTesting.XOO_X1); RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); @@ -309,7 +309,7 @@ public class RuleActivatorMediumTest { } @Test - public void revert_activation_to_default_severity_and_parameters() throws Exception { + public void revert_activation_to_default_severity_and_parameters() { // initial activation ActiveRuleKey activeRuleKey = ActiveRuleKey.of(XOO_P1_KEY, RuleTesting.XOO_X1); RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); @@ -328,7 +328,7 @@ public class RuleActivatorMediumTest { } @Test - public void ignore_parameters_when_activating_custom_rule() throws Exception { + public void ignore_parameters_when_activating_custom_rule() { // initial activation ActiveRuleKey activeRuleKey = ActiveRuleKey.of(XOO_P1_KEY, CUSTOM_RULE_KEY); RuleActivation activation = new RuleActivation(CUSTOM_RULE_KEY); @@ -344,7 +344,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_template() throws Exception { + public void fail_to_activate_if_template() { RuleActivation activation = new RuleActivation(TEMPLATE_RULE_KEY); try { @@ -357,7 +357,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_different_languages() throws Exception { + public void fail_to_activate_if_different_languages() { // profile and rule have different languages RuleActivation activation = new RuleActivation(RuleKey.of("squid", "j1")); @@ -371,7 +371,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_unknown_rule() throws Exception { + public void fail_to_activate_if_unknown_rule() { // profile and rule have different languages RuleActivation activation = new RuleActivation(RuleKey.of("xoo", "x3")); @@ -385,7 +385,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_rule_with_removed_status() throws Exception { + public void fail_to_activate_if_rule_with_removed_status() { RuleDto ruleDto = db.ruleDao().getByKey(dbSession, RuleTesting.XOO_X1); ruleDto.setStatus(RuleStatus.REMOVED); db.ruleDao().update(dbSession, ruleDto); @@ -404,7 +404,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_manual_rule() throws Exception { + public void fail_to_activate_if_manual_rule() { RuleActivation activation = new RuleActivation(MANUAL_RULE_KEY); try { @@ -417,7 +417,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_unknown_profile() throws Exception { + public void fail_to_activate_if_unknown_profile() { try { activate(new RuleActivation(RuleTesting.XOO_X1), "unknown"); fail(); @@ -427,7 +427,7 @@ public class RuleActivatorMediumTest { } @Test - public void fail_to_activate_if_invalid_parameter() throws Exception { + public void fail_to_activate_if_invalid_parameter() { RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setParameter("max", "foo"); @@ -442,7 +442,7 @@ public class RuleActivatorMediumTest { } @Test - public void deactivate() throws Exception { + public void deactivate() { // activation RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activation.setSeverity(Severity.BLOCKER); @@ -456,7 +456,7 @@ public class RuleActivatorMediumTest { } @Test - public void ignore_deactivation_if_rule_not_activated() throws Exception { + public void ignore_deactivation_if_rule_not_activated() { // deactivation ActiveRuleKey key = ActiveRuleKey.of(XOO_P1_KEY, RuleTesting.XOO_X1); ruleActivator.deactivate(key); @@ -465,7 +465,7 @@ public class RuleActivatorMediumTest { } @Test - public void deactivation_fails_if_rule_not_found() throws Exception { + public void deactivation_fails_if_rule_not_found() { ActiveRuleKey key = ActiveRuleKey.of(XOO_P1_KEY, RuleKey.of("xoo", "x3")); try { ruleActivator.deactivate(key); @@ -477,7 +477,7 @@ public class RuleActivatorMediumTest { } @Test - public void deactivation_fails_if_profile_not_found() throws Exception { + public void deactivation_fails_if_profile_not_found() { ActiveRuleKey key = ActiveRuleKey.of("unknown", RuleTesting.XOO_X1); try { ruleActivator.deactivate(key); @@ -488,7 +488,7 @@ public class RuleActivatorMediumTest { } @Test - public void allow_to_deactivate_removed_rule() throws Exception { + public void allow_to_deactivate_removed_rule() { // activation RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1); activate(activation, XOO_P1_KEY); @@ -508,7 +508,7 @@ public class RuleActivatorMediumTest { // INHERITANCE OF PROFILES @Test - public void activate_on_child_profile_but_not_on_parent() throws Exception { + public void activate_on_child_profile_but_not_on_parent() { createChildProfiles(); // activate on child profile, but not on root @@ -533,7 +533,7 @@ public class RuleActivatorMediumTest { } @Test - public void propagate_activation_on_child_profiles() throws Exception { + public void propagate_activation_on_child_profiles() { createChildProfiles(); // activate on root profile @@ -549,7 +549,7 @@ public class RuleActivatorMediumTest { } @Test - public void propagate_activation_update_on_child_profiles() throws Exception { + public void propagate_activation_update_on_child_profiles() { createChildProfiles(); // activate on root profile @@ -593,7 +593,7 @@ public class RuleActivatorMediumTest { } @Test - public void do_not_propagate_activation_update_on_child_overrides() throws Exception { + public void do_not_propagate_activation_update_on_child_overrides() { createChildProfiles(); // activate on root profile P1 @@ -633,7 +633,7 @@ public class RuleActivatorMediumTest { } @Test - public void active_on_parent_a_rule_already_activated_on_child() throws Exception { + public void active_on_parent_a_rule_already_activated_on_child() { createChildProfiles(); // activate on child profile @@ -656,7 +656,7 @@ public class RuleActivatorMediumTest { } @Test - public void do_not_override_on_child_if_same_values() throws Exception { + public void do_not_override_on_child_if_same_values() { createChildProfiles(); // activate on root profile @@ -677,7 +677,7 @@ public class RuleActivatorMediumTest { } @Test - public void propagate_deactivation_on_child_profiles() throws Exception { + public void propagate_deactivation_on_child_profiles() { createChildProfiles(); // activate on root profile @@ -698,7 +698,7 @@ public class RuleActivatorMediumTest { } @Test - public void propagate_deactivation_even_on_child_overrides() throws Exception { + public void propagate_deactivation_even_on_child_overrides() { createChildProfiles(); // activate on root profile @@ -728,7 +728,7 @@ public class RuleActivatorMediumTest { } @Test - public void do_not_deactivate_inherited_or_overridden_rule() throws Exception { + public void do_not_deactivate_inherited_or_overridden_rule() { createChildProfiles(); // activate on root profile @@ -750,7 +750,7 @@ public class RuleActivatorMediumTest { } @Test - public void reset_child_profile() throws Exception { + public void reset_child_profile() { createChildProfiles(); // activate on root profile @@ -780,7 +780,7 @@ public class RuleActivatorMediumTest { } @Test - public void reset_is_not_propagated_to_child_overrides() throws Exception { + public void reset_is_not_propagated_to_child_overrides() { createChildProfiles(); // activate on root profile @@ -819,7 +819,7 @@ public class RuleActivatorMediumTest { } @Test - public void ignore_reset_if_not_activated() throws Exception { + public void ignore_reset_if_not_activated() { createChildProfiles(); RuleActivation activation = new RuleActivation(RuleTesting.XOO_X1).setReset(true); activate(activation, XOO_P1_KEY); @@ -1008,7 +1008,7 @@ public class RuleActivatorMediumTest { } @Test - public void bulk_change_severity() throws Exception { + public void bulk_change_severity() { createChildProfiles(); // activate two rules on root profile P1 (propagated to P2 and P3) diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java index c2093edc7f6..0d1b14751c5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java @@ -41,7 +41,7 @@ public class ProfilesWsTest { } @Test - public void define_controller() throws Exception { + public void define_controller() { WebService.Controller controller = tester.controller("api/profiles"); assertThat(controller).isNotNull(); assertThat(controller.path()).isEqualTo("api/profiles"); @@ -50,7 +50,7 @@ public class ProfilesWsTest { } @Test - public void define_list_action() throws Exception { + public void define_list_action() { WebService.Controller controller = tester.controller("api/profiles"); WebService.Action restoreProfiles = controller.action("list"); @@ -61,7 +61,7 @@ public class ProfilesWsTest { } @Test - public void define_index_action() throws Exception { + public void define_index_action() { WebService.Controller controller = tester.controller("api/profiles"); WebService.Action restoreProfiles = controller.action("index"); @@ -72,7 +72,7 @@ public class ProfilesWsTest { } @Test - public void define_backup_action() throws Exception { + public void define_backup_action() { WebService.Controller controller = tester.controller("api/profiles"); WebService.Action restoreProfiles = controller.action("backup"); @@ -82,7 +82,7 @@ public class ProfilesWsTest { } @Test - public void define_restore_action() throws Exception { + public void define_restore_action() { WebService.Controller controller = tester.controller("api/profiles"); WebService.Action restoreProfiles = controller.action("restore"); @@ -92,7 +92,7 @@ public class ProfilesWsTest { } @Test - public void define_destroy_action() throws Exception { + public void define_destroy_action() { WebService.Controller controller = tester.controller("api/profiles"); WebService.Action restoreProfiles = controller.action("destroy"); @@ -102,7 +102,7 @@ public class ProfilesWsTest { } @Test - public void define_set_as_default_action() throws Exception { + public void define_set_as_default_action() { WebService.Controller controller = tester.controller("api/profiles"); WebService.Action restoreProfiles = controller.action("set_as_default"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileBackupActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileBackupActionTest.java index e3be04b57f3..b039d48813f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileBackupActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileBackupActionTest.java @@ -57,7 +57,7 @@ public class QProfileBackupActionTest { private WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { DbClient dbClient = new DbClient(db.database(), db.myBatis()); tester = new WsTester(new QProfilesWs( diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangeParentActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangeParentActionMediumTest.java index 433a343967b..7df4a804324 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangeParentActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangeParentActionMediumTest.java @@ -56,7 +56,7 @@ public class QProfileChangeParentActionMediumTest { WsTester wsTester; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); ws = tester.get(QProfilesWs.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java index 232fe5f0352..61b35da2389 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java @@ -101,7 +101,7 @@ public class QProfileChangelogActionTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCompareActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCompareActionMediumTest.java index 19aeceeaf9d..2dc5f9fe3b3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCompareActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCompareActionMediumTest.java @@ -61,7 +61,7 @@ public class QProfileCompareActionMediumTest { private DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); session = db.openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCopyActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCopyActionTest.java index 0b2d31a3e58..47b50803768 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCopyActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCopyActionTest.java @@ -46,7 +46,7 @@ public class QProfileCopyActionTest { private QProfileCopier qProfileCopier; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new QProfilesWs( mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCreateActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCreateActionMediumTest.java index b3258aec61d..1c772b887e7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCreateActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileCreateActionMediumTest.java @@ -64,7 +64,7 @@ public class QProfileCreateActionMediumTest { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileDeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileDeleteActionTest.java index 3d31e67aa35..17fc490bd18 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileDeleteActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileDeleteActionTest.java @@ -65,7 +65,7 @@ public class QProfileDeleteActionTest { private DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); qualityProfileDao = new QualityProfileDao(dbTester.myBatis(), mock(System2.class)); componentDao = new ComponentDao(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileExportActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileExportActionTest.java index 20b18432e73..974f4d8aa18 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileExportActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileExportActionTest.java @@ -71,7 +71,7 @@ public class QProfileExportActionTest { QProfileExporters exporters; @Before - public void before() throws Exception { + public void before() { qualityProfileDao = new QualityProfileDao(db.myBatis(), mock(System2.class)); dbClient = new DbClient(db.database(), db.myBatis(), qualityProfileDao); session = dbClient.openSession(false); @@ -95,7 +95,7 @@ public class QProfileExportActionTest { } @After - public void after() throws Exception { + public void after() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileInheritanceActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileInheritanceActionMediumTest.java index 9d3d15db5a5..44fbc09dd1d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileInheritanceActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileInheritanceActionMediumTest.java @@ -51,7 +51,7 @@ public class QProfileInheritanceActionMediumTest { private DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); session = db.openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileProjectsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileProjectsActionTest.java index 73ede38f285..06e5285064a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileProjectsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileProjectsActionTest.java @@ -66,7 +66,7 @@ public class QProfileProjectsActionTest { private RoleDao roleDao; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new QualityProfileDao(dbTester.myBatis(), mock(System2.class)), diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRenameActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRenameActionTest.java index ba784e090e5..c5c7a994b61 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRenameActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRenameActionTest.java @@ -56,7 +56,7 @@ public class QProfileRenameActionTest { @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); qualityProfileDao = new QualityProfileDao(dbTester.myBatis(), mock(System2.class)); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), qualityProfileDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreActionTest.java index d5de479749d..cbf140bffa7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreActionTest.java @@ -52,7 +52,7 @@ public class QProfileRestoreActionTest { private WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new QProfilesWs( mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreBuiltInActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreBuiltInActionTest.java index 48f3433ad29..043a8b372c1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreBuiltInActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileRestoreBuiltInActionTest.java @@ -43,7 +43,7 @@ public class QProfileRestoreBuiltInActionTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new QProfilesWs( mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSearchActionTest.java index 6b93a45b05a..c19b2410481 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSearchActionTest.java @@ -60,7 +60,7 @@ public class QProfileSearchActionTest { private QProfileLoader profileLoader; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); qualityProfileDao = new QualityProfileDao(dbTester.myBatis(), mock(System2.class)); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), qualityProfileDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSetDefaultActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSetDefaultActionTest.java index fbb13d55de1..136e83fc0bb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSetDefaultActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileSetDefaultActionTest.java @@ -59,7 +59,7 @@ public class QProfileSetDefaultActionTest { @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); qualityProfileDao = new QualityProfileDao(dbTester.myBatis(), mock(System2.class)); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), qualityProfileDao); @@ -161,7 +161,7 @@ public class QProfileSetDefaultActionTest { session.commit(); } - private void checkDefaultProfile(String language, String key) throws Exception { + private void checkDefaultProfile(String language, String key) { assertThat(dbClient.qualityProfileDao().getDefaultProfile(language).getKey()).isEqualTo(key); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java index 2e53f605067..b2de87d9bda 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java @@ -64,7 +64,7 @@ public class QProfilesWsMediumTest { WsTester wsTester; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); ws = tester.get(QProfilesWs.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java index 653bf535936..130b3caab9a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java @@ -98,7 +98,7 @@ public class QProfilesWsTest { } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.path()).isEqualTo(QProfilesWs.API_ENDPOINT); assertThat(controller.description()).isNotEmpty(); @@ -106,7 +106,7 @@ public class QProfilesWsTest { } @Test - public void define_restore_built_action() throws Exception { + public void define_restore_built_action() { WebService.Action restoreProfiles = controller.action("restore_built_in"); assertThat(restoreProfiles).isNotNull(); assertThat(restoreProfiles.isPost()).isTrue(); @@ -114,7 +114,7 @@ public class QProfilesWsTest { } @Test - public void define_search() throws Exception { + public void define_search() { WebService.Action search = controller.action("search"); assertThat(search).isNotNull(); assertThat(search.isPost()).isFalse(); @@ -125,7 +125,7 @@ public class QProfilesWsTest { } @Test - public void define_activate_rule_action() throws Exception { + public void define_activate_rule_action() { WebService.Action restoreProfiles = controller.action(RuleActivationActions.ACTIVATE_ACTION); assertThat(restoreProfiles).isNotNull(); assertThat(restoreProfiles.isPost()).isTrue(); @@ -133,7 +133,7 @@ public class QProfilesWsTest { } @Test - public void define_deactivate_rule_action() throws Exception { + public void define_deactivate_rule_action() { WebService.Action restoreProfiles = controller.action(RuleActivationActions.DEACTIVATE_ACTION); assertThat(restoreProfiles).isNotNull(); assertThat(restoreProfiles.isPost()).isTrue(); @@ -141,7 +141,7 @@ public class QProfilesWsTest { } @Test - public void define_add_project_action() throws Exception { + public void define_add_project_action() { WebService.Action addProject = controller.action("add_project"); assertThat(addProject).isNotNull(); assertThat(addProject.isPost()).isTrue(); @@ -149,7 +149,7 @@ public class QProfilesWsTest { } @Test - public void define_remove_project_action() throws Exception { + public void define_remove_project_action() { WebService.Action removeProject = controller.action("remove_project"); assertThat(removeProject).isNotNull(); assertThat(removeProject.isPost()).isTrue(); @@ -157,7 +157,7 @@ public class QProfilesWsTest { } @Test - public void define_set_default_action() throws Exception { + public void define_set_default_action() { WebService.Action setDefault = controller.action("set_default"); assertThat(setDefault).isNotNull(); assertThat(setDefault.isPost()).isTrue(); @@ -165,7 +165,7 @@ public class QProfilesWsTest { } @Test - public void define_projects_action() throws Exception { + public void define_projects_action() { WebService.Action projects = controller.action("projects"); assertThat(projects).isNotNull(); assertThat(projects.isPost()).isFalse(); @@ -174,7 +174,7 @@ public class QProfilesWsTest { } @Test - public void define_backup_action() throws Exception { + public void define_backup_action() { WebService.Action backup = controller.action("backup"); assertThat(backup).isNotNull(); assertThat(backup.isPost()).isFalse(); @@ -182,14 +182,14 @@ public class QProfilesWsTest { } @Test - public void define_restore_action() throws Exception { + public void define_restore_action() { WebService.Action restore = controller.action("restore"); assertThat(restore).isNotNull(); assertThat(restore.isPost()).isTrue(); assertThat(restore.params()).hasSize(1); } - public void define_bulk_activate_rule_action() throws Exception { + public void define_bulk_activate_rule_action() { WebService.Action restoreProfiles = controller.action(BulkRuleActivationActions.BULK_ACTIVATE_ACTION); assertThat(restoreProfiles).isNotNull(); assertThat(restoreProfiles.isPost()).isTrue(); @@ -197,7 +197,7 @@ public class QProfilesWsTest { } @Test - public void define_bulk_deactivate_rule_action() throws Exception { + public void define_bulk_deactivate_rule_action() { WebService.Action restoreProfiles = controller.action(BulkRuleActivationActions.BULK_DEACTIVATE_ACTION); assertThat(restoreProfiles).isNotNull(); assertThat(restoreProfiles.isPost()).isTrue(); @@ -205,7 +205,7 @@ public class QProfilesWsTest { } @Test - public void define_create_action() throws Exception { + public void define_create_action() { WebService.Action create = controller.action("create"); assertThat(create).isNotNull(); assertThat(create.isPost()).isTrue(); @@ -221,7 +221,7 @@ public class QProfilesWsTest { } @Test - public void define_importers_action() throws Exception { + public void define_importers_action() { WebService.Action importers = controller.action("importers"); assertThat(importers).isNotNull(); assertThat(importers.isPost()).isFalse(); @@ -230,7 +230,7 @@ public class QProfilesWsTest { } @Test - public void define_changelog_action() throws Exception { + public void define_changelog_action() { WebService.Action changelog = controller.action("changelog"); assertThat(changelog).isNotNull(); assertThat(changelog.isPost()).isFalse(); @@ -241,7 +241,7 @@ public class QProfilesWsTest { } @Test - public void define_change_parent_action() throws Exception { + public void define_change_parent_action() { WebService.Action changeParent = controller.action("change_parent"); assertThat(changeParent).isNotNull(); assertThat(changeParent.isPost()).isTrue(); @@ -251,7 +251,7 @@ public class QProfilesWsTest { } @Test - public void define_compare_action() throws Exception { + public void define_compare_action() { WebService.Action compare = controller.action("compare"); assertThat(compare).isNotNull(); assertThat(compare.isPost()).isFalse(); @@ -263,7 +263,7 @@ public class QProfilesWsTest { } @Test - public void define_copy_action() throws Exception { + public void define_copy_action() { WebService.Action copy = controller.action("copy"); assertThat(copy).isNotNull(); assertThat(copy.isPost()).isTrue(); @@ -273,7 +273,7 @@ public class QProfilesWsTest { } @Test - public void define_delete_action() throws Exception { + public void define_delete_action() { WebService.Action delete = controller.action("delete"); assertThat(delete).isNotNull(); assertThat(delete.isPost()).isTrue(); @@ -283,7 +283,7 @@ public class QProfilesWsTest { } @Test - public void define_export_action() throws Exception { + public void define_export_action() { WebService.Action export = controller.action("export"); assertThat(export).isNotNull(); assertThat(export.isPost()).isFalse(); @@ -293,7 +293,7 @@ public class QProfilesWsTest { } @Test - public void define_exporters_action() throws Exception { + public void define_exporters_action() { WebService.Action exporters = controller.action("exporters"); assertThat(exporters).isNotNull(); assertThat(exporters.isPost()).isFalse(); @@ -302,7 +302,7 @@ public class QProfilesWsTest { } @Test - public void define_inheritance_action() throws Exception { + public void define_inheritance_action() { WebService.Action inheritance = controller.action("inheritance"); assertThat(inheritance).isNotNull(); assertThat(inheritance.isPost()).isFalse(); @@ -313,7 +313,7 @@ public class QProfilesWsTest { } @Test - public void define_rename_action() throws Exception { + public void define_rename_action() { WebService.Action rename = controller.action("rename"); assertThat(rename).isNotNull(); assertThat(rename.isPost()).isTrue(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRackBridgeTest.java b/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRackBridgeTest.java index 242f32c67f8..894e18375a9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRackBridgeTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRackBridgeTest.java @@ -45,17 +45,17 @@ public class PlatformRackBridgeTest { PlatformRackBridge underTest; @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); } @Test(expected = RuntimeException.class) - public void getRubyRuntime_throws_RE_when_RackApplicationFactory_is_not_in_ServletContext() throws Exception { + public void getRubyRuntime_throws_RE_when_RackApplicationFactory_is_not_in_ServletContext() { underTest.getRubyRuntime(); } @Test - public void getRubyRuntime_returns_Ruby_instance_from_rack_application() throws Exception { + public void getRubyRuntime_returns_Ruby_instance_from_rack_application() { when(servletContext.getAttribute("rack.factory")).thenReturn(rackApplicationFactory); when(rackApplicationFactory.getApplication()).thenReturn(rackApplication); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRubyBridgeTest.java b/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRubyBridgeTest.java index 56729daec6f..38bca7ca846 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRubyBridgeTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ruby/PlatformRubyBridgeTest.java @@ -39,7 +39,7 @@ public class PlatformRubyBridgeTest { private PlatformRubyBridge underTest; @Before - public void setUp() throws Exception { + public void setUp() { when(rackBridge.getRubyRuntime()).thenReturn(container.getProvider().getRuntime()); underTest = new PlatformRubyBridge(rackBridge); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java index 04bf1ddf430..cf2e19f64f0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/DefaultRuleFinderMediumTest.java @@ -46,7 +46,7 @@ public class DefaultRuleFinderMediumTest { private DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { finder = tester.get(DefaultRuleFinder.class); dbClient = tester.get(DbClient.class); session = dbClient.openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoaderTest.java index 2acfab4484d..15938092f90 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoaderTest.java @@ -95,7 +95,7 @@ public class DeprecatedRulesDefinitionLoaderTest { } @Test - public void wrap_deprecated_rule_repositories() throws Exception { + public void wrap_deprecated_rule_repositories() { RulesDefinition.Context context = new RulesDefinition.Context(); new DeprecatedRulesDefinitionLoader(i18n, debtModelRepository, importer, new RuleRepository[] {new CheckstyleRules()}).complete(context); @@ -125,7 +125,7 @@ public class DeprecatedRulesDefinitionLoaderTest { } @Test - public void emulate_the_day_deprecated_api_can_be_dropped() throws Exception { + public void emulate_the_day_deprecated_api_can_be_dropped() { RulesDefinition.Context context = new RulesDefinition.Context(); // no more RuleRepository ! @@ -135,7 +135,7 @@ public class DeprecatedRulesDefinitionLoaderTest { } @Test - public void use_l10n_bundles() throws Exception { + public void use_l10n_bundles() { RulesDefinition.Context context = new RulesDefinition.Context(); when(i18n.getName("checkstyle", "ConstantName")).thenReturn("Constant Name"); when(i18n.getDescription("checkstyle", "ConstantName")).thenReturn("Checks that constant names conform to the specified format"); @@ -155,7 +155,7 @@ public class DeprecatedRulesDefinitionLoaderTest { } @Test - public void define_rule_debt() throws Exception { + public void define_rule_debt() { RulesDefinition.Context context = new RulesDefinition.Context(); List ruleDebts = newArrayList( @@ -188,7 +188,7 @@ public class DeprecatedRulesDefinitionLoaderTest { } @Test - public void fail_on_invalid_rule_debt() throws Exception { + public void fail_on_invalid_rule_debt() { RulesDefinition.Context context = new RulesDefinition.Context(); List ruleDebts = newArrayList( diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java index 2bc554247f7..778bb4bb116 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java @@ -105,7 +105,7 @@ public class RegisterRulesMediumTest { } @Test - public void register_rules_at_startup() throws Exception { + public void register_rules_at_startup() { register(new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -166,7 +166,7 @@ public class RegisterRulesMediumTest { * 4. start server -> db is up-to-date (no changes) but rules must be re-indexed */ @Test - public void index_rules_even_if_no_changes() throws Exception { + public void index_rules_even_if_no_changes() { Rules rules = new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -303,7 +303,7 @@ public class RegisterRulesMediumTest { } @Test - public void do_not_update_rules_if_no_changes() throws Exception { + public void do_not_update_rules_if_no_changes() { Rules rules = new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -349,7 +349,7 @@ public class RegisterRulesMediumTest { } @Test - public void deactivate_removed_rules_only_if_repository_still_exists() throws Exception { + public void deactivate_removed_rules_only_if_repository_still_exists() { register(new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -378,7 +378,7 @@ public class RegisterRulesMediumTest { } @Test - public void do_not_deactivate_removed_rules_if_repository_accidentally_uninstalled() throws Exception { + public void do_not_deactivate_removed_rules_if_repository_accidentally_uninstalled() { Rules rules = new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -407,7 +407,7 @@ public class RegisterRulesMediumTest { } @Test - public void update_active_rules_on_param_changes() throws Exception { + public void update_active_rules_on_param_changes() { register(new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -482,7 +482,7 @@ public class RegisterRulesMediumTest { } @Test - public void fail_if_debt_characteristic_is_root() throws Exception { + public void fail_if_debt_characteristic_is_root() { try { register(new Rules() { @Override @@ -500,7 +500,7 @@ public class RegisterRulesMediumTest { } @Test - public void update_custom_rule_on_template_change() throws Exception { + public void update_custom_rule_on_template_change() { register(new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -555,7 +555,7 @@ public class RegisterRulesMediumTest { } @Test - public void do_not_update_custom_rule_if_no_template_change() throws Exception { + public void do_not_update_custom_rule_if_no_template_change() { Rules rules = new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { @@ -591,7 +591,7 @@ public class RegisterRulesMediumTest { } @Test - public void do_not_update_custom_rule_params_from_template() throws Exception { + public void do_not_update_custom_rule_params_from_template() { register(new Rules() { @Override public void init(RulesDefinition.NewRepository repository) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesTest.java index 7c1abbfedc7..522175215d8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesTest.java @@ -72,7 +72,7 @@ public class RegisterRulesTest extends AbstractDaoTestCase { } @After - public void after() throws Exception { + public void after() { dbSession.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RubyRuleServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RubyRuleServiceTest.java index 777f540f15d..12b126735bf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RubyRuleServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RubyRuleServiceTest.java @@ -63,18 +63,18 @@ public class RubyRuleServiceTest { RubyRuleService service; @Before - public void setUp() throws Exception { + public void setUp() { service = new RubyRuleService(ruleService, updater); } @Test - public void find_by_key() throws Exception { + public void find_by_key() { service.findByKey("squid:S001"); verify(ruleService).getByKey(RuleKey.of("squid", "S001")); } @Test - public void search_rules() throws Exception { + public void search_rules() { when(ruleService.search(any(RuleQuery.class), any(QueryContext.class))).thenReturn(mock(Result.class)); HashMap params = newHashMap(); @@ -111,7 +111,7 @@ public class RubyRuleServiceTest { } @Test - public void search_rules_activated_on_a_profile() throws Exception { + public void search_rules_activated_on_a_profile() { when(ruleService.search(any(RuleQuery.class), any(QueryContext.class))).thenReturn(mock(Result.class)); HashMap params = newHashMap(); @@ -125,7 +125,7 @@ public class RubyRuleServiceTest { } @Test - public void search_rules_without_page_size_param() throws Exception { + public void search_rules_without_page_size_param() { when(ruleService.search(any(RuleQuery.class), any(QueryContext.class))).thenReturn(mock(Result.class)); HashMap params = newHashMap(); @@ -139,7 +139,7 @@ public class RubyRuleServiceTest { } @Test - public void search_all_rules() throws Exception { + public void search_all_rules() { List rules = newArrayList(mock(Rule.class)); Result serviceResult = mock(Result.class); when(serviceResult.scroll()).thenReturn(rules.iterator()); @@ -157,7 +157,7 @@ public class RubyRuleServiceTest { } @Test - public void update_rule() throws Exception { + public void update_rule() { when(ruleService.search(any(RuleQuery.class), any(QueryContext.class))).thenReturn(mock(Result.class)); service.updateRule(ImmutableMap.of("ruleKey", "squid:S001")); @@ -166,7 +166,7 @@ public class RubyRuleServiceTest { } @Test - public void search_manual_rules() throws Exception { + public void search_manual_rules() { when(ruleService.search(any(RuleQuery.class), any(QueryContext.class))).thenReturn(mock(Result.class)); service.searchManualRules(); @@ -175,21 +175,21 @@ public class RubyRuleServiceTest { } @Test - public void create_manual_rules() throws Exception { + public void create_manual_rules() { service.createManualRule(ImmutableMap.of("manualKey", "MY_MANUAL")); verify(ruleService).create(any(NewRule.class)); } @Test - public void update_manual_rules() throws Exception { + public void update_manual_rules() { service.updateManualRule(ImmutableMap.of("ruleKey", "manual:MY_MANUAL")); verify(ruleService).update(any(RuleUpdate.class)); } @Test - public void delete_manual_rules() throws Exception { + public void delete_manual_rules() { service.deleteManualRule("manual:MY_MANUAL"); verify(ruleService).delete(RuleKey.of("manual", "MY_MANUAL")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleBackendMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleBackendMediumTest.java index 6ee776eddd0..f24f7237402 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleBackendMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleBackendMediumTest.java @@ -72,7 +72,7 @@ public class RuleBackendMediumTest { } @Test - public void insert_in_db_and_multiget_in_es() throws InterruptedException { + public void insert_in_db_and_multiget_in_es() { // insert db RuleDto ruleDto = RuleTesting.newXooX1(); RuleDto ruleDto2 = RuleTesting.newXooX2(); @@ -85,7 +85,7 @@ public class RuleBackendMediumTest { } @Test - public void insert_in_db_and_index_in_es() throws InterruptedException { + public void insert_in_db_and_index_in_es() { // insert db RuleDto ruleDto = RuleTesting.newXooX1(); dao.insert(dbSession, ruleDto); @@ -128,7 +128,7 @@ public class RuleBackendMediumTest { } @Test - public void insert_rule_tags_in_db_and_index_in_es() throws InterruptedException { + public void insert_rule_tags_in_db_and_index_in_es() { // insert db RuleDto ruleDto = RuleTesting.newXooX1(); dao.insert(dbSession, ruleDto); @@ -250,7 +250,7 @@ public class RuleBackendMediumTest { } @Test - public void insert_and_update_rule_param() throws InterruptedException { + public void insert_and_update_rule_param() { // insert db RuleDto ruleDto = RuleTesting.newXooX1(); @@ -309,7 +309,7 @@ public class RuleBackendMediumTest { @Test @Deprecated - public void has_id() throws Exception { + public void has_id() { RuleDto ruleDto = RuleTesting.newXooX1(); dao.insert(dbSession, ruleDto); @@ -320,7 +320,7 @@ public class RuleBackendMediumTest { @Test - public void insert_update_characteristics() throws Exception { + public void insert_update_characteristics() { CharacteristicDto char1 = DebtTesting.newCharacteristicDto("c1"); db.debtCharacteristicDao().insert(char1, dbSession); @@ -382,7 +382,7 @@ public class RuleBackendMediumTest { } @Test - public void insert_update_debt_overload() throws Exception { + public void insert_update_debt_overload() { RuleDto ruleDto = RuleTesting.newXooX1() .setRemediationFunction(null) diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleCreatorMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleCreatorMediumTest.java index 2a9d7a18aa6..2a9900c0854 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleCreatorMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleCreatorMediumTest.java @@ -70,7 +70,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_custom_rule() throws Exception { + public void create_custom_rule() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -116,7 +116,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_custom_rule_with_empty_parameter_value() throws Exception { + public void create_custom_rule_with_empty_parameter_value() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -141,7 +141,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_custom_rule_with_no_parameter_value() throws Exception { + public void create_custom_rule_with_no_parameter_value() { // insert template rule RuleDto templateRule = createTemplateRuleWithIntArrayParam(); @@ -165,7 +165,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_custom_rule_with_multiple_parameter_values() throws Exception { + public void create_custom_rule_with_multiple_parameter_values() { // insert template rule RuleDto templateRule = createTemplateRuleWithIntArrayParam(); @@ -190,7 +190,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_custom_rule_with_invalid_parameter() throws Exception { + public void create_custom_rule_with_invalid_parameter() { // insert template rule RuleDto templateRule = createTemplateRuleWithIntArrayParam(); @@ -212,7 +212,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_custom_rule_with_invalid_parameters() throws Exception { + public void create_custom_rule_with_invalid_parameters() { // insert template rule RuleDto templateRule = createTemplateRuleWithTwoIntParams(); @@ -235,7 +235,7 @@ public class RuleCreatorMediumTest { @Test - public void reactivate_custom_rule_if_already_exists_in_removed_status() throws Exception { + public void reactivate_custom_rule_if_already_exists_in_removed_status() { String key = "CUSTOM_RULE"; // insert template rule @@ -279,7 +279,7 @@ public class RuleCreatorMediumTest { } @Test - public void generate_reactivation_exception_when_rule_exists_in_removed_status_and_prevent_reactivation_parameter_is_true() throws Exception { + public void generate_reactivation_exception_when_rule_exists_in_removed_status_and_prevent_reactivation_parameter_is_true() { String key = "CUSTOM_RULE"; // insert template rule @@ -316,7 +316,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_invalid_key() throws Exception { + public void fail_to_create_custom_rule_when_invalid_key() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -336,7 +336,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_rule_key_already_exists() throws Exception { + public void fail_to_create_custom_rule_when_rule_key_already_exists() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -365,7 +365,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_missing_name() throws Exception { + public void fail_to_create_custom_rule_when_missing_name() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -384,7 +384,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_missing_description() throws Exception { + public void fail_to_create_custom_rule_when_missing_description() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -403,7 +403,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_missing_severity() throws Exception { + public void fail_to_create_custom_rule_when_missing_severity() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -422,7 +422,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_invalid_severity() throws Exception { + public void fail_to_create_custom_rule_when_invalid_severity() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -442,7 +442,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_missing_status() throws Exception { + public void fail_to_create_custom_rule_when_missing_status() { // insert template rule RuleDto templateRule = createTemplateRule(); @@ -461,7 +461,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_custom_rule_when_wrong_rule_template() throws Exception { + public void fail_to_create_custom_rule_when_wrong_rule_template() { // insert rule RuleDto rule = dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001")).setIsTemplate(false)); @@ -484,7 +484,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_manual_rule() throws Exception { + public void create_manual_rule() { NewRule newRule = NewRule.createForManualRule("MANUAL_RULE") .setName("My manual") .setMarkdownDescription("Some description"); @@ -509,7 +509,7 @@ public class RuleCreatorMediumTest { } @Test - public void create_manual_rule_with_severity() throws Exception { + public void create_manual_rule_with_severity() { NewRule newRule = NewRule.createForManualRule("MANUAL_RULE") .setName("My manual") .setMarkdownDescription("Some description") @@ -535,7 +535,7 @@ public class RuleCreatorMediumTest { } @Test - public void reactivate_manual_rule_if_already_exists_in_removed_status() throws Exception { + public void reactivate_manual_rule_if_already_exists_in_removed_status() { String key = "MANUAL_RULE"; // insert a removed rule @@ -569,7 +569,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_when_missing_key() throws Exception { + public void fail_to_create_manual_rule_when_missing_key() { try { NewRule.createForManualRule("") .setName("My manual") @@ -581,7 +581,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_when_invalid_key() throws Exception { + public void fail_to_create_manual_rule_when_invalid_key() { NewRule newRule = NewRule.createForManualRule("*INVALID*") .setName("My custom") .setHtmlDescription("Some description"); @@ -595,7 +595,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_when_rule_key_already_exists() throws Exception { + public void fail_to_create_manual_rule_when_rule_key_already_exists() { NewRule newRule = NewRule.createForManualRule("MANUAL_RULE") .setName("My manual") .setHtmlDescription("Some description"); @@ -614,7 +614,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_when_missing_name() throws Exception { + public void fail_to_create_manual_rule_when_missing_name() { NewRule newRule = NewRule.createForManualRule("MANUAL_RULE") .setHtmlDescription("Some description"); @@ -627,7 +627,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_when_missing_description() throws Exception { + public void fail_to_create_manual_rule_when_missing_description() { NewRule newRule = NewRule.createForManualRule("MANUAL_RULE") .setName("My manual"); @@ -640,7 +640,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_with_status() throws Exception { + public void fail_to_create_manual_rule_with_status() { try { NewRule.createForManualRule("MANUAL_RULE") .setName("My manual") @@ -653,7 +653,7 @@ public class RuleCreatorMediumTest { } @Test - public void fail_to_create_manual_rule_with_parameters() throws Exception { + public void fail_to_create_manual_rule_with_parameters() { try { NewRule.createForManualRule("MANUAL_RULE") .setName("My manual") diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleDeleterMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleDeleterMediumTest.java index 76510d1872a..9ff5e40059a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleDeleterMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleDeleterMediumTest.java @@ -69,7 +69,7 @@ public class RuleDeleterMediumTest { } @Test - public void delete_custom_rule() throws Exception { + public void delete_custom_rule() { // Create template rule RuleDto templateRule = RuleTesting.newTemplateRule(RuleKey.of("xoo", "T1")).setLanguage("xoo"); dao.insert(dbSession, templateRule); @@ -101,7 +101,7 @@ public class RuleDeleterMediumTest { } @Test - public void delete_manual_rule() throws Exception { + public void delete_manual_rule() { // Create manual rule RuleDto manualRule = RuleTesting.newManualRule("Manual_Rule"); dao.insert(dbSession, manualRule); @@ -118,7 +118,7 @@ public class RuleDeleterMediumTest { } @Test - public void fail_to_delete_if_not_custom_or_not_manual() throws Exception { + public void fail_to_delete_if_not_custom_or_not_manual() { // Create rule RuleKey ruleKey = RuleKey.of("java", "S001"); dao.insert(dbSession, RuleTesting.newDto(ruleKey)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleOperationsTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleOperationsTest.java index 8f10df6d4da..1f3a48d2b81 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleOperationsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleOperationsTest.java @@ -69,7 +69,7 @@ public class RuleOperationsTest { RuleOperations operations; @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.openSession(false)).thenReturn(session); when(dbClient.ruleDao()).thenReturn(ruleDao); when(dbClient.debtCharacteristicDao()).thenReturn(characteristicDao); @@ -77,7 +77,7 @@ public class RuleOperationsTest { } @Test - public void update_rule() throws Exception { + public void update_rule() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setSubCharacteristicId(6).setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -111,7 +111,7 @@ public class RuleOperationsTest { } @Test - public void update_rule_set_overridden_values_to_null_when_new_values_are_equals_to_default_values() throws Exception { + public void update_rule_set_overridden_values_to_null_when_new_values_are_equals_to_default_values() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setSubCharacteristicId(6).setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min") .setDefaultSubCharacteristicId(2).setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min"); @@ -145,7 +145,7 @@ public class RuleOperationsTest { } @Test - public void not_update_rule_if_same_sub_characteristic_and_function() throws Exception { + public void not_update_rule_if_same_sub_characteristic_and_function() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setSubCharacteristicId(2).setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -166,7 +166,7 @@ public class RuleOperationsTest { } @Test - public void update_rule_set_characteristic_if_different_from_default_one() throws Exception { + public void update_rule_set_characteristic_if_different_from_default_one() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setDefaultSubCharacteristicId(2).setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -199,7 +199,7 @@ public class RuleOperationsTest { } @Test - public void update_rule_set_remediation_function_if_different_from_default_one() throws Exception { + public void update_rule_set_remediation_function_if_different_from_default_one() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setDefaultSubCharacteristicId(6).setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -232,7 +232,7 @@ public class RuleOperationsTest { } @Test - public void disable_rule_debt_when_update_rule_with_no_sub_characteristic() throws Exception { + public void disable_rule_debt_when_update_rule_with_no_sub_characteristic() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setDefaultSubCharacteristicId(6).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("10min") .setSubCharacteristicId(6) @@ -257,7 +257,7 @@ public class RuleOperationsTest { } @Test - public void disable_rule_debt_when_update_rule_with_no_function() throws Exception { + public void disable_rule_debt_when_update_rule_with_no_function() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setDefaultSubCharacteristicId(6).setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -285,7 +285,7 @@ public class RuleOperationsTest { } @Test - public void disable_characteristic_on_rule_having_no_debt_info() throws Exception { + public void disable_characteristic_on_rule_having_no_debt_info() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -306,7 +306,7 @@ public class RuleOperationsTest { } @Test - public void not_disable_characteristic_when_update_rule_if_already_disabled() throws Exception { + public void not_disable_characteristic_when_update_rule_if_already_disabled() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setSubCharacteristicId(-1); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -322,7 +322,7 @@ public class RuleOperationsTest { } @Test - public void fail_to_update_rule_on_unknown_rule() throws Exception { + public void fail_to_update_rule_on_unknown_rule() { RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); when(ruleDao.getNullableByKey(session, ruleKey)).thenReturn(null); @@ -342,7 +342,7 @@ public class RuleOperationsTest { } @Test - public void fail_to_update_rule_on_unknown_sub_characteristic() throws Exception { + public void fail_to_update_rule_on_unknown_sub_characteristic() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setSubCharacteristicId(2).setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); @@ -366,7 +366,7 @@ public class RuleOperationsTest { } @Test - public void fail_to_update_rule_on_invalid_coefficient() throws Exception { + public void fail_to_update_rule_on_invalid_coefficient() { RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") .setSubCharacteristicId(2).setRemediationFunction("LINEAR").setRemediationCoefficient("1h"); RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleServiceMediumTest.java index d203f55c21e..d9a9268f8db 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleServiceMediumTest.java @@ -69,7 +69,7 @@ public class RuleServiceMediumTest { } @Test - public void get_rule_by_key() throws Exception { + public void get_rule_by_key() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -87,7 +87,7 @@ public class RuleServiceMediumTest { } @Test - public void get_non_null_rule_by_key() throws Exception { + public void get_non_null_rule_by_key() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -108,7 +108,7 @@ public class RuleServiceMediumTest { } @Test - public void get_rule_by_key_escape_description_on_manual_rule() throws Exception { + public void get_rule_by_key_escape_description_on_manual_rule() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -125,7 +125,7 @@ public class RuleServiceMediumTest { } @Test - public void get_rule_by_keys() throws Exception { + public void get_rule_by_keys() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -140,7 +140,7 @@ public class RuleServiceMediumTest { } @Test - public void list_tags() throws InterruptedException { + public void list_tags() { // insert db RuleKey key1 = RuleKey.of("javascript", "S001"); RuleKey key2 = RuleKey.of("java", "S001"); @@ -163,7 +163,7 @@ public class RuleServiceMediumTest { } @Test - public void update_rule() throws Exception { + public void update_rule() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -185,7 +185,7 @@ public class RuleServiceMediumTest { } @Test(expected = UnauthorizedException.class) - public void do_not_update_if_not_granted() throws Exception { + public void do_not_update_if_not_granted() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); RuleKey key = RuleKey.of("java", "S001"); @@ -200,7 +200,7 @@ public class RuleServiceMediumTest { } @Test - public void create_rule() throws Exception { + public void create_rule() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -226,14 +226,14 @@ public class RuleServiceMediumTest { } @Test(expected = UnauthorizedException.class) - public void do_not_create_if_not_granted() throws Exception { + public void do_not_create_if_not_granted() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); service.create(NewRule.createForCustomRule("MY_CUSTOM", RuleKey.of("java", "S001"))); } @Test - public void delete_rule() throws Exception { + public void delete_rule() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); @@ -257,7 +257,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() { MockUserSession.set().setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION); service.delete(RuleKey.of("java", "S001")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleTagHelperTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleTagHelperTest.java index 5d61ed462ea..2a9b004f206 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleTagHelperTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleTagHelperTest.java @@ -31,7 +31,7 @@ import static org.junit.Assert.fail; public class RuleTagHelperTest { @Test - public void applyTags() throws Exception { + public void applyTags() { RuleDto rule = new RuleDto().setTags(Sets.newHashSet("performance")); boolean changed = RuleTagHelper.applyTags(rule, Sets.newHashSet("java8", "security")); assertThat(rule.getTags()).containsOnly("java8", "security"); @@ -39,7 +39,7 @@ public class RuleTagHelperTest { } @Test - public void applyTags_remove_all_existing_tags() throws Exception { + public void applyTags_remove_all_existing_tags() { RuleDto rule = new RuleDto().setTags(Sets.newHashSet("performance")); boolean changed = RuleTagHelper.applyTags(rule, Collections.emptySet()); assertThat(rule.getTags()).isEmpty(); @@ -47,7 +47,7 @@ public class RuleTagHelperTest { } @Test - public void applyTags_no_changes() throws Exception { + public void applyTags_no_changes() { RuleDto rule = new RuleDto().setTags(Sets.newHashSet("performance")); boolean changed = RuleTagHelper.applyTags(rule, Sets.newHashSet("performance")); assertThat(rule.getTags()).containsOnly("performance"); @@ -55,7 +55,7 @@ public class RuleTagHelperTest { } @Test - public void applyTags_validate_format() throws Exception { + public void applyTags_validate_format() { RuleDto rule = new RuleDto(); boolean changed = RuleTagHelper.applyTags(rule, Sets.newHashSet("java8", "security")); assertThat(rule.getTags()).containsOnly("java8", "security"); @@ -70,7 +70,7 @@ public class RuleTagHelperTest { } @Test - public void applyTags_do_not_duplicate_system_tags() throws Exception { + public void applyTags_do_not_duplicate_system_tags() { RuleDto rule = new RuleDto() .setTags(Sets.newHashSet("performance")) .setSystemTags(Sets.newHashSet("security")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleUpdaterMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleUpdaterMediumTest.java index 21c7c613fda..7b01cfe2510 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/RuleUpdaterMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/RuleUpdaterMediumTest.java @@ -83,7 +83,7 @@ public class RuleUpdaterMediumTest { } @Test - public void do_not_update_rule_with_removed_status() throws Exception { + public void do_not_update_rule_with_removed_status() { ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY).setStatus(RuleStatus.REMOVED)); dbSession.commit(); @@ -97,7 +97,7 @@ public class RuleUpdaterMediumTest { } @Test - public void no_changes() throws Exception { + public void no_changes() { ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) // the following fields are not supposed to be updated .setNoteData("my *note*") @@ -125,7 +125,7 @@ public class RuleUpdaterMediumTest { } @Test - public void set_markdown_note() throws Exception { + public void set_markdown_note() { MockUserSession.set().setLogin("me"); ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) @@ -159,7 +159,7 @@ public class RuleUpdaterMediumTest { } @Test - public void remove_markdown_note() throws Exception { + public void remove_markdown_note() { ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setNoteData("my *note*") .setNoteUserLogin("me")); @@ -177,7 +177,7 @@ public class RuleUpdaterMediumTest { } @Test - public void set_tags() throws Exception { + public void set_tags() { // insert db ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setTags(Sets.newHashSet("security")) @@ -199,7 +199,7 @@ public class RuleUpdaterMediumTest { } @Test - public void remove_tags() throws Exception { + public void remove_tags() { ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setTags(Sets.newHashSet("security")) .setSystemTags(Sets.newHashSet("java8", "javadoc"))); @@ -219,7 +219,7 @@ public class RuleUpdaterMediumTest { } @Test - public void override_debt() throws Exception { + public void override_debt() { insertDebtCharacteristics(dbSession); ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setDefaultSubCharacteristicId(hardReliabilityId) @@ -256,7 +256,7 @@ public class RuleUpdaterMediumTest { } @Test - public void override_debt_only_offset() throws Exception { + public void override_debt_only_offset() { insertDebtCharacteristics(dbSession); ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setDefaultSubCharacteristicId(hardReliabilityId) @@ -290,7 +290,7 @@ public class RuleUpdaterMediumTest { } @Test - public void override_debt_from_linear_with_offset_to_constant() throws Exception { + public void override_debt_from_linear_with_offset_to_constant() { insertDebtCharacteristics(dbSession); ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setDefaultSubCharacteristicId(hardReliabilityId) @@ -324,7 +324,7 @@ public class RuleUpdaterMediumTest { } @Test - public void reset_debt() throws Exception { + public void reset_debt() { insertDebtCharacteristics(dbSession); ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setDefaultSubCharacteristicId(hardReliabilityId) @@ -359,7 +359,7 @@ public class RuleUpdaterMediumTest { } @Test - public void unset_debt() throws Exception { + public void unset_debt() { insertDebtCharacteristics(dbSession); ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY) .setDefaultSubCharacteristicId(hardReliabilityId) @@ -398,7 +398,7 @@ public class RuleUpdaterMediumTest { } @Test - public void update_custom_rule() throws Exception { + public void update_custom_rule() { // Create template rule RuleDto templateRule = RuleTesting.newTemplateRule(RuleKey.of("java", "S001")); ruleDao.insert(dbSession, templateRule); @@ -444,7 +444,7 @@ public class RuleUpdaterMediumTest { } @Test - public void update_custom_rule_with_empty_parameter() throws Exception { + public void update_custom_rule_with_empty_parameter() { // Create template rule RuleDto templateRule = RuleTesting.newTemplateRule(RuleKey.of("java", "S001")); ruleDao.insert(dbSession, templateRule); @@ -479,7 +479,7 @@ public class RuleUpdaterMediumTest { } @Test - public void update_active_rule_parameters_when_updating_custom_rule() throws Exception { + public void update_active_rule_parameters_when_updating_custom_rule() { // Create template rule with 3 parameters RuleDto templateRule = RuleTesting.newTemplateRule(RuleKey.of("java", "S001")).setLanguage("xoo"); ruleDao.insert(dbSession, templateRule); @@ -540,7 +540,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_custom_rule_when_empty_name() throws Exception { + public void fail_to_update_custom_rule_when_empty_name() { // Create template rule RuleDto templateRule = RuleTesting.newTemplateRule(RuleKey.of("java", "S001")); ruleDao.insert(dbSession, templateRule); @@ -564,7 +564,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_custom_rule_when_empty_description() throws Exception { + public void fail_to_update_custom_rule_when_empty_description() { // Create template rule RuleDto templateRule = RuleTesting.newTemplateRule(RuleKey.of("java", "S001")); ruleDao.insert(dbSession, templateRule); @@ -588,7 +588,7 @@ public class RuleUpdaterMediumTest { } @Test - public void update_manual_rule() throws Exception { + public void update_manual_rule() { // Create manual rule RuleDto manualRule = RuleTesting.newManualRule("My manual") .setName("Old name") @@ -616,7 +616,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_manual_rule_if_status_is_set() throws Exception { + public void fail_to_update_manual_rule_if_status_is_set() { // Create manual rule RuleDto manualRule = RuleTesting.newManualRule("My manual"); ruleDao.insert(dbSession, manualRule); @@ -634,7 +634,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_manual_rule_if_parameters_are_set() throws Exception { + public void fail_to_update_manual_rule_if_parameters_are_set() { // Create manual rule RuleDto manualRule = RuleTesting.newManualRule("My manual"); ruleDao.insert(dbSession, manualRule); @@ -653,7 +653,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_plugin_rule_if_name_is_set() throws Exception { + public void fail_to_update_plugin_rule_if_name_is_set() { // Create rule rule RuleDto ruleDto = RuleTesting.newDto(RuleKey.of("squid", "S01")); ruleDao.insert(dbSession, ruleDto); @@ -671,7 +671,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_plugin_rule_if_description_is_set() throws Exception { + public void fail_to_update_plugin_rule_if_description_is_set() { // Create rule rule RuleDto ruleDto = RuleTesting.newDto(RuleKey.of("squid", "S01")); ruleDao.insert(dbSession, ruleDto); @@ -689,7 +689,7 @@ public class RuleUpdaterMediumTest { } @Test - public void fail_to_update_plugin_rule_if_severity_is_set() throws Exception { + public void fail_to_update_plugin_rule_if_severity_is_set() { // Create rule rule RuleDto ruleDto = RuleTesting.newDto(RuleKey.of("squid", "S01")); ruleDao.insert(dbSession, ruleDto); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java index 2b82eb2aaa9..efddaf517a9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java @@ -48,7 +48,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { private System2 system2; @Before - public void before() throws Exception { + public void before() { this.session = getMyBatis().openSession(false); this.system2 = mock(System2.class); this.dao = new RuleDao(system2); @@ -60,7 +60,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_all() throws Exception { + public void select_all() { setupData("selectAll"); List ruleDtos = dao.findAll(session); @@ -86,7 +86,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_enables_and_non_manual() throws Exception { + public void select_enables_and_non_manual() { setupData("select_enables_and_non_manual"); List ruleDtos = dao.findByEnabledAndNotManual(session); @@ -111,7 +111,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_by_id() throws Exception { + public void select_by_id() { setupData("selectById"); RuleDto ruleDto = dao.getById(session, 2); @@ -124,7 +124,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_by_rule_key() throws Exception { + public void select_by_rule_key() { setupData("select_by_rule_key"); assertThat(dao.getNullableByKey(session, RuleKey.of("checkstyle", "AvoidComparison"))).isNotNull(); assertThat(dao.getNullableByKey(session, RuleKey.of("checkstyle", "Unknown"))).isNull(); @@ -132,7 +132,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_by_name() throws Exception { + public void select_by_name() { setupData("select_by_name"); RuleDto ruleDto = dao.getByName("Avoid Null", session); @@ -146,7 +146,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_non_manual() throws Exception { + public void select_non_manual() { setupData("selectNonManual"); List ruleDtos = dao.findByNonManual(session); session.commit(); @@ -297,7 +297,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_parameters() throws Exception { + public void select_parameters() { setupData("selectParameters"); List ruleDtos = dao.findAllRuleParams(session); @@ -311,7 +311,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_parameters_by_rule_id() throws Exception { + public void select_parameters_by_rule_id() { setupData("select_parameters_by_rule_id"); RuleDto rule = dao.getById(session, 1); List ruleDtos = dao.findRuleParamsByRuleKey(session, rule.getKey()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexMediumTest.java index 75d3fed430f..9e27542bbb7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexMediumTest.java @@ -97,7 +97,7 @@ public class RuleIndexMediumTest { } @Test - public void getByKey() throws InterruptedException { + public void getByKey() { RuleDto ruleDto = RuleTesting.newDto(RuleKey.of("javascript", "S001")); dao.insert(dbSession, ruleDto); dbSession.commit(); @@ -115,7 +115,7 @@ public class RuleIndexMediumTest { } @Test - public void getByKey_null_if_not_found() throws InterruptedException { + public void getByKey_null_if_not_found() { Rule rule = index.getNullableByKey(RuleKey.of("javascript", "unknown")); assertThat(rule).isNull(); @@ -269,7 +269,7 @@ public class RuleIndexMediumTest { } @Test - public void search_all_rules() throws InterruptedException { + public void search_all_rules() { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("javascript", "S001"))); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S002"))); dbSession.commit(); @@ -281,7 +281,7 @@ public class RuleIndexMediumTest { } @Test - public void scroll_all_rules() throws InterruptedException { + public void scroll_all_rules() { int max = 100; for (int i = 0; i < max; i++) { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "scroll_" + i))); @@ -304,7 +304,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_has_debt_characteristic() throws InterruptedException { + public void search_by_has_debt_characteristic() { CharacteristicDto char1 = DebtTesting.newCharacteristicDto("c1") .setEnabled(true) .setName("char1"); @@ -349,7 +349,7 @@ public class RuleIndexMediumTest { } @Test - public void facet_on_debt_characteristic() throws InterruptedException { + public void facet_on_debt_characteristic() { CharacteristicDto char1 = DebtTesting.newCharacteristicDto("c1") .setEnabled(true) .setName("char1"); @@ -460,7 +460,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_any_of_languages() throws InterruptedException { + public void search_by_any_of_languages() { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001")).setLanguage("java"), RuleTesting.newDto(RuleKey.of("javascript", "S002")).setLanguage("js")); @@ -486,7 +486,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_characteristics() throws InterruptedException { + public void search_by_characteristics() { CharacteristicDto char1 = DebtTesting.newCharacteristicDto("RELIABILITY"); db.debtCharacteristicDao().insert(char1, dbSession); @@ -540,7 +540,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_characteristics_with_default_and_overridden_char() throws InterruptedException { + public void search_by_characteristics_with_default_and_overridden_char() { CharacteristicDto char1 = DebtTesting.newCharacteristicDto("RELIABILITY"); db.debtCharacteristicDao().insert(char1, dbSession); @@ -608,7 +608,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_any_of_severities() throws InterruptedException { + public void search_by_any_of_severities() { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001")).setSeverity(Severity.BLOCKER)); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S002")).setSeverity(Severity.INFO)); dbSession.commit(); @@ -632,7 +632,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_any_of_statuses() throws InterruptedException { + public void search_by_any_of_statuses() { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001")).setStatus(RuleStatus.BETA)); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S002")).setStatus(RuleStatus.READY)); dbSession.commit(); @@ -678,7 +678,7 @@ public class RuleIndexMediumTest { } @Test - public void fail_sort_by_language() throws InterruptedException { + public void fail_sort_by_language() { try { // Sorting on a field not tagged as sortable new RuleQuery().setSortField(RuleNormalizer.RuleField.LANGUAGE); @@ -689,7 +689,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_profile() throws InterruptedException { + public void search_by_profile() { QualityProfileDto qualityProfileDto1 = QProfileTesting.newXooP1(); QualityProfileDto qualityProfileDto2 = QProfileTesting.newXooP2(); db.qualityProfileDao().insert(dbSession, qualityProfileDto1, qualityProfileDto2); @@ -734,7 +734,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_profile_and_inheritance() throws InterruptedException { + public void search_by_profile_and_inheritance() { QualityProfileDto qualityProfileDto1 = QProfileTesting.newXooP1(); QualityProfileDto qualityProfileDto2 = QProfileTesting.newXooP2().setParentKee(QProfileTesting.XOO_P1_KEY); db.qualityProfileDao().insert(dbSession, qualityProfileDto1, qualityProfileDto2); @@ -835,7 +835,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_profile_and_active_severity() throws InterruptedException { + public void search_by_profile_and_active_severity() { QualityProfileDto qualityProfileDto1 = QProfileTesting.newXooP1(); QualityProfileDto qualityProfileDto2 = QProfileTesting.newXooP2(); db.qualityProfileDao().insert(dbSession, qualityProfileDto1, qualityProfileDto2); @@ -874,7 +874,7 @@ public class RuleIndexMediumTest { } @Test - public void complex_param_value() throws InterruptedException { + public void complex_param_value() { String value = "//expression[primary/qualifiedIdentifier[count(IDENTIFIER) = 2]/IDENTIFIER[2]/@tokenValue = 'firstOf' and primary/identifierSuffix/arguments/expression[not(primary) or primary[not(qualifiedIdentifier) or identifierSuffix]]]"; QualityProfileDto profile = QProfileTesting.newXooP1(); @@ -896,7 +896,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_tag() throws InterruptedException { + public void search_by_tag() { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001")).setTags(ImmutableSet.of("tag1"))); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S002")).setTags(ImmutableSet.of("tag2"))); dbSession.commit(); @@ -938,7 +938,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_is_template() throws InterruptedException { + public void search_by_is_template() { dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001")).setIsTemplate(false)); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S002")).setIsTemplate(true)); dbSession.commit(); @@ -968,7 +968,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_template_key() throws InterruptedException { + public void search_by_template_key() { RuleDto templateRule = RuleTesting.newDto(RuleKey.of("java", "S001")).setIsTemplate(true); dao.insert(dbSession, templateRule); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001_MY_CUSTOM")).setTemplateId(templateRule.getId())); @@ -992,7 +992,7 @@ public class RuleIndexMediumTest { } @Test - public void search_by_template_key_with_params() throws InterruptedException { + public void search_by_template_key_with_params() { RuleDto templateRule = RuleTesting.newDto(RuleKey.of("java", "S001")).setIsTemplate(true); RuleParamDto ruleParamDto = RuleParamDto.createFor(templateRule).setName("regex").setType("STRING").setDescription("Reg ex").setDefaultValue(".*"); dao.insert(dbSession, templateRule); @@ -1015,7 +1015,7 @@ public class RuleIndexMediumTest { } @Test - public void show_custom_rule() throws InterruptedException { + public void show_custom_rule() { RuleDto templateRule = RuleTesting.newDto(RuleKey.of("java", "S001")).setIsTemplate(true); dao.insert(dbSession, templateRule); dao.insert(dbSession, RuleTesting.newDto(RuleKey.of("java", "S001_MY_CUSTOM")).setTemplateId(templateRule.getId())); @@ -1089,7 +1089,7 @@ public class RuleIndexMediumTest { } @Test - public void scroll_byIds() throws Exception { + public void scroll_byIds() { Set ids = new HashSet(); for (int i = 0; i < 150; i++) { RuleDto rule = RuleTesting.newDto(RuleKey.of("scroll", "r_" + i)); @@ -1102,7 +1102,7 @@ public class RuleIndexMediumTest { } @Test - public void search_protected_chars() throws InterruptedException { + public void search_protected_chars() { String nameWithProtectedChars = "ja#va&sc\"r:ipt"; RuleDto ruleDto = RuleTesting.newXooX1().setName(nameWithProtectedChars); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/CreateActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/CreateActionMediumTest.java index 3e432a78d2f..0bb5e5e4b12 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/CreateActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/CreateActionMediumTest.java @@ -55,7 +55,7 @@ public class CreateActionMediumTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); wsTester = tester.get(WsTester.class); ruleDao = tester.get(RuleDao.class); @@ -118,7 +118,7 @@ public class CreateActionMediumTest { } @Test - public void fail_if_custom_key_and_manual_key_parameters_are_not_set() throws Exception { + public void fail_if_custom_key_and_manual_key_parameters_are_not_set() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/DeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/DeleteActionTest.java index 002da0ff0ca..b5d99e70294 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/DeleteActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/DeleteActionTest.java @@ -40,7 +40,7 @@ public class DeleteActionTest { RuleService ruleService; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new RulesWebService(new DeleteAction(ruleService))); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RuleMappingTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RuleMappingTest.java index a67998be0a4..9bc23ade21a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RuleMappingTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RuleMappingTest.java @@ -38,7 +38,7 @@ public class RuleMappingTest { DebtModel debtModel = mock(DebtModel.class); @Test - public void toQueryOptions_load_all_fields() throws Exception { + public void toQueryOptions_load_all_fields() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); @@ -49,7 +49,7 @@ public class RuleMappingTest { } @Test - public void toQueryOptions_load_only_few_simple_fields() throws Exception { + public void toQueryOptions_load_only_few_simple_fields() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); @@ -64,7 +64,7 @@ public class RuleMappingTest { } @Test - public void toQueryOptions_langName_requires_lang() throws Exception { + public void toQueryOptions_langName_requires_lang() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); @@ -76,7 +76,7 @@ public class RuleMappingTest { } @Test - public void toQueryOptions_debt_requires_group_of_fields() throws Exception { + public void toQueryOptions_debt_requires_group_of_fields() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); @@ -91,7 +91,7 @@ public class RuleMappingTest { } @Test - public void toQueryOptions_html_note_requires_markdown_note() throws Exception { + public void toQueryOptions_html_note_requires_markdown_note() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); @@ -103,7 +103,7 @@ public class RuleMappingTest { } @Test - public void toQueryOptions_debt_characteristics() throws Exception { + public void toQueryOptions_debt_characteristics() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); @@ -116,7 +116,7 @@ public class RuleMappingTest { } @Test - public void toQueryOptions_debt_overloaded() throws Exception { + public void toQueryOptions_debt_overloaded() { RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel); SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "1"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RulesWebServiceMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RulesWebServiceMediumTest.java index 9a45b332a79..f0775422e05 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RulesWebServiceMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/RulesWebServiceMediumTest.java @@ -74,7 +74,7 @@ public class RulesWebServiceMediumTest { int softReliabilityId, hardReliabilityId; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); db = tester.get(DbClient.class); ruleDao = tester.get(RuleDao.class); @@ -88,7 +88,7 @@ public class RulesWebServiceMediumTest { } @Test - public void define() throws Exception { + public void define() { WebService.Context context = new WebService.Context(); ws.define(context); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/ShowActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/ShowActionMediumTest.java index 779487d4e4b..0eb34a9428c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/ShowActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/ShowActionMediumTest.java @@ -57,7 +57,7 @@ public class ShowActionMediumTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); wsTester = tester.get(WsTester.class); ruleService = tester.get(RuleService.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionMediumTest.java index 7ce82055083..2db2133379a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionMediumTest.java @@ -56,7 +56,7 @@ public class UpdateActionMediumTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); wsTester = tester.get(WsTester.class); ruleService = tester.get(RuleService.class); @@ -102,7 +102,7 @@ public class UpdateActionMediumTest { } @Test - public void fail_to_update_custom_when_description_is_empty() throws Exception { + public void fail_to_update_custom_when_description_is_empty() { MockUserSession.set() .setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN) .setLogin("me"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/BaseDocTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/BaseDocTest.java index 82b6a5e3e74..0a81ff6425b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/BaseDocTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/BaseDocTest.java @@ -32,7 +32,7 @@ import static org.junit.Assert.fail; public class BaseDocTest { @Test - public void getField() throws Exception { + public void getField() { Map fields = Maps.newHashMap(); fields.put("a_string", "foo"); fields.put("a_int", 42); @@ -46,7 +46,7 @@ public class BaseDocTest { } @Test - public void getField_fails_if_missing_field() throws Exception { + public void getField_fails_if_missing_field() { Map fields = Collections.emptyMap(); BaseDoc doc = new BaseDoc(fields) { }; @@ -60,7 +60,7 @@ public class BaseDocTest { } @Test - public void getFieldAsDate() throws Exception { + public void getFieldAsDate() { BaseDoc doc = new BaseDoc(Maps.newHashMap()) { }; long now = System.currentTimeMillis(); @@ -72,7 +72,7 @@ public class BaseDocTest { } @Test - public void getNullableFieldAsDate() throws Exception { + public void getNullableFieldAsDate() { BaseDoc doc = new BaseDoc(Maps.newHashMap()) { }; long now = System.currentTimeMillis(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/BaseIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/BaseIndexTest.java index 6d772538a17..9a0249aa888 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/BaseIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/BaseIndexTest.java @@ -44,7 +44,7 @@ public class BaseIndexTest { SearchClient searchClient; @Before - public void setup() throws IOException { + public void setup() { EsServerHolder holder = EsServerHolder.get(); Settings settings = new Settings(); settings.setProperty(ProcessProperties.CLUSTER_ACTIVATE, false); @@ -56,7 +56,7 @@ public class BaseIndexTest { } @After - public void tearDown() throws Exception { + public void tearDown() { if (searchClient != null) { searchClient.stop(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/FacetsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/FacetsMediumTest.java index 579ec6da2a4..80eb1bb18eb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/FacetsMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/FacetsMediumTest.java @@ -50,12 +50,12 @@ public class FacetsMediumTest { public static EsTester esTester = new EsTester().addDefinitions(new FacetsTestDefinition()); @Before - public void setUp() throws Exception { + public void setUp() { esTester.truncateIndices(); } @Test - public void should_ignore_result_without_aggregations() throws Exception { + public void should_ignore_result_without_aggregations() { Facets facets = new Facets(mock(SearchResponse.class)); assertThat(facets.getFacets()).isEmpty(); assertThat(facets.getFacetKeys("polop")).isEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/QueryContextTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/QueryContextTest.java index bdf59fb6822..f08ad8f41d3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/QueryContextTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/QueryContextTest.java @@ -35,19 +35,19 @@ public class QueryContextTest { QueryContext options; @Before - public void setUp() throws Exception { + public void setUp() { MockUserSession.set().setLogin("john").setUserGroups("sonar-users"); options = new QueryContext(); } @Test - public void user_and_groups() throws Exception { + public void user_and_groups() { assertThat(options.getUserLogin()).isEqualTo("john"); assertThat(options.getUserGroups()).containsOnly("sonar-users", "Anyone"); } @Test - public void page_shortcut_for_limit_and_offset() throws Exception { + public void page_shortcut_for_limit_and_offset() { options.setPage(3, 10); assertThat(options.getLimit()).isEqualTo(10); @@ -55,7 +55,7 @@ public class QueryContextTest { } @Test - public void page_starts_at_one() throws Exception { + public void page_starts_at_one() { options.setPage(1, 10); assertThat(options.getLimit()).isEqualTo(10); assertThat(options.getOffset()).isEqualTo(0); @@ -63,7 +63,7 @@ public class QueryContextTest { } @Test - public void with_zero_page_size() throws Exception { + public void with_zero_page_size() { options.setPage(1, 0); assertThat(options.getLimit()).isEqualTo(0); assertThat(options.getOffset()).isEqualTo(0); @@ -71,7 +71,7 @@ public class QueryContextTest { } @Test - public void page_must_be_strictly_positive() throws Exception { + public void page_must_be_strictly_positive() { try { options.setPage(0, 10); fail(); @@ -81,7 +81,7 @@ public class QueryContextTest { } @Test - public void page_size_must_be_positive() throws Exception { + public void page_size_must_be_positive() { try { options.setPage(2, -1); fail(); @@ -91,7 +91,7 @@ public class QueryContextTest { } @Test - public void max_limit() throws Exception { + public void max_limit() { options.setLimit(42); assertThat(options.getLimit()).isEqualTo(42); @@ -100,20 +100,20 @@ public class QueryContextTest { } @Test - public void set_max_limit() throws Exception { + public void set_max_limit() { options.setMaxLimit(); assertThat(options.getLimit()).isEqualTo(QueryContext.MAX_LIMIT); } @Test - public void max_page_size() throws Exception { + public void max_page_size() { options.setPage(3, QueryContext.MAX_LIMIT + 10); assertThat(options.getOffset()).isEqualTo(QueryContext.MAX_LIMIT * 2); assertThat(options.getLimit()).isEqualTo(QueryContext.MAX_LIMIT); } @Test - public void getFieldsToReturn() throws Exception { + public void getFieldsToReturn() { assertThat(options.getFieldsToReturn()).isEmpty(); options.setFieldsToReturn(Arrays.asList("one", "two")); @@ -127,7 +127,7 @@ public class QueryContextTest { } @Test - public void support_immutable_fields() throws Exception { + public void support_immutable_fields() { options.setFieldsToReturn(ImmutableList.of("one", "two")); assertThat(options.getFieldsToReturn()).containsOnly("one", "two"); @@ -139,7 +139,7 @@ public class QueryContextTest { } @Test - public void do_not_request_facets_by_default() throws Exception { + public void do_not_request_facets_by_default() { assertThat(options.isFacet()).isFalse(); options.addFacets(Arrays.asList("polop")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/SearchClientMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/SearchClientMediumTest.java index 5f0aa3305a4..6682c53e321 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/SearchClientMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/SearchClientMediumTest.java @@ -36,13 +36,13 @@ public class SearchClientMediumTest { SearchClient searchClient; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); searchClient = tester.get(SearchClient.class); } @Test - public void prepare_multi_search_is_not_yet_implemented() throws Exception { + public void prepare_multi_search_is_not_yet_implemented() { try { searchClient.prepareMultiSearch(); fail(); @@ -52,7 +52,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_update_is_not_yet_implemented() throws Exception { + public void prepare_update_is_not_yet_implemented() { try { searchClient.prepareUpdate(); fail(); @@ -69,7 +69,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_delete_is_not_yet_implemented() throws Exception { + public void prepare_delete_is_not_yet_implemented() { try { searchClient.prepareDelete(); fail(); @@ -79,7 +79,7 @@ public class SearchClientMediumTest { } @Test - public void delete_by_query_is_not_supported() throws Exception { + public void delete_by_query_is_not_supported() { try { searchClient.prepareDeleteByQuery(); fail(); @@ -89,7 +89,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_percolate_is_not_yet_implemented() throws Exception { + public void prepare_percolate_is_not_yet_implemented() { try { searchClient.preparePercolate(); fail(); @@ -99,7 +99,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_multi_percolate_is_not_yet_implemented() throws Exception { + public void prepare_multi_percolate_is_not_yet_implemented() { try { searchClient.prepareMultiPercolate(); fail(); @@ -109,7 +109,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_suggest_is_not_yet_implemented() throws Exception { + public void prepare_suggest_is_not_yet_implemented() { try { searchClient.prepareSuggest("index"); fail(); @@ -119,7 +119,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_more_like_this_is_not_yet_implemented() throws Exception { + public void prepare_more_like_this_is_not_yet_implemented() { try { searchClient.prepareMoreLikeThis("index", "tpye", "id"); fail(); @@ -129,7 +129,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_term_vector_is_not_yet_implemented() throws Exception { + public void prepare_term_vector_is_not_yet_implemented() { try { searchClient.prepareTermVector("index", "tpye", "id"); fail(); @@ -139,7 +139,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_multi_term_vectors_is_not_yet_implemented() throws Exception { + public void prepare_multi_term_vectors_is_not_yet_implemented() { try { searchClient.prepareMultiTermVectors(); fail(); @@ -149,7 +149,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_explain_is_not_yet_implemented() throws Exception { + public void prepare_explain_is_not_yet_implemented() { try { searchClient.prepareExplain("index", "tpye", "id"); fail(); @@ -159,7 +159,7 @@ public class SearchClientMediumTest { } @Test - public void prepare_clear_scroll_is_not_yet_implemented() throws Exception { + public void prepare_clear_scroll_is_not_yet_implemented() { try { searchClient.prepareClearScroll(); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/action/DeleteKeyTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/action/DeleteKeyTest.java index b7a587f9da2..13a654ce7f5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/action/DeleteKeyTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/action/DeleteKeyTest.java @@ -39,13 +39,13 @@ public class DeleteKeyTest { Index index; @Before - public void setUp() throws Exception { + public void setUp() { index = mock(Index.class); when(index.getIndexName()).thenReturn(TEST_INDEX.getIndexName()); } @Test - public void get_delete_request() throws Exception { + public void get_delete_request() { String key = "test_key"; DeleteKey deleteAction = new DeleteKey(TEST_INDEX.getIndexType(), key); diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/action/RefreshIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/action/RefreshIndexTest.java index b3eb3e785b2..32cd52992f9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/action/RefreshIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/action/RefreshIndexTest.java @@ -38,13 +38,13 @@ public class RefreshIndexTest { Index index; @Before - public void setUp() throws Exception { + public void setUp() { index = mock(Index.class); when(index.getIndexName()).thenReturn(TEST_INDEX.getIndexName()); } @Test - public void get_delete_request() throws Exception { + public void get_delete_request() { RefreshIndex refreshAction = new RefreshIndex(TEST_INDEX.getIndexType()); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/search/ws/SearchOptionsTest.java b/server/sonar-server/src/test/java/org/sonar/server/search/ws/SearchOptionsTest.java index e69e22ee157..f30ee445908 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/search/ws/SearchOptionsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/search/ws/SearchOptionsTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.when; public class SearchOptionsTest { @Test - public void create_from_http_request() throws Exception { + public void create_from_http_request() { SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "3"); request.setParam("ps", "10"); @@ -53,7 +53,7 @@ public class SearchOptionsTest { } @Test - public void hasField() throws Exception { + public void hasField() { SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "3"); request.setParam("ps", "10"); @@ -65,7 +65,7 @@ public class SearchOptionsTest { } @Test - public void hasField_always_true_by_default() throws Exception { + public void hasField_always_true_by_default() { SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "3"); request.setParam("ps", "10"); @@ -75,7 +75,7 @@ public class SearchOptionsTest { } @Test - public void hasField_no_if_empty_value() throws Exception { + public void hasField_no_if_empty_value() { SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "3"); request.setParam("ps", "10"); @@ -86,7 +86,7 @@ public class SearchOptionsTest { } @Test - public void write_statistics_to_json_response() throws Exception { + public void write_statistics_to_json_response() { SimpleGetRequest request = new SimpleGetRequest(); request.setParam("p", "3"); request.setParam("ps", "10"); @@ -105,7 +105,7 @@ public class SearchOptionsTest { } @Test - public void defineFieldsParam() throws Exception { + public void defineFieldsParam() { WebService.Context context = new WebService.Context(); new WebService() { @Override @@ -125,7 +125,7 @@ public class SearchOptionsTest { } @Test - public void definePageParams() throws Exception { + public void definePageParams() { WebService.Context context = new WebService.Context(); new WebService() { @Override diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/DecorationDataHolderTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/DecorationDataHolderTest.java index 147813f98f1..985e72b76f4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/DecorationDataHolderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/DecorationDataHolderTest.java @@ -42,7 +42,7 @@ public class DecorationDataHolderTest { } @Test - public void should_extract_lower_bounds_from_serialized_rules() throws Exception { + public void should_extract_lower_bounds_from_serialized_rules() { List openingTagsEntries = decorationDataHolder.getOpeningTagsEntries(); @@ -58,7 +58,7 @@ public class DecorationDataHolderTest { } @Test - public void should_extract_upper_bounds_from_serialized_rules() throws Exception { + public void should_extract_upper_bounds_from_serialized_rules() { List offsets = decorationDataHolder.getClosingTagsOffsets(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/HtmlTextDecoratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/HtmlTextDecoratorTest.java index 9f21bfff3fd..4d2ab618fbc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/HtmlTextDecoratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/HtmlTextDecoratorTest.java @@ -31,7 +31,7 @@ import static org.sonar.server.source.HtmlTextDecorator.LF_END_OF_LINE; public class HtmlTextDecoratorTest { @Test - public void should_decorate_simple_character_range() throws Exception { + public void should_decorate_simple_character_range() { String packageDeclaration = "package org.sonar.core.source;"; @@ -45,7 +45,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_decorate_multiple_lines_characters_range() throws Exception { + public void should_decorate_multiple_lines_characters_range() { String firstCommentLine = "/*"; String secondCommentLine = " * Test"; @@ -70,7 +70,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_highlight_multiple_words_in_one_line() throws Exception { + public void should_highlight_multiple_words_in_one_line() { String classDeclaration = "public class MyClass implements MyInterface {"; @@ -87,7 +87,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_allow_multiple_levels_highlighting() throws Exception { + public void should_allow_multiple_levels_highlighting() { String javaDocSample = "/**" + LF_END_OF_LINE + @@ -117,7 +117,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_support_crlf_line_breaks() throws Exception { + public void should_support_crlf_line_breaks() { String crlfCodeSample = "/**" + CR_END_OF_LINE + LF_END_OF_LINE + @@ -147,7 +147,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_close_tags_at_end_of_file() throws Exception { + public void should_close_tags_at_end_of_file() { String classDeclarationSample = "/*" + LF_END_OF_LINE + @@ -174,7 +174,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_escape_markup_chars() throws Exception { + public void should_escape_markup_chars() { String javadocWithHtml = "/**\n" + @@ -211,7 +211,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_escape_ampersand_char() throws Exception { + public void should_escape_ampersand_char() { String javadocWithAmpersandChar = "/**\n" + @@ -242,7 +242,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_support_cr_line_breaks() throws Exception { + public void should_support_cr_line_breaks() { String crCodeSample = "/**" + CR_END_OF_LINE + @@ -273,7 +273,7 @@ public class HtmlTextDecoratorTest { } @Test - public void should_support_multiple_empty_lines_at_end_of_file() throws Exception { + public void should_support_multiple_empty_lines_at_end_of_file() { String classDeclarationSample = "/*" + LF_END_OF_LINE + @@ -303,7 +303,7 @@ public class HtmlTextDecoratorTest { } @Test - public void returned_code_begin_from_given_param() throws Exception { + public void returned_code_begin_from_given_param() { String javadocWithHtml = "/**\n" + @@ -339,7 +339,7 @@ public class HtmlTextDecoratorTest { } @Test - public void returned_code_end_to_given_param() throws Exception { + public void returned_code_end_to_given_param() { String javadocWithHtml = "/**\n" + @@ -370,7 +370,7 @@ public class HtmlTextDecoratorTest { } @Test - public void returned_code_is_between_from_and_to_params() throws Exception { + public void returned_code_is_between_from_and_to_params() { String javadocWithHtml = "/**\n" + diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/SourceServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/SourceServiceTest.java index 67cc7e51b49..256f2206e3b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/SourceServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/SourceServiceTest.java @@ -54,12 +54,12 @@ public class SourceServiceTest { SourceService service; @Before - public void setUp() throws Exception { + public void setUp() { service = new SourceService(sourceDecorator, sourceLineIndex); } @Test - public void get_html_lines() throws Exception { + public void get_html_lines() { when(sourceLineIndex.getLines(COMPONENT_UUID, 1, Integer.MAX_VALUE)).thenReturn( Arrays.asList(new SourceLineDoc().setSource("source").setHighlighting("highlight").setSymbols("symbols"))); @@ -69,7 +69,7 @@ public class SourceServiceTest { } @Test - public void get_block_of_lines() throws Exception { + public void get_block_of_lines() { when(sourceLineIndex.getLines(COMPONENT_UUID, 1, Integer.MAX_VALUE)).thenReturn( Arrays.asList(new SourceLineDoc().setSource("source").setHighlighting("highlight").setSymbols("symbols"), @@ -82,7 +82,7 @@ public class SourceServiceTest { } @Test - public void getLinesAsTxt() throws Exception { + public void getLinesAsTxt() { when(sourceLineIndex.getLines(COMPONENT_UUID, 1, Integer.MAX_VALUE)).thenReturn( Arrays.asList( new SourceLineDoc().setSource("line1"), diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/db/FileSourceDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/db/FileSourceDaoTest.java index 7fe56d6dc38..94d1a998130 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/db/FileSourceDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/db/FileSourceDaoTest.java @@ -49,12 +49,12 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void select() throws Exception { + public void select() { setupData("shared"); FileSourceDto fileSourceDto = sut.selectSource("FILE1_UUID"); @@ -69,7 +69,7 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @Test - public void select_data() throws Exception { + public void select_data() { setupData("shared"); InputStreamToStringFunction fn = new InputStreamToStringFunction(); @@ -79,7 +79,7 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @Test - public void select_line_hashes() throws Exception { + public void select_line_hashes() { setupData("shared"); ReaderToStringFunction fn = new ReaderToStringFunction(); @@ -89,7 +89,7 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @Test - public void no_line_hashes_on_unknown_file() throws Exception { + public void no_line_hashes_on_unknown_file() { setupData("shared"); ReaderToStringFunction fn = new ReaderToStringFunction(); @@ -99,7 +99,7 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @Test - public void insert() throws Exception { + public void insert() { setupData("shared"); sut.insert(new FileSourceDto() @@ -117,7 +117,7 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @Test - public void update() throws Exception { + public void update() { setupData("shared"); sut.update(new FileSourceDto() @@ -135,7 +135,7 @@ public class FileSourceDaoTest extends AbstractDaoTestCase { } @Test - public void update_date_when_updated_date_is_zero() throws Exception { + public void update_date_when_updated_date_is_zero() { setupData("update_date_when_updated_date_is_zero"); sut.updateDateWhenUpdatedDateIsZero(session, "ABCD", 1500000000002L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexDefinitionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexDefinitionTest.java index f33c15c5281..5fef0817afe 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexDefinitionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexDefinitionTest.java @@ -32,7 +32,7 @@ public class SourceLineIndexDefinitionTest { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); @Test - public void define() throws Exception { + public void define() { IndexDefinition def = new SourceLineIndexDefinition(new Settings()); def.define(context); @@ -47,7 +47,7 @@ public class SourceLineIndexDefinitionTest { } @Test - public void enable_cluster() throws Exception { + public void enable_cluster() { Settings settings = new Settings(); settings.setProperty(ProcessProperties.CLUSTER_ACTIVATE, true); IndexDefinition def = new SourceLineIndexDefinition(settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java index 750b1d987a9..ece9adaf88f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexTest.java @@ -82,7 +82,7 @@ public class SourceLineIndexTest { } @Test - public void fail_to_get_line_when_line_is_not_greater_than_0() throws Exception { + public void fail_to_get_line_when_line_is_not_greater_than_0() { try { index.getLine("file1", 0); } catch (Exception e) { @@ -105,7 +105,7 @@ public class SourceLineIndexTest { } @Test - public void fail_to_get_line_on_unknown_file() throws Exception { + public void fail_to_get_line_on_unknown_file() { try { index.getLine("file1", 1); } catch (Exception e) { @@ -134,7 +134,7 @@ public class SourceLineIndexTest { } @Test - public void last_commit_null_when_not_found() throws Exception { + public void last_commit_null_when_not_found() { Date date = index.lastCommitDateOnProject("fake-project-uuid"); assertThat(date).isNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java index 047c30f8e9e..d1c3de5eaaa 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineIndexerTest.java @@ -193,7 +193,7 @@ public class SourceLineIndexerTest { } @Test - public void index_source_lines_with_big_test_data() throws Exception { + public void index_source_lines_with_big_test_data() { Integer bigValue = Short.MAX_VALUE * 2; FileSourceDb.Data.Builder dataBuilder = FileSourceDb.Data.newBuilder(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java index 205e4e4e35a..970166ff20e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/index/SourceLineResultSetIteratorTest.java @@ -141,7 +141,7 @@ public class SourceLineResultSetIteratorTest { } @Test - public void filter_by_date() throws Exception { + public void filter_by_date() { db.prepareDbUnit(getClass(), "shared.xml"); iterator = SourceLineResultSetIterator.create(dbClient, connection, 2000000000000L, null); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/HashActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/HashActionTest.java index b8bdf6771ec..c869d8b0788 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/HashActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/HashActionTest.java @@ -56,7 +56,7 @@ public class HashActionTest { WsTester tester; @Before - public void before() throws Exception { + public void before() { db.truncateTables(); this.session = db.myBatis().openSession(false); @@ -89,7 +89,7 @@ public class HashActionTest { } @Test - public void fail_to_show_hashes_if_file_does_not_exist() throws Exception { + public void fail_to_show_hashes_if_file_does_not_exist() { MockUserSession.set().setLogin("polop").addProjectUuidPermissions(UserRole.USER, PROJECT_UUID); try { WsTester.TestRequest request = tester.newGetRequest("api/sources", "hash").setParam("key", COMPONENT_KEY); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/IndexActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/IndexActionTest.java index 521afdaa870..32dc4aa4b04 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/IndexActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/IndexActionTest.java @@ -62,7 +62,7 @@ public class IndexActionTest { ComponentDto file = ComponentTesting.newFileDto(project); @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.componentDao()).thenReturn(componentDao); when(dbClient.openSession(false)).thenReturn(session); tester = new WsTester(new SourcesWs(new IndexAction(dbClient, sourceService))); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/LinesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/LinesActionTest.java index f8a3825b08e..c1da0aca749 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/LinesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/LinesActionTest.java @@ -72,7 +72,7 @@ public class LinesActionTest { WsTester wsTester; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); @@ -87,7 +87,7 @@ public class LinesActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -163,7 +163,7 @@ public class LinesActionTest { } @Test - public void fail_to_show_source_if_no_source_found() throws Exception { + public void fail_to_show_source_if_no_source_found() { newFile(); MockUserSession.set().setLogin("login").addProjectUuidPermissions(UserRole.CODEVIEWER, PROJECT_UUID); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/RawActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/RawActionTest.java index 7b50c879a40..2f4c27d7296 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/RawActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/RawActionTest.java @@ -61,7 +61,7 @@ public class RawActionTest { ComponentDto file = ComponentTesting.newFileDto(project); @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.componentDao()).thenReturn(componentDao); when(dbClient.openSession(false)).thenReturn(session); tester = new WsTester(new SourcesWs(new RawAction(dbClient, sourceService))); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/ScmActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/ScmActionTest.java index a4e1f6e1c5f..83d87337034 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/ScmActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/ScmActionTest.java @@ -62,7 +62,7 @@ public class ScmActionTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao()); @@ -72,7 +72,7 @@ public class ScmActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/ShowActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/ShowActionTest.java index b8534b38797..55e92cedba6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/ShowActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/ShowActionTest.java @@ -60,7 +60,7 @@ public class ShowActionTest { ComponentDto file = ComponentTesting.newFileDto(project); @Before - public void setUp() throws Exception { + public void setUp() { when(dbClient.componentDao()).thenReturn(componentDao); when(dbClient.openSession(false)).thenReturn(session); tester = new WsTester(new SourcesWs(new ShowAction(sourceService, dbClient))); diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java index 32a7887d33c..dc7022937cc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java @@ -41,7 +41,7 @@ public class SourcesWsTest { WsTester tester = new WsTester(new SourcesWs(showAction, rawAction, linesAction, hashAction, indexAction)); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/sources"); assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("4.2"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java index c5540d8ff9b..aaa29b610a8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRulesTest.java @@ -53,14 +53,14 @@ public class CopyRequirementsFromCharacteristicsToRulesTest { CopyRequirementsFromCharacteristicsToRules service; @Before - public void setUp() throws Exception { + public void setUp() { when(system2.now()).thenReturn(DateUtils.parseDate("2014-03-13").getTime()); dbClient = new DbClient(db.database(), db.myBatis(), new RuleDao(system2), new LoadedTemplateDao(db.myBatis())); service = new CopyRequirementsFromCharacteristicsToRules(dbClient, null); } @Test - public void copy_requirements_from_characteristics_to_rules() throws Exception { + public void copy_requirements_from_characteristics_to_rules() { db.prepareDbUnit(getClass(), "copy_requirements_from_characteristics_to_rules.xml"); service.start(); @@ -72,7 +72,7 @@ public class CopyRequirementsFromCharacteristicsToRulesTest { * SONAR-5335 */ @Test - public void convert_constant_issue_with_coeff_to_constant_issue_with_offset() throws Exception { + public void convert_constant_issue_with_coeff_to_constant_issue_with_offset() { db.prepareDbUnit(getClass(), "convert_constant_issue_with_coeff_to_constant_issue_with_offset.xml"); service.start(); @@ -81,7 +81,7 @@ public class CopyRequirementsFromCharacteristicsToRulesTest { } @Test - public void remove_requirements_data_from_characteristics() throws Exception { + public void remove_requirements_data_from_characteristics() { db.prepareDbUnit(getClass(), "remove_requirements_data_from_characteristics.xml"); service.start(); @@ -90,7 +90,7 @@ public class CopyRequirementsFromCharacteristicsToRulesTest { } @Test - public void do_nothing_when_already_executed() throws Exception { + public void do_nothing_when_already_executed() { db.prepareDbUnit(getClass(), "do_nothing_when_already_executed.xml"); service.start(); @@ -99,7 +99,7 @@ public class CopyRequirementsFromCharacteristicsToRulesTest { } @Test - public void convert_duration() throws Exception { + public void convert_duration() { assertThat(CopyRequirementsFromCharacteristicsToRules.convertDuration(1.0, "h")).isEqualTo("1h"); assertThat(CopyRequirementsFromCharacteristicsToRules.convertDuration(15.0, "d")).isEqualTo("15d"); assertThat(CopyRequirementsFromCharacteristicsToRules.convertDuration(5.0, "min")).isEqualTo("5min"); @@ -115,7 +115,7 @@ public class CopyRequirementsFromCharacteristicsToRulesTest { } @Test - public void is_debt_default_values_same_as_overridden_values() throws Exception { + public void is_debt_default_values_same_as_overridden_values() { assertThat(CopyRequirementsFromCharacteristicsToRules.isDebtDefaultValuesSameAsOverriddenValues(new RuleDto() .setDefaultSubCharacteristicId(1).setSubCharacteristicId(1) .setDefaultRemediationFunction("LINEAR_OFFSET").setRemediationFunction("LINEAR_OFFSET") diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/JdbcDriverDeployerTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/JdbcDriverDeployerTest.java index 642b55c7147..56d686142a5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/JdbcDriverDeployerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/JdbcDriverDeployerTest.java @@ -64,7 +64,7 @@ public class JdbcDriverDeployerTest { } @Test - public void dont_fail_when_medium_test() throws Exception { + public void dont_fail_when_medium_test() { Settings settings = new Settings(); DefaultServerFileSystem fs = mock(DefaultServerFileSystem.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java index 208e9236038..eefc9578ff1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java @@ -46,12 +46,12 @@ public class RegisterDebtModelTest { RegisterDebtModel registerDebtModel; @Before - public void setUp() throws Exception { + public void setUp() { registerDebtModel = new RegisterDebtModel(dao, debtModelBackup); } @Test - public void create_debt_model() throws Exception { + public void create_debt_model() { when(dao.selectEnabledCharacteristics()).thenReturn(Collections.emptyList()); registerDebtModel.start(); @@ -60,7 +60,7 @@ public class RegisterDebtModelTest { } @Test - public void not_create_debt_model_if_already_exists() throws Exception { + public void not_create_debt_model_if_already_exists() { when(dao.selectEnabledCharacteristics()).thenReturn(newArrayList(new CharacteristicDto())); registerDebtModel.start(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterPermissionTemplatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterPermissionTemplatesTest.java index fd8b0eb8271..5fa9a9af0f4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterPermissionTemplatesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/RegisterPermissionTemplatesTest.java @@ -59,7 +59,7 @@ public class RegisterPermissionTemplatesTest { } @Test - public void should_insert_and_register_default_permission_template() throws Exception { + public void should_insert_and_register_default_permission_template() { LoadedTemplateDto expectedTemplate = new LoadedTemplateDto().setKey(PermissionTemplateDto.DEFAULT.getKee()) .setType(LoadedTemplateDto.PERMISSION_TEMPLATE_TYPE); PermissionTemplateDto permissionTemplate = PermissionTemplateDto.DEFAULT.setId(1L); @@ -85,7 +85,7 @@ public class RegisterPermissionTemplatesTest { } @Test - public void should_skip_insertion_and_registration() throws Exception { + public void should_skip_insertion_and_registration() { when(loadedTemplateDao.countByTypeAndKey(LoadedTemplateDto.PERMISSION_TEMPLATE_TYPE, PermissionTemplateDto.DEFAULT.getKee())) .thenReturn(1); @@ -97,7 +97,7 @@ public class RegisterPermissionTemplatesTest { } @Test - public void should_reference_TRK_template_as_default_when_present() throws Exception { + public void should_reference_TRK_template_as_default_when_present() { when(settings.getString(RegisterPermissionTemplates.DEFAULT_PROJECTS_TEMPLATE_PROPERTY)).thenReturn("my_projects_template"); LoadedTemplateDto expectedTemplate = new LoadedTemplateDto().setKey(PermissionTemplateDto.DEFAULT.getKee()) diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java index 21df0bbbe1e..61b09224b25 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java @@ -48,7 +48,7 @@ public class RenameIssueWidgetsTest { public DbTester dbTester = new DbTester(); @Test - public void should_rename_widgets() throws Exception { + public void should_rename_widgets() { dbTester.prepareDbUnit(this.getClass(), "before.xml"); doStart(); @@ -65,7 +65,7 @@ public class RenameIssueWidgetsTest { } @Test - public void should_skip_when_already_executed() throws Exception { + public void should_skip_when_already_executed() { dbTester.prepareDbUnit(this.getClass(), "after.xml"); doStart(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java index e514c411f6b..a90e354e1ad 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/CoverageServiceTest.java @@ -56,14 +56,14 @@ public class CoverageServiceTest { CoverageService service; @Before - public void setUp() throws Exception { + public void setUp() { MyBatis myBatis = mock(MyBatis.class); when(myBatis.openSession(false)).thenReturn(session); service = new CoverageService(myBatis, measureDao, snapshotPerspectives); } @Test - public void check_permission() throws Exception { + public void check_permission() { String projectKey = "org.sonar.sample"; MockUserSession.set().addComponentPermission(UserRole.CODEVIEWER, projectKey, COMPONENT_KEY); @@ -71,7 +71,7 @@ public class CoverageServiceTest { } @Test - public void get_hits_data() throws Exception { + public void get_hits_data() { service.getHits(COMPONENT_KEY, CoverageService.TYPE.UT); verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY); @@ -83,13 +83,13 @@ public class CoverageServiceTest { } @Test - public void not_get_hits_data_if_no_data() throws Exception { + public void not_get_hits_data_if_no_data() { when(measureDao.findByComponentKeyAndMetricKey(eq(session), anyString(), anyString())).thenReturn(null); assertThat(service.getHits(COMPONENT_KEY, CoverageService.TYPE.UT)).isEqualTo(Collections.emptyMap()); } @Test - public void get_conditions_data() throws Exception { + public void get_conditions_data() { service.getConditions(COMPONENT_KEY, CoverageService.TYPE.UT); verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.CONDITIONS_BY_LINE_KEY); @@ -101,7 +101,7 @@ public class CoverageServiceTest { } @Test - public void get_covered_conditions_data() throws Exception { + public void get_covered_conditions_data() { service.getCoveredConditions(COMPONENT_KEY, CoverageService.TYPE.UT); verify(measureDao).findByComponentKeyAndMetricKey(session, COMPONENT_KEY, CoreMetrics.COVERED_CONDITIONS_BY_LINE_KEY); @@ -113,7 +113,7 @@ public class CoverageServiceTest { } @Test - public void get_test_cases_by_lines() throws Exception { + public void get_test_cases_by_lines() { MutableTestable testable = mock(MutableTestable.class); when(snapshotPerspectives.as(MutableTestable.class, COMPONENT_KEY)).thenReturn(testable); @@ -124,7 +124,7 @@ public class CoverageServiceTest { } @Test - public void not_get_test_cases_by_lines_if_no_testable() throws Exception { + public void not_get_test_cases_by_lines_if_no_testable() { when(snapshotPerspectives.as(MutableTestable.class, COMPONENT_KEY)).thenReturn(null); assertThat(service.getTestCases(COMPONENT_KEY, CoverageService.TYPE.UT)).isEqualTo(Collections.emptyMap()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java index 5b841bc2cf7..f64c1e81fac 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/index/TestIndexTest.java @@ -39,7 +39,7 @@ public class TestIndexTest { TestIndex sut = new TestIndex(es.client()); @Before - public void setup() throws Exception { + public void setup() { es.truncateIndices(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/index/TestResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/index/TestResultSetIteratorTest.java index 432e924ec1b..6e08ead1e28 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/index/TestResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/index/TestResultSetIteratorTest.java @@ -138,7 +138,7 @@ public class TestResultSetIteratorTest { } @Test - public void filter_by_date() throws Exception { + public void filter_by_date() { db.prepareDbUnit(getClass(), "shared.xml"); sut = TestResultSetIterator.create(dbClient, connection, 2000000000000L, null); @@ -191,7 +191,7 @@ public class TestResultSetIteratorTest { } } - private static List newFakeTests(int numberOfTests) throws IOException { + private static List newFakeTests(int numberOfTests) { List tests = new ArrayList<>(); for (int i = 1; i <= numberOfTests; i++) { FileSourceDb.Test.Builder test = FileSourceDb.Test.newBuilder() diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsCoveredFilesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsCoveredFilesActionTest.java index 35ab69f33a7..65aa8094bb9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsCoveredFilesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsCoveredFilesActionTest.java @@ -49,7 +49,7 @@ public class TestsCoveredFilesActionTest { private TestIndex testIndex; @Before - public void setUp() throws Exception { + public void setUp() { dbClient = mock(DbClient.class, RETURNS_DEEP_STUBS); testIndex = mock(TestIndex.class, RETURNS_DEEP_STUBS); ws = new WsTester(new TestsWs(new TestsCoveredFilesAction(dbClient, testIndex))); diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsListActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsListActionTest.java index 08e15006bd0..6a33608844e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsListActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsListActionTest.java @@ -56,7 +56,7 @@ public class TestsListActionTest { public static EsTester es = new EsTester().addDefinitions(new TestIndexDefinition(new Settings())); @Before - public void setUp() throws Exception { + public void setUp() { dbClient = new DbClient(db.database(), db.myBatis(), new ComponentDao()); dbSession = dbClient.openSession(false); db.truncateTables(); @@ -67,7 +67,7 @@ public class TestsListActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { dbSession.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java index 590777108bc..b854c9cd419 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/TestsWsTest.java @@ -35,7 +35,7 @@ public class TestsWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new TestsWs( new TestsListAction(mock(DbClient.class), mock(TestIndex.class)), new TestsCoveredFilesAction(mock(DbClient.class), mock(TestIndex.class)))); @@ -43,7 +43,7 @@ public class TestsWsTest { } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("4.4"); assertThat(controller.description()).isNotEmpty(); @@ -51,7 +51,7 @@ public class TestsWsTest { } @Test - public void define_list_action() throws Exception { + public void define_list_action() { WebService.Action action = controller.action("list"); assertThat(action).isNotNull(); assertThat(action.isInternal()).isFalse(); @@ -62,7 +62,7 @@ public class TestsWsTest { } @Test - public void define_covered_files() throws Exception { + public void define_covered_files() { WebService.Action action = controller.action("covered_files"); assertThat(action).isNotNull(); assertThat(action.isInternal()).isFalse(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java index ef43ebf1a4c..1fd3d434827 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java @@ -32,19 +32,19 @@ public class RubyTextServiceTest { RubyTextService text = new RubyTextService(macroInterpreter); @Test - public void interpretMacros() throws Exception { + public void interpretMacros() { text.interpretMacros("text with macros"); verify(macroInterpreter, times(1)).interpret("text with macros"); } @Test - public void markdownToHtml() throws Exception { + public void markdownToHtml() { String html = text.markdownToHtml("some *markdown*"); assertThat(html).isEqualTo("some markdown"); } @Test - public void should_escape_markdown_input() throws Exception { + public void should_escape_markdown_input() { String html = text.markdownToHtml("a > b"); assertThat(html).isEqualTo("a > b"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java index 6697f578d43..acda1ad907c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java @@ -49,7 +49,7 @@ public class JRubyI18nTest { @Before - public void setUp() throws Exception { + public void setUp() { jRubyI18n = new JRubyI18n(i18n, durations); } @@ -70,37 +70,37 @@ public class JRubyI18nTest { } @Test - public void default_locale_should_be_english() throws Exception { + public void default_locale_should_be_english() { assertThat(JRubyI18n.toLocale(null)).isEqualTo(Locale.ENGLISH); } @Test - public void message() throws Exception { + public void message() { jRubyI18n.message("en", "my.key", "default"); verify(i18n).message(any(Locale.class), eq("my.key"), eq("default")); } @Test - public void age_from_now() throws Exception { + public void age_from_now() { Date date = new Date(); jRubyI18n.ageFromNow(date); verify(i18n).ageFromNow(any(Locale.class), eq(date)); } @Test - public void format_work_duration() throws Exception { + public void format_work_duration() { jRubyI18n.formatDuration(Duration.create(10L), "SHORT"); verify(durations).format(any(Locale.class), eq(Duration.create(10L)), eq(Durations.DurationFormat.SHORT)); } @Test - public void format_long_work_duration() throws Exception { + public void format_long_work_duration() { jRubyI18n.formatLongDuration(10L, "SHORT"); verify(durations).format(any(Locale.class), eq(Duration.create(10L)), eq(Durations.DurationFormat.SHORT)); } @Test - public void format_date_time() throws Exception { + public void format_date_time() { Date date = new Date(); jRubyI18n.formatDateTime(date); verify(i18n).formatDateTime(any(Locale.class), eq(date)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java index 60a335023aa..db1cf9f28b0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ViewProxyTest.java @@ -192,7 +192,7 @@ public class ViewProxyTest { } @Test - public void shouldAcceptAvailableMeasuresForNoRequiredMeasures() throws Exception { + public void shouldAcceptAvailableMeasuresForNoRequiredMeasures() { class MyView extends FakeView { MyView() { super("fake"); @@ -204,7 +204,7 @@ public class ViewProxyTest { } @Test - public void shouldAcceptAvailableMeasuresForMandatoryMeasures() throws Exception { + public void shouldAcceptAvailableMeasuresForMandatoryMeasures() { @RequiredMeasures(allOf = {"lines", "ncloc"}) class MyView extends FakeView { MyView() { @@ -218,7 +218,7 @@ public class ViewProxyTest { } @Test - public void shouldAcceptAvailableMeasuresForOneOfNeededMeasures() throws Exception { + public void shouldAcceptAvailableMeasuresForOneOfNeededMeasures() { @RequiredMeasures(anyOf = {"lines", "ncloc"}) class MyView extends FakeView { MyView() { @@ -232,7 +232,7 @@ public class ViewProxyTest { } @Test - public void shouldAcceptAvailableMeasuresForMandatoryAndOneOfNeededMeasures() throws Exception { + public void shouldAcceptAvailableMeasuresForMandatoryAndOneOfNeededMeasures() { @RequiredMeasures(allOf = {"lines", "ncloc"}, anyOf = {"duplications", "duplictated_blocks"}) class MyView extends FakeView { MyView() { diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentNavigationActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentNavigationActionTest.java index 53dcad171ca..fe1bd5d59c9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentNavigationActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentNavigationActionTest.java @@ -90,7 +90,7 @@ public class ComponentNavigationActionTest { private ResourceTypes resourceTypes; @Before - public void before() throws Exception { + public void before() { dbTester.truncateTables(); System2 system = mock(System2.class); @@ -117,7 +117,7 @@ public class ComponentNavigationActionTest { } @After - public void after() throws Exception { + public void after() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java index 18b74d183c4..92adb3f3a38 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java @@ -64,7 +64,7 @@ public class GlobalNavigationActionTest { private ActiveDashboardDao activeDashboardDao; @Before - public void before() throws Exception { + public void before() { dbTester.truncateTables(); userDao = new UserDao(dbTester.myBatis(), mock(System2.class)); @@ -77,7 +77,7 @@ public class GlobalNavigationActionTest { } @After - public void after() throws Exception { + public void after() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/SettingsNavigationActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/SettingsNavigationActionTest.java index 16c9b6ea04c..7be8ff71cf6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/SettingsNavigationActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/SettingsNavigationActionTest.java @@ -50,7 +50,7 @@ public class SettingsNavigationActionTest { private I18n i18n; @Before - public void before() throws Exception { + public void before() { settings = new Settings(); i18n = mock(I18n.class); when(i18n.message(any(Locale.class), anyString(), anyString())).thenAnswer(new Answer() { diff --git a/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java index 0208a7d859c..5b1b2f54b8e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/updatecenter/ws/UpdateCenterWsTest.java @@ -33,12 +33,12 @@ public class UpdateCenterWsTest { WsTester tester; @Before - public void setUp() throws Exception { + public void setUp() { tester = new WsTester(new UpdateCenterWs()); } @Test - public void define_controller() throws Exception { + public void define_controller() { WebService.Controller controller = tester.controller("api/updatecenter"); assertThat(controller).isNotNull(); assertThat(controller.since()).isEqualTo("2.10"); @@ -47,7 +47,7 @@ public class UpdateCenterWsTest { } @Test - public void define_installed_plugins_action() throws Exception { + public void define_installed_plugins_action() { WebService.Controller controller = tester.controller("api/updatecenter"); WebService.Action action = controller.action("installed_plugins"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserServiceTest.java index 142362e3dfd..b2e0de9de51 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/DefaultUserServiceTest.java @@ -59,7 +59,7 @@ public class DefaultUserServiceTest { public ExpectedException thrown = ExpectedException.none(); @Test - public void parse_query() throws Exception { + public void parse_query() { service.find(ImmutableMap.of( "logins", "simon,loic", "includeDeactivated", "true", @@ -91,7 +91,7 @@ public class DefaultUserServiceTest { } @Test - public void self_deactivation_is_not_possible() throws Exception { + public void self_deactivation_is_not_possible() { try { MockUserSession.set().setLogin("simon").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); service.deactivate("simon"); @@ -103,7 +103,7 @@ public class DefaultUserServiceTest { } @Test - public void user_deactivation_requires_admin_permission() throws Exception { + public void user_deactivation_requires_admin_permission() { try { MockUserSession.set().setLogin("simon").setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN); service.deactivate("julien"); @@ -114,14 +114,14 @@ public class DefaultUserServiceTest { } @Test - public void deactivate_user() throws Exception { + public void deactivate_user() { MockUserSession.set().setLogin("simon").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); service.deactivate("julien"); verify(userUpdater).deactivateUserByLogin("julien"); } @Test - public void fail_to_deactivate_when_blank_login() throws Exception { + public void fail_to_deactivate_when_blank_login() { MockUserSession.set().setLogin("simon").setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN); try { service.deactivate(""); @@ -132,7 +132,7 @@ public class DefaultUserServiceTest { } @Test - public void create() throws Exception { + public void create() { Map params = newHashMap(); params.put("login", "john"); params.put("name", "John"); @@ -149,7 +149,7 @@ public class DefaultUserServiceTest { } @Test - public void update() throws Exception { + public void update() { Map params = newHashMap(); params.put("login", "john"); params.put("name", "John"); @@ -171,7 +171,7 @@ public class DefaultUserServiceTest { } @Test - public void update_only_name() throws Exception { + public void update_only_name() { Map params = newHashMap(); params.put("login", "john"); params.put("name", "John"); @@ -186,7 +186,7 @@ public class DefaultUserServiceTest { } @Test - public void update_only_email() throws Exception { + public void update_only_email() { Map params = newHashMap(); params.put("login", "john"); params.put("email", "john@email.com"); @@ -201,7 +201,7 @@ public class DefaultUserServiceTest { } @Test - public void update_only_scm_accounts() throws Exception { + public void update_only_scm_accounts() { Map params = newHashMap(); params.put("login", "john"); params.put("scm_accounts", newArrayList("jn")); @@ -216,7 +216,7 @@ public class DefaultUserServiceTest { } @Test - public void update_only_password() throws Exception { + public void update_only_password() { Map params = newHashMap(); params.put("login", "john"); params.put("password", "1234"); @@ -232,13 +232,13 @@ public class DefaultUserServiceTest { } @Test - public void get_by_login() throws Exception { + public void get_by_login() { service.getByLogin("john"); verify(userIndex).getNullableByLogin("john"); } @Test - public void index() throws Exception { + public void index() { service.index(); verify(userUpdater).index(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java index 090369bb2b2..77a3d8131c5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java @@ -39,13 +39,13 @@ public class GroupMembershipFinderTest { GroupMembershipFinder finder; @Before - public void setUp() throws Exception { + public void setUp() { when(userDao.selectActiveUserByLogin("arthur")).thenReturn(new UserDto().setId(100L).setName("arthur")); finder = new GroupMembershipFinder(userDao, groupMembershipDao); } @Test - public void find() throws Exception { + public void find() { GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").build(); when(groupMembershipDao.selectGroups(eq(query), anyLong(), anyInt(), anyInt())).thenReturn( newArrayList(new GroupMembershipDto().setId(1L).setName("users").setDescription("Users group").setUserId(100L)) @@ -63,7 +63,7 @@ public class GroupMembershipFinderTest { } @Test - public void find_with_paging() throws Exception { + public void find_with_paging() { GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").pageIndex(3).pageSize(10).build(); finder.find(query); @@ -76,7 +76,7 @@ public class GroupMembershipFinderTest { } @Test - public void find_with_paging_having_more_results() throws Exception { + public void find_with_paging_having_more_results() { GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").pageIndex(1).pageSize(2).build(); when(groupMembershipDao.selectGroups(eq(query), anyLong(), anyInt(), anyInt())).thenReturn(newArrayList( new GroupMembershipDto().setId(1L).setName("group1"), @@ -95,7 +95,7 @@ public class GroupMembershipFinderTest { } @Test - public void find_with_paging_having_no_more_results() throws Exception { + public void find_with_paging_having_no_more_results() { GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").pageIndex(1).pageSize(10).build(); when(groupMembershipDao.selectGroups(eq(query), anyLong(), anyInt(), anyInt())).thenReturn(newArrayList( new GroupMembershipDto().setId(1L).setName("group1"), diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java index 55688bfe10e..2c5b83f6422 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipServiceTest.java @@ -43,7 +43,7 @@ public class GroupMembershipServiceTest extends AbstractDaoTestCase { GroupMembershipService service; @Before - public void before() throws Exception { + public void before() { GroupMembershipDao membershipDao = new GroupMembershipDao(getMyBatis()); UserDao userDao = new UserDao(getMyBatis(), System2.INSTANCE); GroupMembershipFinder finder = new GroupMembershipFinder(userDao, membershipDao); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/RubyUserSessionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/RubyUserSessionTest.java index 6a32744ea58..a435689aa07 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/RubyUserSessionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/RubyUserSessionTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class RubyUserSessionTest { @Test - public void should_set_session() throws Exception { + public void should_set_session() { RubyUserSession.setSession(123, "karadoc", "Karadoc", newArrayList("sonar-users"), "fr"); UserSession session = UserSession.get(); @@ -43,7 +43,7 @@ public class RubyUserSessionTest { } @Test - public void should_set_anonymous_session() throws Exception { + public void should_set_anonymous_session() { RubyUserSession.setSession(null, null, null, null, "fr"); UserSession session = UserSession.get(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/UserSessionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/UserSessionTest.java index 589ccd36a6e..ec163751110 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/UserSessionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/UserSessionTest.java @@ -45,7 +45,7 @@ public class UserSessionTest { public ExpectedException thrown = ExpectedException.none(); @Test - public void getSession_get_anonymous_by_default() throws Exception { + public void getSession_get_anonymous_by_default() { UserSession.remove(); UserSession session = UserSession.get(); @@ -59,7 +59,7 @@ public class UserSessionTest { } @Test - public void get_session() throws Exception { + public void get_session() { UserSession.set(new UserSession().setUserId(123).setLogin("karadoc").setLocale(Locale.FRENCH)); UserSession session = UserSession.get(); @@ -71,14 +71,14 @@ public class UserSessionTest { } @Test - public void login_should_not_be_empty() throws Exception { + public void login_should_not_be_empty() { UserSession session = new UserSession().setLogin(""); assertThat(session.login()).isNull(); assertThat(session.isLoggedIn()).isFalse(); } @Test - public void has_global_permission() throws Exception { + public void has_global_permission() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao); @@ -90,7 +90,7 @@ public class UserSessionTest { } @Test - public void check_global_Permission_ok() throws Exception { + public void check_global_Permission_ok() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao); @@ -100,7 +100,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_global_Permission_ko() throws Exception { + public void check_global_Permission_ko() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao); @@ -110,7 +110,7 @@ public class UserSessionTest { } @Test - public void has_project_permission() throws Exception { + public void has_project_permission() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao).setUserId(1); when(authorizationDao.selectAuthorizedRootProjectsKeys(1, UserRole.USER)).thenReturn(newArrayList("com.foo:Bar")); @@ -121,7 +121,7 @@ public class UserSessionTest { } @Test - public void has_project_permission_by_uuid() throws Exception { + public void has_project_permission_by_uuid() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao).setUserId(1); when(authorizationDao.selectAuthorizedRootProjectsUuids(1, UserRole.USER)).thenReturn(newArrayList("ABCD")); @@ -132,7 +132,7 @@ public class UserSessionTest { } @Test - public void check_project_permission_ok() throws Exception { + public void check_project_permission_ok() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao).setUserId(1); when(authorizationDao.selectAuthorizedRootProjectsKeys(1, UserRole.USER)).thenReturn(newArrayList("com.foo:Bar")); @@ -141,7 +141,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_project_permission_ko() throws Exception { + public void check_project_permission_ko() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao).setUserId(1); when(authorizationDao.selectAuthorizedRootProjectsKeys(1, UserRole.USER)).thenReturn(newArrayList("com.foo:Bar2")); @@ -150,7 +150,7 @@ public class UserSessionTest { } @Test - public void check_project_uuid_permission_ok() throws Exception { + public void check_project_uuid_permission_ok() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao).setUserId(1); @@ -161,7 +161,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_project_uuid_permission_ko() throws Exception { + public void check_project_uuid_permission_ko() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); UserSession session = new SpyUserSession("marius", authorizationDao).setUserId(1); @@ -172,7 +172,7 @@ public class UserSessionTest { } @Test - public void has_component_permission() throws Exception { + public void has_component_permission() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao, resourceDao).setUserId(1); @@ -187,7 +187,7 @@ public class UserSessionTest { } @Test - public void check_component_key_permission_ok() throws Exception { + public void check_component_key_permission_ok() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao, resourceDao).setUserId(1); @@ -199,7 +199,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_component_key_permission_ko() throws Exception { + public void check_component_key_permission_ko() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao, resourceDao).setUserId(1); @@ -211,7 +211,7 @@ public class UserSessionTest { } @Test - public void check_component_uuid_permission_ok() throws Exception { + public void check_component_uuid_permission_ok() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao,resourceDao).setUserId(1); @@ -225,7 +225,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_component_uuid_permission_ko() throws Exception { + public void check_component_uuid_permission_ko() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao,resourceDao).setUserId(1); @@ -239,7 +239,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_component_key_permission_when_project_not_found() throws Exception { + public void check_component_key_permission_when_project_not_found() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao, resourceDao).setUserId(1); @@ -250,7 +250,7 @@ public class UserSessionTest { } @Test(expected = ForbiddenException.class) - public void check_component_dto_permission_ko() throws Exception { + public void check_component_dto_permission_ko() { AuthorizationDao authorizationDao = mock(AuthorizationDao.class); ResourceDao resourceDao = mock(ResourceDao.class); UserSession session = new SpyUserSession("marius", authorizationDao, resourceDao).setUserId(1); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java index 76185dfce8a..a96cd3b697c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java @@ -93,7 +93,7 @@ public class UserUpdaterTest { @Before - public void setUp() throws Exception { + public void setUp() { db.truncateTables(); es.truncateIndices(); settings = new Settings(); @@ -111,12 +111,12 @@ public class UserUpdaterTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void create_user() throws Exception { + public void create_user() { when(system2.now()).thenReturn(1418215735482L); createDefaultGroup(); @@ -152,7 +152,7 @@ public class UserUpdaterTest { } @Test - public void create_user_with_minimum_fields() throws Exception { + public void create_user_with_minimum_fields() { when(system2.now()).thenReturn(1418215735482L); createDefaultGroup(); @@ -172,7 +172,7 @@ public class UserUpdaterTest { } @Test - public void create_user_with_scm_accounts_containing_blank_or_null_entries() throws Exception { + public void create_user_with_scm_accounts_containing_blank_or_null_entries() { when(system2.now()).thenReturn(1418215735482L); createDefaultGroup(); @@ -187,7 +187,7 @@ public class UserUpdaterTest { } @Test - public void create_user_with_scm_accounts_containing_one_blank_entry() throws Exception { + public void create_user_with_scm_accounts_containing_one_blank_entry() { when(system2.now()).thenReturn(1418215735482L); createDefaultGroup(); @@ -202,7 +202,7 @@ public class UserUpdaterTest { } @Test - public void create_user_with_scm_accounts_containing_duplications() throws Exception { + public void create_user_with_scm_accounts_containing_duplications() { when(system2.now()).thenReturn(1418215735482L); createDefaultGroup(); @@ -217,7 +217,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_missing_login() throws Exception { + public void fail_to_create_user_with_missing_login() { try { userUpdater.create(NewUser.create() .setLogin(null) @@ -232,7 +232,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_invalid_login() throws Exception { + public void fail_to_create_user_with_invalid_login() { try { userUpdater.create(NewUser.create() .setLogin("/marius/") @@ -247,7 +247,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_too_short_login() throws Exception { + public void fail_to_create_user_with_too_short_login() { try { userUpdater.create(NewUser.create() .setLogin("ma") @@ -262,7 +262,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_too_long_login() throws Exception { + public void fail_to_create_user_with_too_long_login() { try { userUpdater.create(NewUser.create() .setLogin(Strings.repeat("m", 256)) @@ -277,7 +277,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_missing_name() throws Exception { + public void fail_to_create_user_with_missing_name() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -292,7 +292,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_too_long_name() throws Exception { + public void fail_to_create_user_with_too_long_name() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -307,7 +307,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_too_long_email() throws Exception { + public void fail_to_create_user_with_too_long_email() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -322,7 +322,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_missing_password() throws Exception { + public void fail_to_create_user_with_missing_password() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -337,7 +337,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_missing_password_confirmation() throws Exception { + public void fail_to_create_user_with_missing_password_confirmation() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -352,7 +352,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_password_not_matching_password_confirmation() throws Exception { + public void fail_to_create_user_with_password_not_matching_password_confirmation() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -367,7 +367,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_with_many_errors() throws Exception { + public void fail_to_create_user_with_many_errors() { try { userUpdater.create(NewUser.create() .setLogin("") @@ -382,7 +382,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_when_scm_account_is_already_used() throws Exception { + public void fail_to_create_user_when_scm_account_is_already_used() { db.prepareDbUnit(getClass(), "fail_to_create_user_when_scm_account_is_already_used.xml"); try { @@ -400,7 +400,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_when_scm_account_is_already_used_by_many_user() throws Exception { + public void fail_to_create_user_when_scm_account_is_already_used_by_many_user() { db.prepareDbUnit(getClass(), "fail_to_create_user_when_scm_account_is_already_used_by_many_user.xml"); try { @@ -418,7 +418,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_when_scm_account_is_user_login() throws Exception { + public void fail_to_create_user_when_scm_account_is_user_login() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -434,7 +434,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_create_user_when_scm_account_is_user_email() throws Exception { + public void fail_to_create_user_when_scm_account_is_user_email() { try { userUpdater.create(NewUser.create() .setLogin("marius") @@ -450,7 +450,7 @@ public class UserUpdaterTest { } @Test - public void notify_new_user() throws Exception { + public void notify_new_user() { createDefaultGroup(); userUpdater.create(NewUser.create() @@ -468,7 +468,7 @@ public class UserUpdaterTest { } @Test - public void associate_default_group_when_creating_user() throws Exception { + public void associate_default_group_when_creating_user() { createDefaultGroup(); userUpdater.create(NewUser.create() @@ -486,7 +486,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_associate_default_group_to_user_if_no_default_group() throws Exception { + public void fail_to_associate_default_group_to_user_if_no_default_group() { settings.setProperty(CoreProperties.CORE_DEFAULT_GROUP, (String) null); try { @@ -503,7 +503,7 @@ public class UserUpdaterTest { } @Test - public void reactivate_user_when_creating_user_with_existing_login() throws Exception { + public void reactivate_user_when_creating_user_with_existing_login() { db.prepareDbUnit(getClass(), "reactivate_user.xml"); when(system2.now()).thenReturn(1418215735486L); createDefaultGroup(); @@ -531,7 +531,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_reactivate_user_if_not_disabled() throws Exception { + public void fail_to_reactivate_user_if_not_disabled() { db.prepareDbUnit(getClass(), "fail_to_reactivate_user_if_not_disabled.xml"); createDefaultGroup(); @@ -549,7 +549,7 @@ public class UserUpdaterTest { } @Test - public void associate_default_groups_when_reactivating_user() throws Exception { + public void associate_default_groups_when_reactivating_user() { db.prepareDbUnit(getClass(), "associate_default_groups_when_reactivating_user.xml"); createDefaultGroup(); @@ -568,7 +568,7 @@ public class UserUpdaterTest { } @Test - public void update_user() throws Exception { + public void update_user() { db.prepareDbUnit(getClass(), "update_user.xml"); when(system2.now()).thenReturn(1418215735486L); createDefaultGroup(); @@ -603,7 +603,7 @@ public class UserUpdaterTest { } @Test - public void update_user_with_scm_accounts_containing_blank_entry() throws Exception { + public void update_user_with_scm_accounts_containing_blank_entry() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -621,7 +621,7 @@ public class UserUpdaterTest { } @Test - public void update_only_user_name() throws Exception { + public void update_only_user_name() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -641,7 +641,7 @@ public class UserUpdaterTest { } @Test - public void update_only_user_email() throws Exception { + public void update_only_user_email() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -661,7 +661,7 @@ public class UserUpdaterTest { } @Test - public void update_only_scm_accounts() throws Exception { + public void update_only_scm_accounts() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -681,7 +681,7 @@ public class UserUpdaterTest { } @Test - public void update_scm_accounts_with_same_values() throws Exception { + public void update_scm_accounts_with_same_values() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -695,7 +695,7 @@ public class UserUpdaterTest { } @Test - public void remove_scm_accounts() throws Exception { + public void remove_scm_accounts() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -709,7 +709,7 @@ public class UserUpdaterTest { } @Test - public void update_only_user_password() throws Exception { + public void update_only_user_password() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -730,7 +730,7 @@ public class UserUpdaterTest { } @Test - public void associate_default_group_when_updating_user() throws Exception { + public void associate_default_group_when_updating_user() { db.prepareDbUnit(getClass(), "associate_default_groups_when_updating_user.xml"); createDefaultGroup(); @@ -749,7 +749,7 @@ public class UserUpdaterTest { } @Test - public void not_associate_default_group_when_updating_user_if_already_existing() throws Exception { + public void not_associate_default_group_when_updating_user_if_already_existing() { db.prepareDbUnit(getClass(), "not_associate_default_group_when_updating_user_if_already_existing.xml"); settings.setProperty(CoreProperties.CORE_DEFAULT_GROUP, "sonar-users"); session.commit(); @@ -776,7 +776,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_update_user_when_scm_account_is_already_used() throws Exception { + public void fail_to_update_user_when_scm_account_is_already_used() { db.prepareDbUnit(getClass(), "fail_to_update_user_when_scm_account_is_already_used.xml"); createDefaultGroup(); @@ -794,7 +794,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_update_user_when_scm_account_is_user_login() throws Exception { + public void fail_to_update_user_when_scm_account_is_user_login() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -808,7 +808,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_update_user_when_scm_account_is_existing_user_email() throws Exception { + public void fail_to_update_user_when_scm_account_is_existing_user_email() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); @@ -822,7 +822,7 @@ public class UserUpdaterTest { } @Test - public void fail_to_update_user_when_scm_account_is_new_user_email() throws Exception { + public void fail_to_update_user_when_scm_account_is_new_user_email() { db.prepareDbUnit(getClass(), "update_user.xml"); createDefaultGroup(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/db/GroupDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/db/GroupDaoTest.java index 281f65e00ea..744c742b77d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/db/GroupDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/db/GroupDaoTest.java @@ -47,7 +47,7 @@ public class GroupDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -65,7 +65,7 @@ public class GroupDaoTest extends AbstractDaoTestCase { } @Test - public void find_by_user_login() throws Exception { + public void find_by_user_login() { setupData("find_by_user_login"); assertThat(dao.findByUserLogin(session, "john")).hasSize(2); @@ -73,7 +73,7 @@ public class GroupDaoTest extends AbstractDaoTestCase { } @Test - public void insert() throws Exception { + public void insert() { when(system2.now()).thenReturn(DateUtils.parseDate("2014-09-08").getTime()); setupData("empty"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/db/UserDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/db/UserDaoTest.java index 3393ca9075f..1de7629233e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/db/UserDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/db/UserDaoTest.java @@ -48,7 +48,7 @@ public class UserDaoTest { private DbSession session; @Before - public void before() throws Exception { + public void before() { db.truncateTables(); this.session = db.myBatis().openSession(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/db/UserGroupDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/db/UserGroupDaoTest.java index f1074bd24b3..3be2dd038e5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/db/UserGroupDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/db/UserGroupDaoTest.java @@ -40,7 +40,7 @@ public class UserGroupDaoTest { private DbSession session; @Before - public void before() throws Exception { + public void before() { db.truncateTables(); this.session = db.myBatis().openSession(false); this.dao = new UserGroupDao(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexDefinitionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexDefinitionTest.java index 8de69b73d93..727deb08f3b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexDefinitionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexDefinitionTest.java @@ -32,7 +32,7 @@ public class UserIndexDefinitionTest { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); @Test - public void define() throws Exception { + public void define() { UserIndexDefinition def = new UserIndexDefinition(new Settings()); def.define(context); @@ -47,7 +47,7 @@ public class UserIndexDefinitionTest { } @Test - public void enable_cluster() throws Exception { + public void enable_cluster() { Settings settings = new Settings(); settings.setProperty(ProcessProperties.CLUSTER_ACTIVATE, true); UserIndexDefinition def = new UserIndexDefinition(settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexTest.java index 152393cd7f9..b29a3e37c6f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexTest.java @@ -86,7 +86,7 @@ public class UserIndexTest { } @Test - public void fail_to_get_by_login_on_unknown_user() throws Exception { + public void fail_to_get_by_login_on_unknown_user() { try { index.getByLogin("unknown"); fail(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java index 812b703252a..8a4bf020f7a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java @@ -43,20 +43,20 @@ public class UserIndexerTest { public static EsTester esTester = new EsTester().addDefinitions(new UserIndexDefinition(new Settings())); @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); } @Test - public void index_nothing() throws Exception { + public void index_nothing() { UserIndexer indexer = createIndexer(); indexer.index(); assertThat(esTester.countDocuments(UserIndexDefinition.INDEX, UserIndexDefinition.TYPE_USER)).isEqualTo(0L); } @Test - public void index() throws Exception { + public void index() { dbTester.prepareDbUnit(getClass(), "index.xml"); UserIndexer indexer = createIndexer(); @@ -75,7 +75,7 @@ public class UserIndexerTest { } @Test - public void do_nothing_if_disabled() throws Exception { + public void do_nothing_if_disabled() { dbTester.prepareDbUnit(getClass(), "index.xml"); createIndexer().setEnabled(false).index(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserResultSetIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserResultSetIteratorTest.java index f23bf973a07..ecedc14b5a1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserResultSetIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserResultSetIteratorTest.java @@ -53,12 +53,12 @@ public class UserResultSetIteratorTest { } @After - public void tearDown() throws Exception { + public void tearDown() { DbUtils.closeQuietly(connection); } @Test - public void iterator_over_users() throws Exception { + public void iterator_over_users() { dbTester.prepareDbUnit(getClass(), "shared.xml"); UserResultSetIterator it = UserResultSetIterator.create(client, connection, 0L); Map usersByLogin = Maps.uniqueIndex(it, new Function() { @@ -97,7 +97,7 @@ public class UserResultSetIteratorTest { } @Test - public void select_after_date() throws Exception { + public void select_after_date() { dbTester.prepareDbUnit(getClass(), "shared.xml"); UserResultSetIterator it = UserResultSetIterator.create(client, connection, 1520000000000L); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java index 896c251ad4b..885117eca6f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java @@ -74,7 +74,7 @@ public class ChangePasswordActionTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); @@ -96,7 +96,7 @@ public class ChangePasswordActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java index 8b2a17cb0aa..db4e2b27821 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java @@ -84,7 +84,7 @@ public class CreateActionTest { I18n i18n; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); @@ -107,7 +107,7 @@ public class CreateActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java index 772e91dc61f..d7edbbc6b78 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java @@ -79,7 +79,7 @@ public class DeactivateActionTest { I18n i18n; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); @@ -98,7 +98,7 @@ public class DeactivateActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/FavoritesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/FavoritesWsTest.java index d35d5220e43..0f7717332e3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/FavoritesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/FavoritesWsTest.java @@ -31,7 +31,7 @@ public class FavoritesWsTest { WsTester tester = new WsTester(new FavoritesWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/favorites"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java index 487e5168911..f4537b4ebfb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java @@ -53,7 +53,7 @@ public class GroupsActionTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); System2 system2 = new System2(); @@ -72,7 +72,7 @@ public class GroupsActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java index fa7dfcac236..722f1eaaddf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java @@ -47,7 +47,7 @@ public class SearchActionTest { UserIndex index; @Before - public void setUp() throws Exception { + public void setUp() { esTester.truncateIndices(); index = new UserIndex(esTester.client()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java index 450dd4e2371..a5e893e4a1f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java @@ -72,7 +72,7 @@ public class UpdateActionTest { DbSession session; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); @@ -95,7 +95,7 @@ public class UpdateActionTest { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UserPropertiesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UserPropertiesWsTest.java index 38cf64ef5a3..99da81b1ae4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UserPropertiesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UserPropertiesWsTest.java @@ -31,7 +31,7 @@ public class UserPropertiesWsTest { WsTester tester = new WsTester(new UserPropertiesWs()); @Test - public void define_ws() throws Exception { + public void define_ws() { WebService.Controller controller = tester.controller("api/user_properties"); assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java index 952d26d1cbc..78270a6904b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java @@ -37,7 +37,7 @@ public class UsersWsTest { WebService.Controller controller; @Before - public void setUp() throws Exception { + public void setUp() { WsTester tester = new WsTester(new UsersWs( new CreateAction(mock(UserIndex.class), mock(UserUpdater.class), mock(I18n.class)), new UpdateAction(mock(UserIndex.class), mock(UserUpdater.class)), @@ -48,7 +48,7 @@ public class UsersWsTest { } @Test - public void define_controller() throws Exception { + public void define_controller() { assertThat(controller).isNotNull(); assertThat(controller.description()).isNotEmpty(); assertThat(controller.since()).isEqualTo("3.6"); @@ -56,7 +56,7 @@ public class UsersWsTest { } @Test - public void define_search_action() throws Exception { + public void define_search_action() { WebService.Action action = controller.action("search"); assertThat(action).isNotNull(); assertThat(action.isPost()).isFalse(); @@ -66,7 +66,7 @@ public class UsersWsTest { } @Test - public void define_create_action() throws Exception { + public void define_create_action() { WebService.Action action = controller.action("create"); assertThat(action).isNotNull(); assertThat(action.isPost()).isTrue(); @@ -74,7 +74,7 @@ public class UsersWsTest { } @Test - public void define_update_action() throws Exception { + public void define_update_action() { WebService.Action action = controller.action("update"); assertThat(action).isNotNull(); assertThat(action.isPost()).isTrue(); @@ -82,7 +82,7 @@ public class UsersWsTest { } @Test - public void define_change_password_action() throws Exception { + public void define_change_password_action() { WebService.Action action = controller.action("change_password"); assertThat(action).isNotNull(); assertThat(action.isPost()).isTrue(); @@ -90,7 +90,7 @@ public class UsersWsTest { } @Test - public void define_deactivate_action() throws Exception { + public void define_deactivate_action() { WebService.Action action = controller.action("deactivate"); assertThat(action).isNotNull(); assertThat(action.isPost()).isTrue(); @@ -98,7 +98,7 @@ public class UsersWsTest { } @Test - public void define_current_action() throws Exception { + public void define_current_action() { WebService.Action action = controller.action("current"); assertThat(action).isNotNull(); assertThat(action.isPost()).isFalse(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java index e10d437fe07..4b0293a6eb0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/BooleanTypeValidationTest.java @@ -32,7 +32,7 @@ public class BooleanTypeValidationTest { BooleanTypeValidation validation; @Before - public void setUp() throws Exception { + public void setUp() { validation = new BooleanTypeValidation(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/CloseableIteratorTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/CloseableIteratorTest.java index 672ff885e02..4cfb6efb50e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/CloseableIteratorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/CloseableIteratorTest.java @@ -29,7 +29,7 @@ import static org.junit.Assert.fail; public class CloseableIteratorTest { @Test - public void iterate() throws Exception { + public void iterate() { SimpleCloseableIterator it = new SimpleCloseableIterator(); assertThat(it.isClosed).isFalse(); @@ -54,7 +54,7 @@ public class CloseableIteratorTest { } @Test - public void call_next_without_hasNext() throws Exception { + public void call_next_without_hasNext() { SimpleCloseableIterator it = new SimpleCloseableIterator(); assertThat(it.next()).isEqualTo(1); assertThat(it.next()).isEqualTo(2); @@ -67,7 +67,7 @@ public class CloseableIteratorTest { } @Test - public void automatic_close_if_traversal_error() throws Exception { + public void automatic_close_if_traversal_error() { FailureCloseableIterator it = new FailureCloseableIterator(); try { it.next(); @@ -79,7 +79,7 @@ public class CloseableIteratorTest { } @Test - public void remove_is_not_supported_by_default() throws Exception { + public void remove_is_not_supported_by_default() { SimpleCloseableIterator it = new SimpleCloseableIterator(); try { it.remove(); @@ -90,14 +90,14 @@ public class CloseableIteratorTest { } @Test - public void remove_can_be_overridden() throws Exception { + public void remove_can_be_overridden() { RemovableCloseableIterator it = new RemovableCloseableIterator(); it.remove(); assertThat(it.isRemoved).isTrue(); } @Test - public void has_next_should_not_call_do_next_when_already_closed() throws Exception { + public void has_next_should_not_call_do_next_when_already_closed() { DoNextShouldNotBeCalledWhenClosedIterator it = new DoNextShouldNotBeCalledWhenClosedIterator(); it.next(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/DateCollectorTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/DateCollectorTest.java index 9b7a28d8859..d822686336a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/DateCollectorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/DateCollectorTest.java @@ -29,12 +29,12 @@ public class DateCollectorTest { DateCollector collector = new DateCollector(); @Test - public void max_is_zero_if_no_dates() throws Exception { + public void max_is_zero_if_no_dates() { assertThat(collector.getMax()).isEqualTo(0L); } @Test - public void max() throws Exception { + public void max() { collector.add(DateUtils.parseDate("2013-06-01")); collector.add(null); collector.add(DateUtils.parseDate("2014-01-01")); diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java index 1863814c486..29249d80369 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/FloatTypeValidationTest.java @@ -32,7 +32,7 @@ public class FloatTypeValidationTest { FloatTypeValidation validation; @Before - public void setUp() throws Exception { + public void setUp() { validation = new FloatTypeValidation(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java index 823fae859b1..b4ecdcd8702 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/IntegerTypeValidationTest.java @@ -32,7 +32,7 @@ public class IntegerTypeValidationTest { IntegerTypeValidation validation; @Before - public void setUp() throws Exception { + public void setUp() { validation = new IntegerTypeValidation(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/ProgressLoggerTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/ProgressLoggerTest.java index ec0afe6966b..2ffd1a93d64 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/ProgressLoggerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/ProgressLoggerTest.java @@ -47,7 +47,7 @@ public class ProgressLoggerTest { } @Test - public void create() throws Exception { + public void create() { ProgressLogger progress = ProgressLogger.create(getClass(), new AtomicLong()); // default values diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/RubyUtilsTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/RubyUtilsTest.java index 59174852d8c..79935062d19 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/RubyUtilsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/RubyUtilsTest.java @@ -66,7 +66,7 @@ public class RubyUtilsTest { } @Test - public void toInteger() throws Exception { + public void toInteger() { assertThat(RubyUtils.toInteger(null)).isNull(); assertThat(RubyUtils.toInteger("")).isNull(); assertThat(RubyUtils.toInteger(" ")).isNull(); @@ -76,14 +76,14 @@ public class RubyUtilsTest { } @Test - public void toInteger_unexpected_class() throws Exception { + public void toInteger_unexpected_class() { throwable.expect(IllegalArgumentException.class); RubyUtils.toInteger(1.2); } @Test - public void toDouble() throws Exception { + public void toDouble() { assertThat(RubyUtils.toDouble(null)).isNull(); assertThat(RubyUtils.toDouble("")).isNull(); assertThat(RubyUtils.toDouble(" ")).isNull(); @@ -95,14 +95,14 @@ public class RubyUtilsTest { } @Test - public void toDouble_unexpected_class() throws Exception { + public void toDouble_unexpected_class() { throwable.expect(IllegalArgumentException.class); RubyUtils.toDouble(true); } @Test - public void toBoolean() throws Exception { + public void toBoolean() { assertThat(RubyUtils.toBoolean(null)).isNull(); assertThat(RubyUtils.toBoolean("")).isNull(); assertThat(RubyUtils.toBoolean(" ")).isNull(); @@ -113,14 +113,14 @@ public class RubyUtilsTest { } @Test - public void toBoolean_unexpected_class() throws Exception { + public void toBoolean_unexpected_class() { throwable.expect(IllegalArgumentException.class); RubyUtils.toBoolean(333); } @Test - public void toDate() throws Exception { + public void toDate() { assertThat(RubyUtils.toDate(null)).isNull(); assertThat(RubyUtils.toDate("")).isNull(); assertThat(RubyUtils.toDate(" ")).isNull(); @@ -131,21 +131,21 @@ public class RubyUtilsTest { } @Test - public void toDate_bad_format() throws Exception { + public void toDate_bad_format() { throwable.expect(SonarException.class); RubyUtils.toDate("01/02/2013"); } @Test - public void toDate_unexpected_class() throws Exception { + public void toDate_unexpected_class() { throwable.expect(IllegalArgumentException.class); RubyUtils.toDate(333); } @Test - public void toLong() throws Exception { + public void toLong() { assertThat(RubyUtils.toLong(null)).isNull(); assertThat(RubyUtils.toLong(2)).isEqualTo(2L); assertThat(RubyUtils.toLong(3L)).isEqualTo(3L); @@ -153,7 +153,7 @@ public class RubyUtilsTest { } @Test - public void toLong_unexpected_class() throws Exception { + public void toLong_unexpected_class() { throwable.expect(IllegalArgumentException.class); RubyUtils.toLong(false); diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/SlugTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/SlugTest.java index f6043d19aad..c2fe1f333b1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/SlugTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/SlugTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class SlugTest { @Test - public void slugify() throws Exception { + public void slugify() { assertThat(Slug.slugify("foo")).isEqualTo("foo"); assertThat(Slug.slugify(" FOO ")).isEqualTo("foo"); assertThat(Slug.slugify("he's here")).isEqualTo("he-s-here"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java index 95d56d08eb0..7d728ebd263 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/StringListTypeValidationTest.java @@ -33,7 +33,7 @@ public class StringListTypeValidationTest { StringListTypeValidation validation; @Before - public void setUp() throws Exception { + public void setUp() { validation = new StringListTypeValidation(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java index 76460347386..e1a8cabdffb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/StringTypeValidationTest.java @@ -30,7 +30,7 @@ public class StringTypeValidationTest { StringTypeValidation validation; @Before - public void setUp() throws Exception { + public void setUp() { validation = new StringTypeValidation(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java index 02ce599aa22..d044d166eb5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/TextTypeValidationTest.java @@ -30,7 +30,7 @@ public class TextTypeValidationTest { TextTypeValidation validation; @Before - public void setUp() throws Exception { + public void setUp() { validation = new TextTypeValidation(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java index 36696b0adb8..1d6acfec93e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/TypeValidationsTest.java @@ -31,7 +31,7 @@ import static org.mockito.Mockito.*; public class TypeValidationsTest { @Test - public void validate() throws Exception { + public void validate() { TypeValidation fakeTypeValidation = mock(TypeValidation.class); when(fakeTypeValidation.key()).thenReturn("Fake"); @@ -42,7 +42,7 @@ public class TypeValidationsTest { } @Test - public void validate__multiple_values() throws Exception { + public void validate__multiple_values() { TypeValidation fakeTypeValidation = mock(TypeValidation.class); when(fakeTypeValidation.key()).thenReturn("Fake"); @@ -53,7 +53,7 @@ public class TypeValidationsTest { } @Test - public void fail_on_unknown_type() throws Exception { + public void fail_on_unknown_type() { TypeValidation fakeTypeValidation = mock(TypeValidation.class); when(fakeTypeValidation.key()).thenReturn("Fake"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/cache/DiskCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/cache/DiskCacheTest.java index b4160f6b657..86235edf6de 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/cache/DiskCacheTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/cache/DiskCacheTest.java @@ -66,7 +66,7 @@ public class DiskCacheTest { @Test public void fail_to_serialize() throws Exception { class Unserializable implements Serializable { - private void writeObject(ObjectOutputStream out) throws IOException { + private void writeObject(ObjectOutputStream out) { throw new UnsupportedOperationException("expected error"); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/util/cache/MemoryCacheTest.java b/server/sonar-server/src/test/java/org/sonar/server/util/cache/MemoryCacheTest.java index 56559ba59e9..54f1f2f09e8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/util/cache/MemoryCacheTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/util/cache/MemoryCacheTest.java @@ -38,7 +38,7 @@ public class MemoryCacheTest { MemoryCache cache = new MemoryCache<>(loader); @Test - public void getNullable() throws Exception { + public void getNullable() { when(loader.load("foo")).thenReturn("bar"); assertThat(cache.getNullable("foo")).isEqualTo("bar"); assertThat(cache.getNullable("foo")).isEqualTo("bar"); @@ -54,7 +54,7 @@ public class MemoryCacheTest { } @Test - public void get_throws_exception_if_not_exists() throws Exception { + public void get_throws_exception_if_not_exists() { when(loader.load("foo")).thenReturn("bar"); assertThat(cache.get("foo")).isEqualTo("bar"); assertThat(cache.get("foo")).isEqualTo("bar"); @@ -69,7 +69,7 @@ public class MemoryCacheTest { } @Test - public void getAllNullable() throws Exception { + public void getAllNullable() { // ask for 3 keys but only 2 are available in backed (third key is missing) List keys = Arrays.asList("one", "two", "three"); Map values = new HashMap<>(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexDefinitionTest.java b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexDefinitionTest.java index 9da76180dc8..4fed312ce2b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexDefinitionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexDefinitionTest.java @@ -33,7 +33,7 @@ public class ViewIndexDefinitionTest { IndexDefinition.IndexDefinitionContext context = new IndexDefinition.IndexDefinitionContext(); @Test - public void define() throws Exception { + public void define() { ViewIndexDefinition def = new ViewIndexDefinition(new Settings()); def.define(context); @@ -48,7 +48,7 @@ public class ViewIndexDefinitionTest { } @Test - public void enable_cluster() throws Exception { + public void enable_cluster() { Settings settings = new Settings(); settings.setProperty(ProcessProperties.CLUSTER_ACTIVATE, true); ViewIndexDefinition def = new ViewIndexDefinition(settings); diff --git a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexTest.java index f92bdc0da7b..22bf29dc165 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexTest.java @@ -54,7 +54,7 @@ public class ViewIndexTest { } @Test - public void not_find_all_view_uuids() throws Exception { + public void not_find_all_view_uuids() { List result = newArrayList(index.findAllViewUuids()); assertThat(result).isEmpty(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerMediumTest.java index 3f80f02f695..2fa57a53d62 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerMediumTest.java @@ -70,7 +70,7 @@ public class ViewIndexerMediumTest { IssueIndex index; @Before - public void setUp() throws Exception { + public void setUp() { tester.clearDbAndIndexes(); dbSession = tester.get(DbClient.class).openSession(false); index = tester.get(IssueIndex.class); @@ -83,7 +83,7 @@ public class ViewIndexerMediumTest { } @Test - public void clear_views_lookup_cache_on_index_view_uuid() throws Exception { + public void clear_views_lookup_cache_on_index_view_uuid() { String viewUuid = "ABCD"; RuleDto rule = RuleTesting.newXooX1(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerTest.java index 9656c199948..21db4db9539 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/view/index/ViewIndexerTest.java @@ -51,7 +51,7 @@ public class ViewIndexerTest { ViewIndexer indexer; @Before - public void setUp() throws Exception { + public void setUp() { dbTester.truncateTables(); esTester.truncateIndices(); indexer = new ViewIndexer(new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao()), esTester.client()); @@ -59,13 +59,13 @@ public class ViewIndexerTest { } @Test - public void index_nothing() throws Exception { + public void index_nothing() { indexer.index(); assertThat(esTester.countDocuments(ViewIndexDefinition.INDEX, ViewIndexDefinition.TYPE_VIEW)).isEqualTo(0L); } @Test - public void index() throws Exception { + public void index() { dbTester.prepareDbUnit(getClass(), "index.xml"); indexer.index(); @@ -100,7 +100,7 @@ public class ViewIndexerTest { } @Test - public void index_root_view() throws Exception { + public void index_root_view() { dbTester.prepareDbUnit(getClass(), "index.xml"); indexer.index("EFGH"); @@ -120,7 +120,7 @@ public class ViewIndexerTest { } @Test - public void index_view_doc() throws Exception { + public void index_view_doc() { indexer.index(new ViewDoc().setUuid("EFGH").setProjects(newArrayList("KLMN", "JKLM"))); List docs = esTester.getDocuments("views", "view", ViewDoc.class); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ws/ListingWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/ws/ListingWsTest.java index d4e29d785b7..04a290e4d2a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ws/ListingWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ws/ListingWsTest.java @@ -33,7 +33,7 @@ public class ListingWsTest { ListingWs ws = new ListingWs(); @Test - public void define_ws() throws Exception { + public void define_ws() { WsTester tester = new WsTester(ws); WebService.Controller controller = tester.controller("api/webservices"); assertThat(controller).isNotNull(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ws/ServletRequestTest.java b/server/sonar-server/src/test/java/org/sonar/server/ws/ServletRequestTest.java index c638180c576..719be026417 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ws/ServletRequestTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ws/ServletRequestTest.java @@ -36,34 +36,34 @@ public class ServletRequestTest { HttpServletRequest source = mock(HttpServletRequest.class); @Test - public void call_method() throws Exception { + public void call_method() { ServletRequest request = new ServletRequest(source, Collections.emptyMap()); request.method(); verify(source).getMethod(); } @Test - public void has_param_from_source() throws Exception { + public void has_param_from_source() { when(source.getParameterMap()).thenReturn(ImmutableMap.of("param", new String[]{"value"})); ServletRequest request = new ServletRequest(source, Collections.emptyMap()); assertThat(request.hasParam("param")).isTrue(); } @Test - public void has_param_from_params() throws Exception { + public void has_param_from_params() { ServletRequest request = new ServletRequest(source, ImmutableMap.of("param", "value")); assertThat(request.hasParam("param")).isTrue(); } @Test - public void read_param_from_source() throws Exception { + public void read_param_from_source() { when(source.getParameter("param")).thenReturn("value"); ServletRequest request = new ServletRequest(source, Collections.emptyMap()); assertThat(request.readParam("param")).isEqualTo("value"); } @Test - public void read_param_from_param() throws Exception { + public void read_param_from_param() { ServletRequest request = new ServletRequest(source, ImmutableMap.of("param1", "value", "param2", 1)); assertThat(request.readParam("param1")).isEqualTo("value"); assertThat(request.readParam("param2")).isNull(); @@ -71,7 +71,7 @@ public class ServletRequestTest { } @Test - public void read_input_stream() throws Exception { + public void read_input_stream() { RubyFile file = mock(RubyFile.class); ServletRequest request = new ServletRequest(source, ImmutableMap.of("param1", file, "param2", "value")); request.readInputStreamParam("param1"); @@ -81,7 +81,7 @@ public class ServletRequestTest { } @Test - public void to_string() throws Exception { + public void to_string() { when(source.getRequestURL()).thenReturn(new StringBuffer("http:localhost:9000/api/issues")); ServletRequest request = new ServletRequest(source, Collections.emptyMap()); assertThat(request.toString()).isEqualTo("http:localhost:9000/api/issues"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java b/server/sonar-server/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java index 376842ed5da..3441a74bf73 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ws/WebServiceEngineTest.java @@ -107,13 +107,13 @@ public class WebServiceEngineTest { } @Test - public void load_ws_definitions_at_startup() throws Exception { + public void load_ws_definitions_at_startup() { assertThat(engine.controllers()).hasSize(1); assertThat(engine.controllers().get(0).path()).isEqualTo("api/system"); } @Test - public void execute_request() throws Exception { + public void execute_request() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "health"); @@ -122,7 +122,7 @@ public class WebServiceEngineTest { } @Test - public void no_content() throws Exception { + public void no_content() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "alive"); @@ -131,7 +131,7 @@ public class WebServiceEngineTest { } @Test - public void bad_controller() throws Exception { + public void bad_controller() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/xxx", "health"); @@ -140,7 +140,7 @@ public class WebServiceEngineTest { } @Test - public void bad_action() throws Exception { + public void bad_action() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "xxx"); @@ -149,7 +149,7 @@ public class WebServiceEngineTest { } @Test - public void method_get_not_allowed() throws Exception { + public void method_get_not_allowed() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "ping"); @@ -158,7 +158,7 @@ public class WebServiceEngineTest { } @Test - public void method_post_required() throws Exception { + public void method_post_required() { ValidatingRequest request = new SimpleRequest("POST"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "ping"); @@ -167,7 +167,7 @@ public class WebServiceEngineTest { } @Test - public void unknown_parameter_is_set() throws Exception { + public void unknown_parameter_is_set() { ValidatingRequest request = new SimpleRequest("GET").setParam("unknown", "Unknown"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "fail_with_undeclared_parameter"); @@ -176,7 +176,7 @@ public class WebServiceEngineTest { } @Test - public void required_parameter_is_not_set() throws Exception { + public void required_parameter_is_not_set() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "print"); @@ -185,7 +185,7 @@ public class WebServiceEngineTest { } @Test - public void optional_parameter_is_not_set() throws Exception { + public void optional_parameter_is_not_set() { ValidatingRequest request = new SimpleRequest("GET").setParam("message", "Hello World"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "print"); @@ -194,7 +194,7 @@ public class WebServiceEngineTest { } @Test - public void optional_parameter_is_set() throws Exception { + public void optional_parameter_is_set() { ValidatingRequest request = new SimpleRequest("GET") .setParam("message", "Hello World") .setParam("author", "Marcel"); @@ -205,7 +205,7 @@ public class WebServiceEngineTest { } @Test - public void param_value_is_in_possible_values() throws Exception { + public void param_value_is_in_possible_values() { ValidatingRequest request = new SimpleRequest("GET") .setParam("message", "Hello World") .setParam("format", "json"); @@ -216,7 +216,7 @@ public class WebServiceEngineTest { } @Test - public void param_value_is_not_in_possible_values() throws Exception { + public void param_value_is_not_in_possible_values() { ValidatingRequest request = new SimpleRequest("GET") .setParam("message", "Hello World") .setParam("format", "html"); @@ -227,7 +227,7 @@ public class WebServiceEngineTest { } @Test - public void internal_error() throws Exception { + public void internal_error() { ValidatingRequest request = new SimpleRequest("GET"); ServletResponse response = new ServletResponse(); engine.execute(request, response, "api/system", "fail"); @@ -238,7 +238,7 @@ public class WebServiceEngineTest { } @Test - public void bad_request_with_i18n_message() throws Exception { + public void bad_request_with_i18n_message() { MockUserSession.set().setLocale(Locale.ENGLISH); ValidatingRequest request = new SimpleRequest("GET").setParam("count", "3"); ServletResponse response = new ServletResponse(); @@ -254,7 +254,7 @@ public class WebServiceEngineTest { } @Test - public void bad_request_with_multiple_messages() throws Exception { + public void bad_request_with_multiple_messages() { ValidatingRequest request = new SimpleRequest("GET").setParam("count", "3"); ServletResponse response = new ServletResponse(); @@ -270,7 +270,7 @@ public class WebServiceEngineTest { } @Test - public void bad_request_with_multiple_i18n_messages() throws Exception { + public void bad_request_with_multiple_i18n_messages() { MockUserSession.set().setLocale(Locale.ENGLISH); ValidatingRequest request = new SimpleRequest("GET").setParam("count", "3"); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarClientTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarClientTest.java index 63889f42730..7c1ed06d237 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarClientTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarClientTest.java @@ -111,7 +111,7 @@ public class SonarClientTest { } @Test - public void get() throws Exception { + public void get() { HttpRequestFactory requestFactory = mock(HttpRequestFactory.class); SonarClient client = new SonarClient(requestFactory); @@ -126,7 +126,7 @@ public class SonarClientTest { } @Test - public void post() throws Exception { + public void post() { HttpRequestFactory requestFactory = mock(HttpRequestFactory.class); SonarClient client = new SonarClient(requestFactory); @@ -140,7 +140,7 @@ public class SonarClientTest { } @Test - public void fail_if_odd_number_arguments() throws Exception { + public void fail_if_odd_number_arguments() { HttpRequestFactory requestFactory = mock(HttpRequestFactory.class); SonarClient client = new SonarClient(requestFactory); @@ -153,7 +153,7 @@ public class SonarClientTest { } @Test - public void fail_if_null_property_key() throws Exception { + public void fail_if_null_property_key() { HttpRequestFactory requestFactory = mock(HttpRequestFactory.class); SonarClient client = new SonarClient(requestFactory); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java index c1ff002fa00..930b24569fe 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java @@ -98,7 +98,7 @@ public class SonarTest { } @Test(expected = ConnectionException.class) - public void failWhenConnectionIsClosed() throws Exception { + public void failWhenConnectionIsClosed() { Sonar fakeSonar = Sonar.create("http://localhost:70"); fakeSonar.findAll(MetricQuery.all()); } diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java index 0e790b07650..54bd54782bc 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/internal/HttpRequestFactoryTest.java @@ -123,7 +123,7 @@ public class HttpRequestFactoryTest { } @Test - public void beginning_slash_is_optional() throws Exception { + public void beginning_slash_is_optional() { HttpRequestFactory factory = new HttpRequestFactory(httpServer.url()); factory.get("api/foo", Collections.emptyMap()); assertThat(httpServer.requestedPath()).isEqualTo("/api/foo"); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java index 9621c9878fc..8cb916be1fc 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/internal/DefaultActionPlanClientTest.java @@ -79,7 +79,7 @@ public class DefaultActionPlanClientTest { } @Test - public void should_create_action_plan() throws Exception { + public void should_create_action_plan() { HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url()); httpServer.stubResponseBody("{\"actionPlan\": {\"key\": \"382f6f2e-ad9d-424a-b973-9b065e04348a\"}}"); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/system/internal/DefaultSystemClientTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/system/internal/DefaultSystemClientTest.java index 79c869e5c25..5cc23219504 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/system/internal/DefaultSystemClientTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/system/internal/DefaultSystemClientTest.java @@ -61,7 +61,7 @@ public class DefaultSystemClientTest { } @Test - public void fail_if_rate_is_greater_than_timeout() throws Exception { + public void fail_if_rate_is_greater_than_timeout() { try { DefaultSystemClient client = new DefaultSystemClient(mock(HttpRequestFactory.class)); client.migrate(5L, 50L); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java index 17592ec2909..7fb56905784 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertThat; public class PluginUnmarshallerTest extends UnmarshallerTestCase { @Test - public void toModel() throws Exception { + public void toModel() { WSUtils.setInstance(new JdkUtils()); List plugins = new PluginUnmarshaller().toModels(loadFile("/plugins/plugins.json")); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java index 60d1f1223e6..965d27217bc 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java @@ -52,7 +52,7 @@ public class TimeMachineUnmarshallerTest extends UnmarshallerTestCase { } @Test - public void should_accept_null_values() throws Exception { + public void should_accept_null_values() { TimeMachine timeMachine = new TimeMachineUnmarshaller().toModel(loadFile("/timemachine/null-values.json")); assertThat(timeMachine.getCells()[0].getValues().length).isEqualTo(2); @@ -64,7 +64,7 @@ public class TimeMachineUnmarshallerTest extends UnmarshallerTestCase { } @Test - public void should_cast_values() throws Exception { + public void should_cast_values() { TimeMachine timeMachine = new TimeMachineUnmarshaller().toModel(loadFile("/timemachine/typed-values.json")); assertThat(timeMachine.getCells()[0].getValues().length).isEqualTo(2); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java index e59927c5dde..d521d115053 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/DefaultUserClientTest.java @@ -63,7 +63,7 @@ public class DefaultUserClientTest { } @Test - public void should_create_user() throws Exception { + public void should_create_user() { httpServer.stubResponseBody("{\"user\":{\"login\":\"daveloper\",\"name\":\"daveloper\",\"email\":null}}"); UserParameters params = UserParameters.create().login("daveloper").password("pass1").passwordConfirmation("pass1"); @@ -82,7 +82,7 @@ public class DefaultUserClientTest { } @Test - public void should_update_user() throws Exception { + public void should_update_user() { httpServer.stubResponseBody("{\"user\":{\"login\":\"daveloper\",\"name\":\"daveloper\",\"email\":\"new_email\"}}"); UserParameters params = UserParameters.create().login("daveloper").email("new_email"); @@ -100,7 +100,7 @@ public class DefaultUserClientTest { } @Test - public void should_deactivate_user() throws Exception { + public void should_deactivate_user() { httpServer.stubStatusCode(200); client.deactivate("daveloper"); diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java index 20f4b9893d4..5cad47114ef 100644 --- a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java +++ b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/user/UserQueryTest.java @@ -44,13 +44,13 @@ public class UserQueryTest { } @Test - public void should_replace_logins() throws Exception { + public void should_replace_logins() { UserQuery query = UserQuery.create().logins("simon").logins("loic"); assertThat(query.urlParams().get("logins")).isEqualTo("loic"); } @Test - public void should_search_by_text() throws Exception { + public void should_search_by_text() { UserQuery query = UserQuery.create().searchText("sim"); assertThat(query.urlParams().get("s")).isEqualTo("sim"); diff --git a/sonar-application/src/test/java/org/sonar/application/AppLoggingTest.java b/sonar-application/src/test/java/org/sonar/application/AppLoggingTest.java index fc187f3e4a4..4bc159a7af0 100644 --- a/sonar-application/src/test/java/org/sonar/application/AppLoggingTest.java +++ b/sonar-application/src/test/java/org/sonar/application/AppLoggingTest.java @@ -59,7 +59,7 @@ public class AppLoggingTest { } @Test - public void configure_defaults() throws Exception { + public void configure_defaults() { LoggerContext ctx = sut.configure(props); Logger gobbler = ctx.getLogger(AppLogging.GOBBLER_LOGGER); @@ -72,7 +72,7 @@ public class AppLoggingTest { } @Test - public void configure_no_rotation() throws Exception { + public void configure_no_rotation() { props.set("sonar.log.rollingPolicy", "none"); LoggerContext ctx = sut.configure(props); @@ -83,7 +83,7 @@ public class AppLoggingTest { } @Test - public void copyGobblerToConsole() throws Exception { + public void copyGobblerToConsole() { props.set("sonar.log.console", "true"); LoggerContext ctx = sut.configure(props); diff --git a/sonar-application/src/test/java/org/sonar/application/CommandLineParserTest.java b/sonar-application/src/test/java/org/sonar/application/CommandLineParserTest.java index fa57d8d353d..e2320b7eeda 100644 --- a/sonar-application/src/test/java/org/sonar/application/CommandLineParserTest.java +++ b/sonar-application/src/test/java/org/sonar/application/CommandLineParserTest.java @@ -31,7 +31,7 @@ public class CommandLineParserTest { CommandLineParser parser = new CommandLineParser(); @Test - public void parseArguments() throws Exception { + public void parseArguments() { System.setProperty("CommandLineParserTest.unused", "unused"); System.setProperty("sonar.CommandLineParserTest.used", "used"); @@ -46,7 +46,7 @@ public class CommandLineParserTest { } @Test - public void argumentsToProperties() throws Exception { + public void argumentsToProperties() { Properties p = parser.argumentsToProperties(new String[] {"-Dsonar.foo=bar", "-Dsonar.whitespace=foo bar"}); assertThat(p).hasSize(2); assertThat(p.getProperty("sonar.foo")).isEqualTo("bar"); diff --git a/sonar-application/src/test/java/org/sonar/application/JdbcSettingsTest.java b/sonar-application/src/test/java/org/sonar/application/JdbcSettingsTest.java index d6d575bfad1..9e809a2aeab 100644 --- a/sonar-application/src/test/java/org/sonar/application/JdbcSettingsTest.java +++ b/sonar-application/src/test/java/org/sonar/application/JdbcSettingsTest.java @@ -41,7 +41,7 @@ public class JdbcSettingsTest { JdbcSettings settings = new JdbcSettings(); @Test - public void driver_provider() throws Exception { + public void driver_provider() { assertThat(settings.driverProvider("jdbc:oracle:thin:@localhost/XE")).isEqualTo(JdbcSettings.Provider.ORACLE); assertThat(settings.driverProvider("jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance")) .isEqualTo(JdbcSettings.Provider.MYSQL); @@ -60,7 +60,7 @@ public class JdbcSettingsTest { } @Test - public void check_mysql_parameters() throws Exception { + public void check_mysql_parameters() { // minimal -> ok settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8"); diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/ProtobufUtilTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/ProtobufUtilTest.java index 8084bb2d947..e9e57cf74dd 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/ProtobufUtilTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/ProtobufUtilTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ProtobufUtilTest { @Test - public void only_utils() throws Exception { + public void only_utils() { assertThat(TestUtils.hasOnlyPrivateConstructors(ProtobufUtil.class)); } diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java index fb7c5d46fb0..cda3a633e1a 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GlobalRepositoriesTest { @Test - public void to_json() throws Exception { + public void to_json() { GlobalRepositories ref = new GlobalRepositories(); ref.addMetric(new Metric(1, "ncloc", "INT", "Description", -1, "NCLOC", true, false, 2.0, 1.0, true)); ref.addGlobalSetting("prop", "value"); diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java index 223e997950e..e01cc0d606c 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java @@ -51,7 +51,7 @@ public class BatchReportReaderTest { } @Test - public void read_metadata() throws Exception { + public void read_metadata() { BatchReportWriter writer = new BatchReportWriter(dir); BatchReport.Metadata.Builder metadata = BatchReport.Metadata.newBuilder() .setAnalysisDate(15000000L) @@ -68,12 +68,12 @@ public class BatchReportReaderTest { } @Test(expected = IllegalStateException.class) - public void fail_if_missing_metadata_file() throws Exception { + public void fail_if_missing_metadata_file() { sut.readMetadata(); } @Test - public void read_components() throws Exception { + public void read_components() { BatchReportWriter writer = new BatchReportWriter(dir); BatchReport.Component.Builder component = BatchReport.Component.newBuilder() .setRef(1) @@ -84,12 +84,12 @@ public class BatchReportReaderTest { } @Test(expected = IllegalStateException.class) - public void fail_if_missing_file_on_component() throws Exception { + public void fail_if_missing_file_on_component() { sut.readComponent(UNKNOWN_COMPONENT_REF); } @Test - public void read_issues() throws Exception { + public void read_issues() { BatchReportWriter writer = new BatchReportWriter(dir); BatchReport.Issue issue = BatchReport.Issue.newBuilder() .setUuid("ISSUE_A") @@ -107,17 +107,17 @@ public class BatchReportReaderTest { } @Test(expected = IllegalStateException.class) - public void fail_if_missing_file_on_deleted_component() throws Exception { + public void fail_if_missing_file_on_deleted_component() { sut.readDeletedComponentIssues(UNKNOWN_COMPONENT_REF); } @Test - public void empty_list_if_no_issue_found() throws Exception { + public void empty_list_if_no_issue_found() { assertThat(sut.readComponentIssues(UNKNOWN_COMPONENT_REF)).isEmpty(); } @Test - public void read_measures() throws Exception { + public void read_measures() { BatchReportWriter writer = new BatchReportWriter(dir); BatchReport.Measure.Builder measure = BatchReport.Measure.newBuilder() .setStringValue("value_a"); @@ -128,12 +128,12 @@ public class BatchReportReaderTest { } @Test - public void empty_list_if_no_measure_found() throws Exception { + public void empty_list_if_no_measure_found() { assertThat(sut.readComponentMeasures(UNKNOWN_COMPONENT_REF)).isEmpty(); } @Test - public void read_changesets() throws Exception { + public void read_changesets() { BatchReportWriter writer = new BatchReportWriter(dir); BatchReport.Changesets.Builder scm = BatchReport.Changesets.newBuilder() .setComponentRef(1) @@ -145,12 +145,12 @@ public class BatchReportReaderTest { } @Test - public void null_if_no_changeset_found() throws Exception { + public void null_if_no_changeset_found() { assertThat(sut.readChangesets(UNKNOWN_COMPONENT_REF)).isNull(); } @Test - public void read_duplications() throws Exception { + public void read_duplications() { BatchReportWriter writer = new BatchReportWriter(dir); writer.writeMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1).build()); @@ -180,7 +180,7 @@ public class BatchReportReaderTest { } @Test - public void empty_list_if_no_duplication_found() throws Exception { + public void empty_list_if_no_duplication_found() { assertThat(sut.readComponentDuplications(UNKNOWN_COMPONENT_REF)).isEmpty(); } @@ -213,12 +213,12 @@ public class BatchReportReaderTest { } @Test - public void return_null_if_no_highlighting_found() throws Exception { + public void return_null_if_no_highlighting_found() { assertThat(sut.readComponentSyntaxHighlighting(UNKNOWN_COMPONENT_REF)).isNull(); } @Test - public void read_symbols() throws Exception { + public void read_symbols() { BatchReportWriter writer = new BatchReportWriter(dir); writer.writeMetadata(BatchReport.Metadata.newBuilder() .setRootComponentRef(1) @@ -248,7 +248,7 @@ public class BatchReportReaderTest { } @Test - public void empty_list_if_no_symbol_found() throws Exception { + public void empty_list_if_no_symbol_found() { assertThat(sut.readComponentSymbols(UNKNOWN_COMPONENT_REF)).isEmpty(); } @@ -305,7 +305,7 @@ public class BatchReportReaderTest { } @Test - public void return_null_if_no_coverage_found() throws Exception { + public void return_null_if_no_coverage_found() { assertThat(sut.readComponentCoverage(UNKNOWN_COMPONENT_REF)).isNull(); } @@ -340,7 +340,7 @@ public class BatchReportReaderTest { } @Test - public void null_if_no_test_found() throws Exception { + public void null_if_no_test_found() { assertThat(sut.readTests(UNKNOWN_COMPONENT_REF)).isNull(); } @@ -366,7 +366,7 @@ public class BatchReportReaderTest { } @Test - public void null_if_no_coverage_detail_found() throws Exception { + public void null_if_no_coverage_detail_found() { assertThat(sut.readCoverageDetails(UNKNOWN_COMPONENT_REF)).isNull(); } @@ -388,12 +388,12 @@ public class BatchReportReaderTest { } @Test - public void null_if_no_file_dependencies_found() throws Exception { + public void null_if_no_file_dependencies_found() { assertThat(sut.readFileDependencies(UNKNOWN_COMPONENT_REF)).isNull(); } @Test - public void read_module_dependencies() throws Exception { + public void read_module_dependencies() { BatchReportWriter writer = new BatchReportWriter(dir); writer.writeModuleDependencies(1, Arrays.asList(BatchReport.ModuleDependencies.ModuleDependency.newBuilder() .setKey("PROJECT_1") @@ -415,7 +415,7 @@ public class BatchReportReaderTest { } @Test - public void empty_list_if_no_module_dependencies_found() throws Exception { + public void empty_list_if_no_module_dependencies_found() { assertThat(sut.readModuleDependencies(UNKNOWN_COMPONENT_REF)).isEmpty(); } diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java index 470fe2fc99a..b1d0b677efb 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java @@ -47,7 +47,7 @@ public class BatchReportWriterTest { } @Test - public void create_dir_if_does_not_exist() throws Exception { + public void create_dir_if_does_not_exist() { FileUtils.deleteQuietly(dir); sut = new BatchReportWriter(dir); @@ -55,7 +55,7 @@ public class BatchReportWriterTest { } @Test - public void write_metadata() throws Exception { + public void write_metadata() { BatchReport.Metadata.Builder metadata = BatchReport.Metadata.newBuilder() .setAnalysisDate(15000000L) .setProjectKey("PROJECT_A") @@ -69,7 +69,7 @@ public class BatchReportWriterTest { } @Test - public void write_component() throws Exception { + public void write_component() { // no data yet assertThat(sut.hasComponentData(FileStructure.Domain.COMPONENT, 1)).isFalse(); @@ -97,7 +97,7 @@ public class BatchReportWriterTest { } @Test - public void write_issues() throws Exception { + public void write_issues() { // no data yet assertThat(sut.hasComponentData(FileStructure.Domain.ISSUES, 1)).isFalse(); @@ -120,7 +120,7 @@ public class BatchReportWriterTest { } @Test - public void write_issues_of_deleted_component() throws Exception { + public void write_issues_of_deleted_component() { // no data yet assertThat(sut.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isFalse(); @@ -143,7 +143,7 @@ public class BatchReportWriterTest { } @Test - public void write_measures() throws Exception { + public void write_measures() { assertThat(sut.hasComponentData(FileStructure.Domain.MEASURES, 1)).isFalse(); BatchReport.Measure measure = BatchReport.Measure.newBuilder() @@ -168,7 +168,7 @@ public class BatchReportWriterTest { } @Test - public void write_scm() throws Exception { + public void write_scm() { assertThat(sut.hasComponentData(FileStructure.Domain.CHANGESETS, 1)).isFalse(); BatchReport.Changesets scm = BatchReport.Changesets.newBuilder() @@ -193,7 +193,7 @@ public class BatchReportWriterTest { } @Test - public void write_duplications() throws Exception { + public void write_duplications() { assertThat(sut.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isFalse(); BatchReport.Duplication duplication = BatchReport.Duplication.newBuilder() @@ -223,7 +223,7 @@ public class BatchReportWriterTest { } @Test - public void write_symbols() throws Exception { + public void write_symbols() { // no data yet assertThat(sut.hasComponentData(FileStructure.Domain.SYMBOLS, 1)).isFalse(); @@ -257,7 +257,7 @@ public class BatchReportWriterTest { } @Test - public void write_syntax_highlighting() throws Exception { + public void write_syntax_highlighting() { // no data yet assertThat(sut.hasComponentData(FileStructure.Domain.SYNTAX_HIGHLIGHTINGS, 1)).isFalse(); @@ -275,7 +275,7 @@ public class BatchReportWriterTest { } @Test - public void write_coverage() throws Exception { + public void write_coverage() { // no data yet assertThat(sut.hasComponentData(FileStructure.Domain.COVERAGES, 1)).isFalse(); @@ -295,7 +295,7 @@ public class BatchReportWriterTest { } @Test - public void write_tests() throws Exception { + public void write_tests() { assertThat(sut.hasComponentData(FileStructure.Domain.TESTS, 1)).isFalse(); sut.writeTests(1, Arrays.asList( @@ -307,7 +307,7 @@ public class BatchReportWriterTest { } @Test - public void write_coverage_details() throws Exception { + public void write_coverage_details() { assertThat(sut.hasComponentData(FileStructure.Domain.COVERAGE_DETAILS, 1)).isFalse(); sut.writeCoverageDetails(1, Arrays.asList( @@ -318,7 +318,7 @@ public class BatchReportWriterTest { } @Test - public void write_file_dependencies() throws Exception { + public void write_file_dependencies() { assertThat(sut.hasComponentData(FileStructure.Domain.FILE_DEPENDENCIES, 1)).isFalse(); sut.writeFileDependencies(1, Arrays.asList(BatchReport.FileDependency.getDefaultInstance())); @@ -327,7 +327,7 @@ public class BatchReportWriterTest { } @Test - public void write_module_dependencies() throws Exception { + public void write_module_dependencies() { assertThat(sut.hasComponentData(FileStructure.Domain.MODULE_DEPENDENCIES, 1)).isFalse(); sut.writeModuleDependencies(1, Arrays.asList(BatchReport.ModuleDependencies.ModuleDependency.getDefaultInstance())); diff --git a/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java index 86a866c271e..2062e10f6b0 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java @@ -40,7 +40,7 @@ public class ProjectConfiguratorTest extends AbstractDbUnitTestCase { System2 system2; @Before - public void setUp() throws Exception { + public void setUp() { system2 = mock(System2.class); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java index 97402b8a913..e0ea0d6a440 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java @@ -85,7 +85,7 @@ public class DatabaseCompatibilityTest { } @Test - public void shouldFailIfNotSameServerId() throws Exception { + public void shouldFailIfNotSameServerId() { when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("11111111")); thrown.expect(MessageException.class); @@ -97,7 +97,7 @@ public class DatabaseCompatibilityTest { } @Test - public void shouldUseDefaultUserNameWhenFaillingIfNotSameServerIdAndNoUserNameFound() throws Exception { + public void shouldUseDefaultUserNameWhenFaillingIfNotSameServerIdAndNoUserNameFound() { when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("11111111")); settings.removeProperty(DatabaseProperties.PROP_USER); @@ -109,7 +109,7 @@ public class DatabaseCompatibilityTest { } @Test - public void shouldFailIfCantGetServerId() throws Exception { + public void shouldFailIfCantGetServerId() { when(server.request("/api/server")).thenThrow(new IllegalStateException()); thrown.expect(IllegalStateException.class); diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java index f03d16bbd32..57e940ab7ae 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java @@ -77,7 +77,7 @@ public class DefaultPluginsRepositoryTest { } @Test - public void should_fail_to_get_plugin_index() throws Exception { + public void should_fail_to_get_plugin_index() { thrown.expect(IllegalStateException.class); ServerClient server = mock(ServerClient.class); diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java index c6bc80c9862..0647b0e22ec 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java @@ -58,7 +58,7 @@ public class ExtensionInstallerTest { } @Before - public void setUp() throws Exception { + public void setUp() { mode = mock(DefaultAnalysisMode.class); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java index a5040b47f35..e1e31dce2ad 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java @@ -58,7 +58,7 @@ public class JdbcDriverHolderTest { } @Test - public void extend_classloader_with_jdbc_driver() throws Exception { + public void extend_classloader_with_jdbc_driver() { FileCache cache = mock(FileCache.class); File fakeDriver = new File(Resources.getResource(JdbcDriverHolderTest.class, "JdbcDriverHolderTest/jdbc-driver.jar").getFile()); @@ -84,7 +84,7 @@ public class JdbcDriverHolderTest { } @Test - public void do_nothing_when_jdbc_driver_file_is_empty() throws Exception { + public void do_nothing_when_jdbc_driver_file_is_empty() { FileCache cache = mock(FileCache.class); ServerClient server = mock(ServerClient.class); diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java index 1034c020957..2e13a5a9481 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java @@ -64,7 +64,7 @@ public class ServerClientTest { } @Test - public void should_remove_url_ending_slash() throws Exception { + public void should_remove_url_ending_slash() { BootstrapProperties settings = mock(BootstrapProperties.class); when(settings.property("sonar.host.url")).thenReturn("http://localhost:8080/sonar/"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java b/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java index f712b04dbc4..be6c4ab057c 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java @@ -151,7 +151,7 @@ public class PastSnapshotFinderTest { } @Test - public void should_find_by_previous_analysis() throws ParseException { + public void should_find_by_previous_analysis() { final Date date = DateUtils.parseDate("2010-05-18"); Snapshot snapshot = new Snapshot(); snapshot.setCreatedAtMs(date.getTime()); diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java index 7cb4b47c1c5..5ce426696d5 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java @@ -104,7 +104,7 @@ public class DebtDecoratorTest { DebtDecorator decorator; @Before - public void before() throws Exception { + public void before() { when(perspectives.as(Issuable.class, resource)).thenReturn(issuable); RulesBuilder rulesBuilder = new RulesBuilder(); rulesBuilder.add(ruleKey1).setName("rule1").setDebtSubCharacteristic("MEMORY_EFFICIENCY"); @@ -124,12 +124,12 @@ public class DebtDecoratorTest { } @Test - public void generates_metrics() throws Exception { + public void generates_metrics() { assertThat(decorator.generatesMetrics()).hasSize(1); } @Test - public void execute_on_project() throws Exception { + public void execute_on_project() { assertThat(decorator.shouldExecuteOnProject(null)).isTrue(); } @@ -143,7 +143,7 @@ public class DebtDecoratorTest { } @Test - public void add_technical_debt_from_one_issue_and_no_parent() throws Exception { + public void add_technical_debt_from_one_issue_and_no_parent() { Issue issue = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES)); when(issuable.issues()).thenReturn(newArrayList(issue)); @@ -154,7 +154,7 @@ public class DebtDecoratorTest { } @Test - public void add_technical_debt_from_one_issue_without_debt() throws Exception { + public void add_technical_debt_from_one_issue_without_debt() { Issue issue = createIssue("rule1", "repo1").setDebt(null); when(issuable.issues()).thenReturn(newArrayList(issue)); @@ -164,7 +164,7 @@ public class DebtDecoratorTest { } @Test - public void add_technical_debt_from_one_issue_and_propagate_to_parents() throws Exception { + public void add_technical_debt_from_one_issue_and_propagate_to_parents() { Issue issue = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES)); when(issuable.issues()).thenReturn(newArrayList(issue)); @@ -177,7 +177,7 @@ public class DebtDecoratorTest { } @Test - public void add_technical_debt_from_issues() throws Exception { + public void add_technical_debt_from_issues() { Long technicalDebt1 = ONE_DAY_IN_MINUTES; Long technicalDebt2 = 2 * ONE_DAY_IN_MINUTES; @@ -195,7 +195,7 @@ public class DebtDecoratorTest { } @Test - public void add_technical_debt_from_current_and_children_measures() throws Exception { + public void add_technical_debt_from_current_and_children_measures() { Issue issue1 = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES)); Issue issue2 = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES)); when(issuable.issues()).thenReturn(newArrayList(issue1, issue2)); @@ -214,7 +214,7 @@ public class DebtDecoratorTest { } @Test - public void add_technical_debt_only_from_children_measures() throws Exception { + public void add_technical_debt_only_from_children_measures() { when(issuable.issues()).thenReturn(Collections.emptyList()); when(context.getChildrenMeasures(any(MeasuresFilter.class))).thenReturn(Lists.newArrayList( @@ -238,7 +238,7 @@ public class DebtDecoratorTest { } @Test - public void always_save_technical_debt_for_positive_values() throws Exception { + public void always_save_technical_debt_for_positive_values() { // for a project DecoratorContext context = mock(DecoratorContext.class); when(context.getResource()).thenReturn(new Project("foo")); @@ -253,7 +253,7 @@ public class DebtDecoratorTest { } @Test - public void always_save_technical_debt_for_project_if_top_characteristic() throws Exception { + public void always_save_technical_debt_for_project_if_top_characteristic() { DecoratorContext context = mock(DecoratorContext.class); when(context.getResource()).thenReturn(new Project("foo")); @@ -268,7 +268,7 @@ public class DebtDecoratorTest { * SQALE-147 */ @Test - public void never_save_technical_debt_for_project_if_not_top_characteristic() throws Exception { + public void never_save_technical_debt_for_project_if_not_top_characteristic() { DecoratorContext context = mock(DecoratorContext.class); when(context.getResource()).thenReturn(new Project("foo")); @@ -280,7 +280,7 @@ public class DebtDecoratorTest { } @Test - public void not_save_technical_debt_for_file_if_zero() throws Exception { + public void not_save_technical_debt_for_file_if_zero() { DecoratorContext context = mock(DecoratorContext.class); when(context.getResource()).thenReturn(File.create("foo")); diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java index f233dc79bef..1d434d5d2e5 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java @@ -48,7 +48,7 @@ public class DebtModelProviderTest { } @Test - public void provide_model() throws Exception { + public void provide_model() { CharacteristicDto rootCharacteristicDto = new CharacteristicDto() .setId(1) .setKey("MEMORY_EFFICIENCY") diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java index ab0e14b93a9..952075dec78 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java @@ -55,12 +55,12 @@ public class IssueChangelogDebtCalculatorTest { Duration fiveDaysDebt = Duration.create(fiveDays); @Before - public void setUp() throws Exception { + public void setUp() { issueChangelogDebtCalculator = new IssueChangelogDebtCalculator(); } @Test - public void calculate_new_technical_debt_with_one_diff_in_changelog() throws Exception { + public void calculate_new_technical_debt_with_one_diff_in_changelog() { Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(twoDaysDebt).setChanges( newArrayList( // changelog created at is null because it has just been created on the current analysis @@ -75,7 +75,7 @@ public class IssueChangelogDebtCalculatorTest { } @Test - public void calculate_new_technical_debt_with_many_diffs_in_changelog() throws Exception { + public void calculate_new_technical_debt_with_many_diffs_in_changelog() { Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(fiveDaysDebt).setChanges( newArrayList( new FieldDiffs().setDiff("technicalDebt", twoDays, fiveDays).setCreationDate(null), @@ -106,7 +106,7 @@ public class IssueChangelogDebtCalculatorTest { } @Test - public void calculate_new_technical_debt_with_null_date() throws Exception { + public void calculate_new_technical_debt_with_null_date() { Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(twoDaysDebt).setChanges( newArrayList( new FieldDiffs().setDiff("technicalDebt", oneDay, twoDays).setCreationDate(null) @@ -117,7 +117,7 @@ public class IssueChangelogDebtCalculatorTest { } @Test - public void calculate_new_technical_debt_when_new_debt_is_null() throws Exception { + public void calculate_new_technical_debt_when_new_debt_is_null() { Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(null).setChanges( newArrayList( new FieldDiffs().setDiff("technicalDebt", oneDay, null).setCreationDate(null), diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java index fa7b4f9c4cb..b5851c0884f 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java @@ -106,12 +106,12 @@ public class NewDebtDecoratorTest { } @Test - public void generates_metrics() throws Exception { + public void generates_metrics() { assertThat(decorator.generatesMetrics()).hasSize(1); } @Test - public void execute_on_project() throws Exception { + public void execute_on_project() { assertThat(decorator.shouldExecuteOnProject(null)).isTrue(); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java index 79ce075a097..ab599323349 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java @@ -81,7 +81,7 @@ public class SqaleRatingDecoratorTest { } @Test - public void generates_metrics() throws Exception { + public void generates_metrics() { SqaleRatingDecorator decorator = new SqaleRatingDecorator(); assertThat(decorator.generatesMetrics()).hasSize(3); } @@ -93,13 +93,13 @@ public class SqaleRatingDecoratorTest { } @Test - public void execute_on_project() throws Exception { + public void execute_on_project() { SqaleRatingDecorator decorator = new SqaleRatingDecorator(); assertThat(decorator.shouldExecuteOnProject(null)).isTrue(); } @Test - public void not_execute_on_unit_test() throws Exception { + public void not_execute_on_unit_test() { File resource = mock(File.class); when(resource.getQualifier()).thenReturn(Qualifiers.UNIT_TEST_FILE); DecoratorContext context = mock(DecoratorContext.class); diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java index 830b6319e15..15ef8398d69 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java @@ -41,7 +41,7 @@ public class SqaleRatingGridTest { } @Test - public void return_grade_lower_bound() throws Exception { + public void return_grade_lower_bound() { assertThat(ratingGrid.getGradeLowerBound(SqaleRatingGrid.SqaleRating.A)).isEqualTo(0); assertThat(ratingGrid.getGradeLowerBound(SqaleRatingGrid.SqaleRating.B)).isEqualTo(0.1); assertThat(ratingGrid.getGradeLowerBound(SqaleRatingGrid.SqaleRating.C)).isEqualTo(0.2); @@ -50,7 +50,7 @@ public class SqaleRatingGridTest { } @Test - public void return_rating_matching_density() throws Exception { + public void return_rating_matching_density() { assertThat(ratingGrid.getRatingForDensity(0)).isEqualTo(1); assertThat(ratingGrid.getRatingForDensity(0.05)).isEqualTo(1); assertThat(ratingGrid.getRatingForDensity(0.1)).isEqualTo(2); @@ -64,7 +64,7 @@ public class SqaleRatingGridTest { } @Test - public void fail_on_invalid_density() throws Exception { + public void fail_on_invalid_density() { throwable.expect(RuntimeException.class); ratingGrid.getRatingForDensity(-1); diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java index 157808bde5d..68cbfee5f51 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java @@ -47,7 +47,7 @@ public class SqaleRatingSettingsTest { } @Test - public void load_rating_grid() throws Exception { + public void load_rating_grid() { settings.setProperty(CoreProperties.RATING_GRID, "1,3.4,8,50"); SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings); @@ -60,7 +60,7 @@ public class SqaleRatingSettingsTest { } @Test - public void load_work_units_for_language() throws Exception { + public void load_work_units_for_language() { settings.setProperty(CoreProperties.DEVELOPMENT_COST, "50"); SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings); @@ -68,7 +68,7 @@ public class SqaleRatingSettingsTest { } @Test - public void load_size_metric_for_language() throws Exception { + public void load_size_metric_for_language() { settings.setProperty(CoreProperties.SIZE_METRIC, "complexity"); SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings); @@ -76,7 +76,7 @@ public class SqaleRatingSettingsTest { } @Test - public void load_overridden_values_for_language() throws Exception { + public void load_overridden_values_for_language() { String aLanguage = "aLanguage"; String anotherLanguage = "anotherLanguage"; @@ -98,7 +98,7 @@ public class SqaleRatingSettingsTest { } @Test - public void fail_on_invalid_rating_grid_configuration() throws Exception { + public void fail_on_invalid_rating_grid_configuration() { throwable.expect(IllegalArgumentException.class); settings.setProperty(CoreProperties.RATING_GRID, "a b c"); @@ -108,7 +108,7 @@ public class SqaleRatingSettingsTest { } @Test - public void fail_on_invalid_work_unit_value() throws Exception { + public void fail_on_invalid_work_unit_value() { throwable.expect(IllegalArgumentException.class); settings.setProperty(CoreProperties.DEVELOPMENT_COST, "a"); SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings); @@ -117,7 +117,7 @@ public class SqaleRatingSettingsTest { } @Test - public void fail_on_unknown_metric_key() throws Exception { + public void fail_on_unknown_metric_key() { throwable.expect(IllegalArgumentException.class); settings.setProperty(CoreProperties.SIZE_METRIC, "unknown"); SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings); @@ -126,7 +126,7 @@ public class SqaleRatingSettingsTest { } @Test - public void use_generic_value_when_specific_setting_is_missing() throws Exception { + public void use_generic_value_when_specific_setting_is_missing() { String aLanguage = "aLanguage"; settings.setProperty(CoreProperties.SIZE_METRIC, "complexity"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java index c93334474b2..0a4ad891ce7 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java @@ -29,7 +29,7 @@ import static org.mockito.Mockito.verify; public class ResourceFiltersTest { @Test - public void warn_on_resource_filters() throws Exception { + public void warn_on_resource_filters() { Logger logger = mock(Logger.class); ResourceFilter[] filters = {mock(ResourceFilter.class)}; new ResourceFilters(logger, filters); @@ -40,7 +40,7 @@ public class ResourceFiltersTest { } @Test - public void ok_if_no_resource_filters() throws Exception { + public void ok_if_no_resource_filters() { // just for verify that it does not fail. Should check that no warning is logged. new ResourceFilters(); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java b/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java index 83c8b98a8b9..bd71b0b4351 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java @@ -33,7 +33,7 @@ public class PastSnapshotFinderByPreviousVersionTest extends AbstractDbUnitTestC private PastSnapshotFinderByPreviousVersion finder; @Before - public void before() throws Exception { + public void before() { finder = new PastSnapshotFinderByPreviousVersion(getSession(), getMyBatis()); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java index 514860bc011..14254a9d9f6 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java @@ -43,7 +43,7 @@ public class DuplicationCacheTest { Caches caches; @Before - public void start() throws Exception { + public void start() { caches = CachesTest.createCacheOnTemp(temp); caches.start(); } @@ -54,7 +54,7 @@ public class DuplicationCacheTest { } @Test - public void should_add_clone_groups() throws Exception { + public void should_add_clone_groups() { DuplicationCache cache = new DuplicationCache(caches); DefaultDuplication group1 = new DefaultDuplication() diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java index 0235af3dc89..9c85d02c0fd 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java @@ -37,7 +37,7 @@ public class CacheTest { Caches caches; @Before - public void start() throws Exception { + public void start() { caches = CachesTest.createCacheOnTemp(temp); caches.start(); } @@ -48,7 +48,7 @@ public class CacheTest { } @Test - public void one_part_key() throws Exception { + public void one_part_key() { Cache cache = caches.createCache("capitals"); assertThat(cache.get("france")).isNull(); @@ -97,7 +97,7 @@ public class CacheTest { } @Test - public void two_parts_key() throws Exception { + public void two_parts_key() { Cache cache = caches.createCache("capitals"); assertThat(cache.get("europe", "france")).isNull(); @@ -153,7 +153,7 @@ public class CacheTest { } @Test - public void three_parts_key() throws Exception { + public void three_parts_key() { Cache cache = caches.createCache("places"); assertThat(cache.get("europe", "france", "paris")).isNull(); @@ -229,7 +229,7 @@ public class CacheTest { } @Test - public void remove_versus_clear() throws Exception { + public void remove_versus_clear() { Cache cache = caches.createCache("capitals"); cache.put("europe", "france", "paris"); cache.put("europe", "italy", "rome"); @@ -244,7 +244,7 @@ public class CacheTest { } @Test - public void empty_cache() throws Exception { + public void empty_cache() { Cache cache = caches.createCache("empty"); assertThat(cache.get("foo")).isNull(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java index 35c8ec22309..83e2a99b948 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java @@ -53,7 +53,7 @@ public class CachesTest { Caches caches; @Before - public void prepare() throws Exception { + public void prepare() { caches = createCacheOnTemp(temp); } @@ -63,7 +63,7 @@ public class CachesTest { } @Test - public void should_stop_and_clean_temp_dir() throws Exception { + public void should_stop_and_clean_temp_dir() { File tempDir = caches.tempDir(); assertThat(tempDir).isDirectory().exists(); assertThat(caches.persistit()).isNotNull(); @@ -77,14 +77,14 @@ public class CachesTest { } @Test - public void should_create_cache() throws Exception { + public void should_create_cache() { caches.start(); Cache cache = caches.createCache("foo"); assertThat(cache).isNotNull(); } @Test - public void should_not_create_cache_twice() throws Exception { + public void should_not_create_cache_twice() { caches.start(); caches.createCache("foo"); try { diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java index bd250b544dd..461a9a4d7f1 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class ResourceCacheTest { @Test - public void should_cache_resource() throws Exception { + public void should_cache_resource() { ResourceCache cache = new ResourceCache(); String componentKey = "struts:src/org/struts/Action.java"; Resource resource = File.create("org/struts/Action.java").setEffectiveKey(componentKey); @@ -39,7 +39,7 @@ public class ResourceCacheTest { } @Test - public void should_fail_if_missing_component_key() throws Exception { + public void should_fail_if_missing_component_key() { ResourceCache cache = new ResourceCache(); Resource resource = File.create("org/struts/Action.java").setEffectiveKey(null); try { diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java index e61cb09ffec..25dc340fe30 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java @@ -33,7 +33,7 @@ public class DefaultIssueFilterChainTest { private final Issue issue = mock(Issue.class); @Test - public void should_accept_when_no_filter() throws Exception { + public void should_accept_when_no_filter() { assertThat(new DefaultIssueFilterChain().accept(issue)).isTrue(); } @@ -68,7 +68,7 @@ public class DefaultIssueFilterChainTest { } @Test - public void should_accept_if_all_filters_pass() throws Exception { + public void should_accept_if_all_filters_pass() { assertThat(new DefaultIssueFilterChain( new PassingFilter(), new PassingFilter(), @@ -77,7 +77,7 @@ public class DefaultIssueFilterChainTest { } @Test - public void should_accept_and_not_go_further_if_filter_accepts() throws Exception { + public void should_accept_and_not_go_further_if_filter_accepts() { assertThat(new DefaultIssueFilterChain( new PassingFilter(), new AcceptingFilter(), @@ -86,7 +86,7 @@ public class DefaultIssueFilterChainTest { } @Test - public void should_refuse_and_not_go_further_if_filter_refuses() throws Exception { + public void should_refuse_and_not_go_further_if_filter_refuses() { assertThat(new DefaultIssueFilterChain( new PassingFilter(), new RefusingFilter(), diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java index 2cc9d8b4498..b46e3551a6d 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java @@ -41,7 +41,7 @@ public class DefaultProjectIssuesTest { DefaultProjectIssues projectIssues = new DefaultProjectIssues(cache); @Test - public void should_get_all_issues() throws Exception { + public void should_get_all_issues() { DefaultIssue issueOnModule = new DefaultIssue().setKey("1").setRuleKey(SQUID_RULE_KEY).setComponentKey("org.apache:struts-core"); DefaultIssue issueInModule = new DefaultIssue().setKey("2").setRuleKey(SQUID_RULE_KEY).setComponentKey("org.apache:struts-core:Action"); DefaultIssue resolvedIssueInModule = new DefaultIssue().setKey("3").setRuleKey(SQUID_RULE_KEY).setComponentKey("org.apache:struts-core:Action") diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java index 514a6d05a1b..9cac3995a5c 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java @@ -38,7 +38,7 @@ public class IssuableFactoryTest { ProjectTree projectTree = mock(ProjectTree.class); @Test - public void file_should_be_issuable() throws Exception { + public void file_should_be_issuable() { IssuableFactory factory = new IssuableFactory(moduleIssues, cache, projectTree); Component component = new ResourceComponent(File.create("foo/bar.c").setEffectiveKey("foo/bar.c")); Issuable issuable = factory.loadPerspective(Issuable.class, component); @@ -49,7 +49,7 @@ public class IssuableFactoryTest { } @Test - public void project_should_be_issuable() throws Exception { + public void project_should_be_issuable() { IssuableFactory factory = new IssuableFactory(moduleIssues, cache, projectTree); Component component = new ResourceComponent(new Project("Foo").setEffectiveKey("foo")); Issuable issuable = factory.loadPerspective(Issuable.class, component); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java index 2119f1c3ed9..46e297f2e4e 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java @@ -49,7 +49,7 @@ public class IssueCacheTest { Caches caches; @Before - public void start() throws Exception { + public void start() { caches = CachesTest.createCacheOnTemp(temp); caches.start(); } @@ -60,7 +60,7 @@ public class IssueCacheTest { } @Test - public void should_add_new_issue() throws Exception { + public void should_add_new_issue() { IssueCache cache = new IssueCache(caches); DefaultIssue issue1 = new DefaultIssue().setKey("111").setComponentKey("org.struts.Action"); DefaultIssue issue2 = new DefaultIssue().setKey("222").setComponentKey("org.struts.Action"); @@ -73,7 +73,7 @@ public class IssueCacheTest { } @Test - public void should_update_existing_issue() throws Exception { + public void should_update_existing_issue() { IssueCache cache = new IssueCache(caches); DefaultIssue issue = new DefaultIssue().setKey("111").setComponentKey("org.struts.Action").setSeverity(Severity.BLOCKER); cache.put(issue); @@ -89,7 +89,7 @@ public class IssueCacheTest { } @Test - public void should_get_all_issues() throws Exception { + public void should_get_all_issues() { IssueCache cache = new IssueCache(caches); DefaultIssue issue1 = new DefaultIssue().setKey("111").setComponentKey("org.struts.Action").setSeverity(Severity.BLOCKER); DefaultIssue issue2 = new DefaultIssue().setKey("222").setComponentKey("org.struts.Filter").setSeverity(Severity.INFO); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java index 4cc35d488ce..46aea62325c 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java @@ -31,7 +31,7 @@ import static org.mockito.Mockito.when; public class IssueFiltersTest { @Test - public void accept_when_filter_chain_is_empty() throws Exception { + public void accept_when_filter_chain_is_empty() { org.sonar.api.issue.IssueFilter ok = mock(org.sonar.api.issue.IssueFilter.class); when(ok.accept(any(Issue.class))).thenReturn(true); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java index 7ffa9905721..2577ba98a41 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java @@ -78,7 +78,7 @@ public class ModuleIssuesTest { } @Test - public void fail_on_unknown_rule() throws Exception { + public void fail_on_unknown_rule() { initModuleIssues(); DefaultIssue issue = new DefaultIssue().setRuleKey(SQUID_RULE_KEY); @@ -93,7 +93,7 @@ public class ModuleIssuesTest { } @Test - public void fail_if_rule_has_no_name_and_issue_has_no_message() throws Exception { + public void fail_if_rule_has_no_name_and_issue_has_no_message() { ruleBuilder.add(RuleKey.of("squid", "AvoidCycle")); initModuleIssues(); DefaultIssue issue = new DefaultIssue().setRuleKey(SQUID_RULE_KEY).setMessage(""); @@ -109,7 +109,7 @@ public class ModuleIssuesTest { } @Test - public void ignore_null_active_rule() throws Exception { + public void ignore_null_active_rule() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); initModuleIssues(); @@ -121,7 +121,7 @@ public class ModuleIssuesTest { } @Test - public void ignore_null_rule_of_active_rule() throws Exception { + public void ignore_null_rule_of_active_rule() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); activeRulesBuilder.create(SQUID_RULE_KEY).activate(); initModuleIssues(); @@ -134,7 +134,7 @@ public class ModuleIssuesTest { } @Test - public void add_issue_to_cache() throws Exception { + public void add_issue_to_cache() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate(); initModuleIssues(); @@ -158,7 +158,7 @@ public class ModuleIssuesTest { } @Test - public void use_severity_from_active_rule_if_no_severity_on_issue() throws Exception { + public void use_severity_from_active_rule_if_no_severity_on_issue() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate(); initModuleIssues(); @@ -177,7 +177,7 @@ public class ModuleIssuesTest { } @Test - public void use_rule_name_if_no_message() throws Exception { + public void use_rule_name_if_no_message() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).setName(SQUID_RULE_NAME).activate(); initModuleIssues(); @@ -201,7 +201,7 @@ public class ModuleIssuesTest { } @Test - public void add_deprecated_violation() throws Exception { + public void add_deprecated_violation() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate(); initModuleIssues(); @@ -231,7 +231,7 @@ public class ModuleIssuesTest { } @Test - public void filter_issue() throws Exception { + public void filter_issue() { ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate(); initModuleIssues(); @@ -250,7 +250,7 @@ public class ModuleIssuesTest { } @Test - public void set_debt_with_linear_function() throws Exception { + public void set_debt_with_linear_function() { ruleBuilder.add(SQUID_RULE_KEY) .setName(SQUID_RULE_NAME) .setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY") @@ -276,7 +276,7 @@ public class ModuleIssuesTest { } @Test - public void set_debt_with_linear_with_offset_function() throws Exception { + public void set_debt_with_linear_with_offset_function() { ruleBuilder.add(SQUID_RULE_KEY) .setName(SQUID_RULE_NAME) .setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY") @@ -302,7 +302,7 @@ public class ModuleIssuesTest { } @Test - public void set_debt_with_constant_issue_function() throws Exception { + public void set_debt_with_constant_issue_function() { ruleBuilder.add(SQUID_RULE_KEY) .setName(SQUID_RULE_NAME) .setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY") @@ -328,7 +328,7 @@ public class ModuleIssuesTest { } @Test - public void fail_to_set_debt_with_constant_issue_function_when_effort_to_fix_is_set() throws Exception { + public void fail_to_set_debt_with_constant_issue_function_when_effort_to_fix_is_set() { ruleBuilder.add(SQUID_RULE_KEY) .setName(SQUID_RULE_NAME) .setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY") diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java index 57cd8cfd17e..47a2e4e1907 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java @@ -78,28 +78,28 @@ public class PatternMatcherTest { } @Test - public void shouldMatchWithStandardPatterns() throws IOException { + public void shouldMatchWithStandardPatterns() { patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;checkstyle:MagicNumber;[15-200]")); assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 150))).isNotNull(); } @Test - public void shouldNotMatchWithStandardPatterns() throws IOException { + public void shouldNotMatchWithStandardPatterns() { patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;checkstyle:MagicNumber;[15-200]")); assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 5))).isNull(); } @Test - public void shouldMatchWithExtraPattern() throws IOException { + public void shouldMatchWithExtraPattern() { patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;*;[15-200]")); assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 150))).isNotNull(); } @Test - public void shouldNotMatchWithExtraPattern() throws IOException { + public void shouldNotMatchWithExtraPattern() { patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;*;[15-200]")); assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 5))).isNull(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java index 3cca58ac2b2..5bd352f2e62 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java @@ -83,7 +83,7 @@ public class IssueExclusionsLoaderTest { } @Test - public void shouldExecute() throws IOException { + public void shouldExecute() { when(exclusionPatternInitializer.hasConfiguredPatterns()).thenReturn(true); when(inclusionPatternInitializer.hasConfiguredPatterns()).thenReturn(true); assertThat(scanner.shouldExecuteOnProject(null)).isTrue(); @@ -124,7 +124,7 @@ public class IssueExclusionsLoaderTest { } @Test - public void shouldAnalyseFilesOnlyWhenRegexConfigured() throws IOException { + public void shouldAnalyseFilesOnlyWhenRegexConfigured() { File javaFile1 = new File(baseDir, "src/main/java/Foo.java"); fs.add(new DeprecatedDefaultInputFile("polop", "src/main/java/Foo.java") .setType(InputFile.Type.MAIN)); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java index a98952d5ec9..046f37840f9 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java @@ -57,7 +57,7 @@ public class InitialOpenIssuesStackTest { Caches caches; @Before - public void before() throws Exception { + public void before() { caches = createCacheOnTemp(temp); caches.start(); stack = new InitialOpenIssuesStack(caches); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java index 8b210bd731d..c3d84f77c98 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java @@ -35,7 +35,7 @@ import static org.mockito.Mockito.*; public class IssueHandlersTest { @Test - public void should_execute_handlers() throws Exception { + public void should_execute_handlers() { IssueHandler h1 = mock(IssueHandler.class); IssueHandler h2 = mock(IssueHandler.class); IssueUpdater updater = mock(IssueUpdater.class); diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java index a0021e72025..dde4856d71c 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java @@ -104,14 +104,14 @@ public class IssueTrackingDecoratorTest { } @Test - public void should_not_be_executed_on_classes_not_methods() throws Exception { + public void should_not_be_executed_on_classes_not_methods() { DecoratorContext context = mock(DecoratorContext.class); decorator.decorate(JavaClass.create("org.foo.Bar"), context); verifyZeroInteractions(context, issueCache, tracking, handlers, workflow); } @Test - public void should_process_open_issues() throws Exception { + public void should_process_open_issues() { Resource file = File.create("Action.java").setEffectiveKey("struts:Action.java").setId(123); final DefaultIssue issue = new DefaultIssue(); @@ -136,7 +136,7 @@ public class IssueTrackingDecoratorTest { } @Test - public void should_register_unmatched_issues_as_end_of_life() throws Exception { + public void should_register_unmatched_issues_as_end_of_life() { // "Unmatched" issues existed in previous scan but not in current one -> they have to be closed Resource file = File.create("Action.java").setEffectiveKey("struts:Action.java").setId(123); @@ -487,7 +487,7 @@ public class IssueTrackingDecoratorTest { } @Test - public void should_register_issues_on_deleted_components() throws Exception { + public void should_register_issues_on_deleted_components() { Project project = new Project("struts"); DefaultIssue openIssue = new DefaultIssue(); when(issueCache.byComponent("struts")).thenReturn(Arrays.asList(openIssue)); @@ -511,7 +511,7 @@ public class IssueTrackingDecoratorTest { } @Test - public void merge_matched_issue() throws Exception { + public void merge_matched_issue() { ServerIssue previousIssue = new ServerIssueFromDb(new IssueDto().setKee("ABCDE").setResolution(null).setStatus("OPEN").setRuleKey("squid", "AvoidCycle") .setLine(10).setSeverity("MAJOR").setMessage("Message").setEffortToFix(1.5).setDebt(1L).setProjectKey("sample")); DefaultIssue issue = new DefaultIssue(); @@ -530,7 +530,7 @@ public class IssueTrackingDecoratorTest { } @Test - public void merge_matched_issue_on_manual_severity() throws Exception { + public void merge_matched_issue_on_manual_severity() { ServerIssue previousIssue = new ServerIssueFromDb(new IssueDto().setKee("ABCDE").setResolution(null).setStatus("OPEN").setRuleKey("squid", "AvoidCycle") .setLine(10).setManualSeverity(true).setSeverity("MAJOR").setMessage("Message").setEffortToFix(1.5).setDebt(1L)); DefaultIssue issue = new DefaultIssue(); @@ -546,7 +546,7 @@ public class IssueTrackingDecoratorTest { } @Test - public void merge_issue_changelog_with_previous_changelog() throws Exception { + public void merge_issue_changelog_with_previous_changelog() { when(initialOpenIssues.selectChangelog("ABCDE")).thenReturn(newArrayList(new IssueChangeDto().setIssueKey("ABCD").setCreatedAt(System2.INSTANCE.now()))); ServerIssue previousIssue = new ServerIssueFromDb(new IssueDto().setKee("ABCDE").setResolution(null).setStatus("OPEN").setRuleKey("squid", "AvoidCycle") diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java index d07d08a978c..b716ce907d5 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java @@ -334,7 +334,7 @@ public class IssueTrackingTest { } @Test - public void dont_load_checksum_if_no_new_issue() throws Exception { + public void dont_load_checksum_if_no_new_issue() { sourceHashHolder = mock(SourceHashHolder.class); ServerIssue referenceIssue = newReferenceIssue("2 branches need to be covered", null, "squid", "AvoidCycle", null); diff --git a/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java index 155b9cd4910..aa351984b5a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java @@ -60,7 +60,7 @@ public class LanguageDistributionDecoratorTest { LanguageDistributionDecorator decorator; @Before - public void setUp() throws Exception { + public void setUp() { decorator = new LanguageDistributionDecorator(); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java b/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java index 43635198209..a4d344bdece 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java @@ -41,7 +41,7 @@ public class MavenProjectBootstrapperTest { public ExpectedException thrown = ExpectedException.none(); @Test - public void bootstrap() throws Exception { + public void bootstrap() { ProjectDefinition def = mock(ProjectDefinition.class); MavenSession session = mock(MavenSession.class); MavenProject rootProject = new MavenProject(); @@ -60,7 +60,7 @@ public class MavenProjectBootstrapperTest { } @Test - public void should_fail_if_no_top_level_project() throws Exception { + public void should_fail_if_no_top_level_project() { thrown.expect(IllegalStateException.class); thrown.expectMessage("Maven session does not declare a top level project"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java index 72023e2e180..f20786a4679 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java @@ -226,7 +226,7 @@ public class FileSystemMediumTest { // SONAR-5330 @Test - public void scanProjectWithSourceSymlink() throws Exception { + public void scanProjectWithSourceSymlink() { if (!System2.INSTANCE.isOsWindows()) { File projectDir = new File("src/test/resources/mediumtest/xoo/sample-with-symlink"); TaskResult result = tester diff --git a/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java b/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java index acd9ea1fdb7..1a16a8868b9 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java @@ -45,21 +45,21 @@ public class PostJobOptimizerTest { private AnalysisMode analysisMode; @Before - public void prepare() throws Exception { + public void prepare() { settings = new Settings(); analysisMode = mock(AnalysisMode.class); optimizer = new PostJobOptimizer(settings, analysisMode); } @Test - public void should_run_analyzer_with_no_metadata() throws Exception { + public void should_run_analyzer_with_no_metadata() { DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor(); assertThat(optimizer.shouldExecute(descriptor)).isTrue(); } @Test - public void should_optimize_on_settings() throws Exception { + public void should_optimize_on_settings() { DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor() .requireProperty("sonar.foo.reportPath"); assertThat(optimizer.shouldExecute(descriptor)).isFalse(); @@ -69,7 +69,7 @@ public class PostJobOptimizerTest { } @Test - public void should_disabled_in_preview() throws Exception { + public void should_disabled_in_preview() { DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor() .disabledInPreview(); assertThat(optimizer.shouldExecute(descriptor)).isTrue(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java b/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java index 704a27b04c1..0974ac53e11 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java @@ -145,7 +145,7 @@ public class PhasesSumUpTimeProfilerTest { return project; } - private void fakeAnalysis(PhasesSumUpTimeProfiler profiler, final Project module) throws InterruptedException { + private void fakeAnalysis(PhasesSumUpTimeProfiler profiler, final Project module) { // Start of moduleA profiler.onProjectAnalysis(projectEvent(module, true)); initializerPhase(profiler); @@ -158,7 +158,7 @@ public class PhasesSumUpTimeProfilerTest { profiler.onProjectAnalysis(projectEvent(module, false)); } - private void decoratorPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException { + private void decoratorPhase(PhasesSumUpTimeProfiler profiler) { Decorator decorator1 = new FakeDecorator1(); Decorator decorator2 = new FakeDecorator2(); // Start of decorator phase @@ -187,7 +187,7 @@ public class PhasesSumUpTimeProfilerTest { profiler.onDecoratorsPhase(decoratorsEvent(false)); } - private void batchStep(PhasesSumUpTimeProfiler profiler) throws InterruptedException { + private void batchStep(PhasesSumUpTimeProfiler profiler) { // Start of batch step profiler.onBatchStep(new BatchStepEvent("Free memory", true)); clock.sleep(9); @@ -195,7 +195,7 @@ public class PhasesSumUpTimeProfilerTest { profiler.onBatchStep(new BatchStepEvent("Free memory", false)); } - private void initializerPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException { + private void initializerPhase(PhasesSumUpTimeProfiler profiler) { Initializer initializer = new FakeInitializer(); // Start of initializer phase profiler.onInitializersPhase(initializersEvent(true)); @@ -208,7 +208,7 @@ public class PhasesSumUpTimeProfilerTest { profiler.onInitializersPhase(initializersEvent(false)); } - private void sensorPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException { + private void sensorPhase(PhasesSumUpTimeProfiler profiler) { Sensor sensor = new FakeSensor(); // Start of sensor phase profiler.onSensorsPhase(sensorsEvent(true)); @@ -221,7 +221,7 @@ public class PhasesSumUpTimeProfilerTest { profiler.onSensorsPhase(sensorsEvent(false)); } - private void persistersPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException { + private void persistersPhase(PhasesSumUpTimeProfiler profiler) { ScanPersister persister = new FakeScanPersister(); // Start of persister phase profiler.onPersistersPhase(persistersEvent(true)); @@ -234,7 +234,7 @@ public class PhasesSumUpTimeProfilerTest { profiler.onPersistersPhase(persistersEvent(false)); } - private void postJobPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException { + private void postJobPhase(PhasesSumUpTimeProfiler profiler) { PostJob postJob = new FakePostJob(); // Start of sensor phase profiler.onPostJobsPhase(postJobsEvent(true)); diff --git a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java index ca89fe8ccae..759471b4677 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java @@ -101,7 +101,7 @@ public class QualityGateVerifierTest { } @Test - public void should_be_executed_if_quality_gate_is_enabled() throws Exception { + public void should_be_executed_if_quality_gate_is_enabled() { assertThat(verifier.shouldExecuteOnProject((Project) project)).isTrue(); when(qualityGate.isEnabled()).thenReturn(false); assertThat(verifier.shouldExecuteOnProject((Project) project)).isFalse(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java index 5b9221dc92c..4a6e27960d2 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java @@ -53,7 +53,7 @@ public class ReportPublisherTest extends AbstractDbUnitTestCase { } @Test - public void should_log_successful_analysis() throws Exception { + public void should_log_successful_analysis() { Settings settings = new Settings(); settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver/"); ReportPublisher job = new ReportPublisher(settings, mock(ServerClient.class), mock(Server.class), reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]); @@ -66,7 +66,7 @@ public class ReportPublisherTest extends AbstractDbUnitTestCase { } @Test - public void should_log_successful_preview_analysis() throws Exception { + public void should_log_successful_preview_analysis() { Settings settings = new Settings(); when(mode.isPreview()).thenReturn(true); ReportPublisher job = new ReportPublisher(settings, mock(ServerClient.class), mock(Server.class), reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]); diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java index c76eacef5be..c5f977c3e9c 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java @@ -47,7 +47,7 @@ public class QProfileDecoratorTest { DecoratorContext decoratorContext = mock(DecoratorContext.class); @Test - public void don_t_run_on_leaf() throws Exception { + public void don_t_run_on_leaf() { QProfileDecorator decorator = new QProfileDecorator(); when(project.getModules()).thenReturn(Collections.emptyList()); assertThat(decorator.shouldExecuteOnProject(project)).isFalse(); @@ -57,7 +57,7 @@ public class QProfileDecoratorTest { } @Test - public void aggregate() throws Exception { + public void aggregate() { Measure measureModuleA = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA_JSON + "]"); Measure measureModuleB = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA_JSON + "]"); Measure measureModuleC = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + PHP_JSON + "]"); @@ -73,7 +73,7 @@ public class QProfileDecoratorTest { } @Test - public void aggregate_different_profiles_with_same_language() throws Exception { + public void aggregate_different_profiles_with_same_language() { Measure measureModuleA = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA_JSON + "]"); Measure measureModuleB = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA2_JSON + "]"); when(decoratorContext.getChildrenMeasures(CoreMetrics.QUALITY_PROFILES)).thenReturn(Arrays.asList(measureModuleA, measureModuleB)); diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java index 7c83baad914..f362690979a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java @@ -62,13 +62,13 @@ public class QProfileSensorTest { } @Test - public void to_string() throws Exception { + public void to_string() { QProfileSensor sensor = new QProfileSensor(moduleQProfiles, fs, mock(AnalysisMode.class)); assertThat(sensor.toString()).isEqualTo("QProfileSensor"); } @Test - public void no_execution_in_preview() throws Exception { + public void no_execution_in_preview() { AnalysisMode analysisMode = mock(AnalysisMode.class); when(analysisMode.isPreview()).thenReturn(true); QProfileSensor sensor = new QProfileSensor(moduleQProfiles, fs, analysisMode); @@ -77,7 +77,7 @@ public class QProfileSensorTest { } @Test - public void no_qprofiles() throws Exception { + public void no_qprofiles() { when(moduleQProfiles.findAll()).thenReturn(Collections.emptyList()); QProfileSensor sensor = new QProfileSensor(moduleQProfiles, fs, mock(AnalysisMode.class)); @@ -89,7 +89,7 @@ public class QProfileSensorTest { } @Test - public void mark_profiles_as_used() throws Exception { + public void mark_profiles_as_used() { when(moduleQProfiles.findByLanguage("java")).thenReturn(JAVA_PROFILE); when(moduleQProfiles.findByLanguage("php")).thenReturn(PHP_PROFILE); when(moduleQProfiles.findByLanguage("abap")).thenReturn(null); @@ -101,7 +101,7 @@ public class QProfileSensorTest { } @Test - public void store_measures_on_single_lang_module() throws Exception { + public void store_measures_on_single_lang_module() { when(moduleQProfiles.findByLanguage("java")).thenReturn(JAVA_PROFILE); when(moduleQProfiles.findByLanguage("php")).thenReturn(PHP_PROFILE); when(moduleQProfiles.findByLanguage("abap")).thenReturn(null); @@ -117,7 +117,7 @@ public class QProfileSensorTest { } @Test - public void store_measures_on_multi_lang_module() throws Exception { + public void store_measures_on_multi_lang_module() { when(moduleQProfiles.findByLanguage("java")).thenReturn(JAVA_PROFILE); when(moduleQProfiles.findByLanguage("php")).thenReturn(PHP_PROFILE); when(moduleQProfiles.findByLanguage("abap")).thenReturn(null); diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java index e1a52981d12..bfa14cf91bc 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java @@ -40,7 +40,7 @@ public class RulesProfileProviderTest { RulesProfileProvider provider = new RulesProfileProvider(); @Test - public void merge_profiles() throws Exception { + public void merge_profiles() { QProfile qProfile = new QProfile().setKey("java-sw").setName("Sonar way").setLanguage("java"); when(qProfiles.findAll()).thenReturn(Arrays.asList(qProfile)); @@ -60,7 +60,7 @@ public class RulesProfileProviderTest { } @Test - public void keep_compatibility_with_single_language_projects() throws Exception { + public void keep_compatibility_with_single_language_projects() { settings.setProperty("sonar.language", "java"); QProfile qProfile = new QProfile().setKey("java-sw").setName("Sonar way").setLanguage("java"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java index e14e9fb7fda..79ba7df94bc 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java @@ -55,7 +55,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { RulesProvider provider; @Before - public void setUp() throws Exception { + public void setUp() { debtModel = new DefaultDebtModel() .addCharacteristic(new DefaultDebtCharacteristic() .setId(100) @@ -86,7 +86,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules() throws Exception { + public void build_rules() { setupData("shared"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -110,7 +110,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_default_debt_definitions() throws Exception { + public void build_rules_with_default_debt_definitions() { setupData("build_rules_with_default_debt_definitions"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -121,7 +121,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_overridden_debt_definitions() throws Exception { + public void build_rules_with_overridden_debt_definitions() { setupData("build_rules_with_overridden_debt_definitions"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -132,7 +132,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_default_and_overridden_debt_definitions() throws Exception { + public void build_rules_with_default_and_overridden_debt_definitions() { setupData("build_rules_with_default_and_overridden_debt_definitions"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -144,7 +144,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_default_characteristic_and_overridden_function() throws Exception { + public void build_rules_with_default_characteristic_and_overridden_function() { setupData("build_rules_with_default_characteristic_and_overridden_function"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -156,7 +156,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_overridden_characteristic_and_default_function() throws Exception { + public void build_rules_with_overridden_characteristic_and_default_function() { setupData("build_rules_with_overridden_characteristic_and_default_function"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -168,7 +168,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_disable_characteristic() throws Exception { + public void build_rules_with_disable_characteristic() { setupData("build_rules_with_disable_characteristic"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -179,7 +179,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void build_rules_with_default_characteristic_and_disable_characteristic() throws Exception { + public void build_rules_with_default_characteristic_and_disable_characteristic() { setupData("build_rules_with_default_characteristic_and_disable_characteristic"); Rules rules = provider.provide(ruleDao, debtModel, durations); @@ -190,7 +190,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void fail_if_characteristic_not_found() throws Exception { + public void fail_if_characteristic_not_found() { setupData("fail_if_characteristic_not_found"); try { @@ -202,7 +202,7 @@ public class RulesProviderTest extends AbstractDaoTestCase { } @Test - public void fail_if_no_function() throws Exception { + public void fail_if_no_function() { setupData("fail_if_no_function"); try { diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java index 131f3a0b6e4..1a26aeba91d 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java @@ -33,7 +33,7 @@ public class UsedQProfilesTest { static final String PHP_JSON = "{\"key\":\"p2\",\"language\":\"php\",\"name\":\"Sonar Way\",\"rulesUpdatedAt\":\"2014-02-20T00:00:00+0000\"}"; @Test - public void from_and_to_json() throws Exception { + public void from_and_to_json() { QProfile java = new QProfile().setKey("p1").setName("Sonar Way").setLanguage("java") .setRulesUpdatedAt(UtcDateUtils.parseDateTime("2014-01-15T00:00:00+0000")); QProfile php = new QProfile().setKey("p2").setName("Sonar Way").setLanguage("php") @@ -50,7 +50,7 @@ public class UsedQProfilesTest { } @Test - public void do_not_duplicate_profiles() throws Exception { + public void do_not_duplicate_profiles() { QProfile java = new QProfile().setKey("p1").setName("Sonar Way").setLanguage("java"); QProfile php = new QProfile().setKey("p2").setName("Sonar Way").setLanguage("php"); @@ -59,7 +59,7 @@ public class UsedQProfilesTest { } @Test - public void group_profiles_by_key() throws Exception { + public void group_profiles_by_key() { QProfile java = new QProfile().setKey("p1").setName("Sonar Way").setLanguage("java"); QProfile php = new QProfile().setKey("p2").setName("Sonar Way").setLanguage("php"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java index 8aa7f9a1485..bda4e1613bc 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java @@ -166,7 +166,7 @@ public class DeprecatedProjectReactorBuilderTest { } @Test - public void shouldFailIfUnexistingModuleFile() throws IOException { + public void shouldFailIfUnexistingModuleFile() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The properties file of the module 'module1' does not exist: " + TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-file").getAbsolutePath() + File.separator + "any-folder" @@ -175,7 +175,7 @@ public class DeprecatedProjectReactorBuilderTest { loadProjectDefinition("multi-module-with-unexisting-file"); } - private ProjectDefinition loadProjectDefinition(String projectFolder) throws IOException { + private ProjectDefinition loadProjectDefinition(String projectFolder) { Map props = Maps.newHashMap(); Properties runnerProps = ProjectReactorBuilder.toProperties(TestUtils.getResource(this.getClass(), projectFolder + "/sonar-project.properties")); for (final String name : runnerProps.stringPropertyNames()) { diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java index 420d0641c36..dc6e6f3afb6 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java @@ -52,7 +52,7 @@ public class LanguageVerifierTest { } @Test - public void language_is_not_set() throws Exception { + public void language_is_not_set() { LanguageVerifier verifier = new LanguageVerifier(settings, languages, fs); verifier.start(); @@ -63,7 +63,7 @@ public class LanguageVerifierTest { } @Test - public void language_is_valid() throws Exception { + public void language_is_valid() { settings.setProperty("sonar.language", "java"); LanguageVerifier verifier = new LanguageVerifier(settings, languages, fs); @@ -76,7 +76,7 @@ public class LanguageVerifierTest { } @Test - public void language_is_not_valid() throws Exception { + public void language_is_not_valid() { thrown.expect(MessageException.class); thrown.expectMessage("You must install a plugin that supports the language 'php'"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java index efc81035a6d..617149c60ec 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java @@ -44,7 +44,7 @@ public class ProjectReactorBuilderTest { public ExpectedException thrown = ExpectedException.none(); @Test - public void shouldDefineSimpleProject() throws IOException { + public void shouldDefineSimpleProject() { ProjectDefinition projectDefinition = loadProjectDefinition("simple-project"); assertThat(projectDefinition.getKey()).isEqualTo("com.foo.project"); @@ -57,7 +57,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfUnexistingSourceDirectory() throws IOException { + public void shouldFailIfUnexistingSourceDirectory() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The folder 'unexisting-source-dir' does not exist for 'com.foo.project' (base directory = " + TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-source-dir") + ")"); @@ -66,14 +66,14 @@ public class ProjectReactorBuilderTest { } @Test - public void fail_if_sources_not_set() throws IOException { + public void fail_if_sources_not_set() { thrown.expect(IllegalStateException.class); thrown.expectMessage("You must define the following mandatory properties for 'com.foo.project': sonar.sources"); loadProjectDefinition("simple-project-with-missing-source-dir"); } @Test - public void shouldNotFailIfBlankSourceDirectory() throws IOException { + public void shouldNotFailIfBlankSourceDirectory() { loadProjectDefinition("simple-project-with-blank-source-dir"); } @@ -145,7 +145,7 @@ public class ProjectReactorBuilderTest { // SONAR-4876 @Test - public void shouldDefineMultiModuleProjectWithModuleKey() throws IOException { + public void shouldDefineMultiModuleProjectWithModuleKey() { ProjectDefinition rootProject = loadProjectDefinition("multi-module-definitions-moduleKey"); // CHECK ROOT @@ -194,7 +194,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldDefineMultiModuleProjectWithBaseDir() throws IOException { + public void shouldDefineMultiModuleProjectWithBaseDir() { ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-basedir"); List modules = rootProject.getSubProjects(); assertThat(modules.size()).isEqualTo(1); @@ -202,7 +202,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfUnexistingModuleBaseDir() throws IOException { + public void shouldFailIfUnexistingModuleBaseDir() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The base directory of the module 'module1' does not exist: " + TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-basedir").getAbsolutePath() + File.separator + "module1"); @@ -211,7 +211,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfUnexistingSourceFolderInheritedInMultimodule() throws IOException { + public void shouldFailIfUnexistingSourceFolderInheritedInMultimodule() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The folder 'unexisting-source-dir' does not exist for 'com.foo.project:module1' (base directory = " + TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-source-dir").getAbsolutePath() + File.separator + "module1)"); @@ -220,12 +220,12 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldNotFailIfUnexistingTestBinLibFolderInheritedInMultimodule() throws IOException { + public void shouldNotFailIfUnexistingTestBinLibFolderInheritedInMultimodule() { loadProjectDefinition("multi-module-with-unexisting-test-bin-lib-dir"); } @Test - public void shouldFailIfExplicitUnexistingTestFolder() throws IOException { + public void shouldFailIfExplicitUnexistingTestFolder() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The folder 'tests' does not exist for 'com.foo.project' (base directory = " + TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-test-dir").getAbsolutePath()); @@ -234,7 +234,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfExplicitUnexistingBinaryFolder() throws IOException { + public void shouldFailIfExplicitUnexistingBinaryFolder() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The folder 'bin' does not exist for 'com.foo.project' (base directory = " + TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-binary").getAbsolutePath()); @@ -243,7 +243,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfExplicitUnmatchingLibFolder() throws IOException { + public void shouldFailIfExplicitUnmatchingLibFolder() { thrown.expect(IllegalStateException.class); thrown.expectMessage("No files nor directories matching 'libs/*.txt' in directory " + TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-lib").getAbsolutePath()); @@ -252,7 +252,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldGetLibDirectory() throws IOException { + public void shouldGetLibDirectory() { ProjectDefinition def = loadProjectDefinition("simple-project-with-lib-dir"); assertThat(def.getLibraries()).hasSize(1); File libDir = new File(def.getLibraries().get(0)); @@ -261,7 +261,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfExplicitUnexistingTestFolderOnModule() throws IOException { + public void shouldFailIfExplicitUnexistingTestFolderOnModule() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The folder 'tests' does not exist for 'module1' (base directory = " + TestUtils.getResource(this.getClass(), "multi-module-with-explicit-unexisting-test-dir").getAbsolutePath() + File.separator + "module1)"); @@ -270,7 +270,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfExplicitUnexistingBinaryFolderOnModule() throws IOException { + public void shouldFailIfExplicitUnexistingBinaryFolderOnModule() { thrown.expect(IllegalStateException.class); thrown.expectMessage("The folder 'bin' does not exist for 'module1' (base directory = " + TestUtils.getResource(this.getClass(), "multi-module-with-explicit-unexisting-binary-dir").getAbsolutePath() + File.separator + "module1)"); @@ -279,7 +279,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailIfExplicitUnmatchingLibFolderOnModule() throws IOException { + public void shouldFailIfExplicitUnmatchingLibFolderOnModule() { thrown.expect(IllegalStateException.class); thrown.expectMessage("No files nor directories matching 'lib/*.jar' in directory " + TestUtils.getResource(this.getClass(), "multi-module-with-explicit-unexisting-lib").getAbsolutePath() + File.separator + "module1"); @@ -288,7 +288,7 @@ public class ProjectReactorBuilderTest { } @Test - public void multiModuleProperties() throws IOException { + public void multiModuleProperties() { ProjectDefinition projectDefinition = loadProjectDefinition("big-multi-module-definitions-all-in-root"); assertThat(projectDefinition.getProperties().getProperty("module11.property")).isNull(); @@ -375,7 +375,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFilterFiles() throws Exception { + public void shouldFilterFiles() { File baseDir = TestUtils.getResource(this.getClass(), "shouldFilterFiles"); assertThat(ProjectReactorBuilder.getLibraries(baseDir, "in*.txt")).hasSize(1); assertThat(ProjectReactorBuilder.getLibraries(baseDir, "*.txt")).hasSize(2); @@ -384,7 +384,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldWorkWithAbsolutePath() throws Exception { + public void shouldWorkWithAbsolutePath() { File baseDir = new File("not-exists"); String absolutePattern = TestUtils.getResource(this.getClass(), "shouldFilterFiles").getAbsolutePath() + "/in*.txt"; assertThat(ProjectReactorBuilder.getLibraries(baseDir.getParentFile(), absolutePattern)).hasSize(1); @@ -507,14 +507,14 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldFailToLoadPropertiesFile() throws Exception { + public void shouldFailToLoadPropertiesFile() { thrown.expect(IllegalStateException.class); thrown.expectMessage("Impossible to read the property file"); ProjectReactorBuilder.toProperties(new File("foo.properties")); } - private ProjectDefinition loadProjectDefinition(String projectFolder) throws IOException { + private ProjectDefinition loadProjectDefinition(String projectFolder) { Map props = loadProps(projectFolder); TaskProperties bootstrapProps = new TaskProperties(props, null); ProjectReactor projectReactor = new ProjectReactorBuilder(bootstrapProps).execute(); @@ -556,7 +556,7 @@ public class ProjectReactorBuilderTest { } @Test - public void shouldDefineProjectWithBuildDir() throws IOException { + public void shouldDefineProjectWithBuildDir() { ProjectDefinition rootProject = loadProjectDefinition("simple-project-with-build-dir"); File buildDir = rootProject.getBuildDir(); assertThat(buildDir).isDirectory().exists(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java index c32b7b5cf0c..504a734ff7f 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java @@ -52,7 +52,7 @@ public class ProjectReactorValidatorTest { } @Test - public void not_fail_if_provisioning_enforced_and_project_exists() throws Exception { + public void not_fail_if_provisioning_enforced_and_project_exists() { String key = "project-key"; settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true); when(resourceDao.findByKey(key)).thenReturn(mock(Component.class)); @@ -61,7 +61,7 @@ public class ProjectReactorValidatorTest { } @Test - public void not_fail_if_provisioning_enforced_and_project_with_branch_exists() throws Exception { + public void not_fail_if_provisioning_enforced_and_project_with_branch_exists() { String key = "project-key"; settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true); when(resourceDao.findByKey(key + ":branch")).thenReturn(mock(Component.class)); @@ -70,7 +70,7 @@ public class ProjectReactorValidatorTest { } @Test(expected = SonarException.class) - public void fail_if_provisioning_enforced_and_project_not_provisioned() throws Exception { + public void fail_if_provisioning_enforced_and_project_not_provisioned() { String key = "project-key"; settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true); when(resourceDao.findByKey(key)).thenReturn(null); @@ -80,7 +80,7 @@ public class ProjectReactorValidatorTest { // SONAR-4692 @Test(expected = SonarException.class) - public void fail_if_module_part_of_another_project() throws Exception { + public void fail_if_module_part_of_another_project() { String rootProjectKey = "project-key"; String moduleKey = "module-key"; ResourceDto rootResource = mock(ResourceDto.class); @@ -95,7 +95,7 @@ public class ProjectReactorValidatorTest { // SONAR-4692 @Test - public void not_fail_if_module_part_of_same_project() throws Exception { + public void not_fail_if_module_part_of_same_project() { String rootProjectKey = "project-key"; String moduleKey = "module-key"; ResourceDto rootResource = mock(ResourceDto.class); @@ -110,7 +110,7 @@ public class ProjectReactorValidatorTest { // SONAR-4692 @Test - public void not_fail_if_new_module() throws Exception { + public void not_fail_if_new_module() { String rootProjectKey = "project-key"; String moduleKey = "module-key"; diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java index ad3dfffc491..a2ce7e460b3 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java @@ -34,7 +34,7 @@ public class AdditionalFilePredicatesTest { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void key() throws Exception { + public void key() { FilePredicate predicate = new AdditionalFilePredicates.KeyPredicate("struts:Action.java"); DefaultInputFile inputFile = new DeprecatedDefaultInputFile("struts", "Action.java"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java index 7f954c405a2..c33afe1f59f 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java @@ -149,7 +149,7 @@ public class DefaultModuleFileSystemTest { } @Test - public void should_index() throws Exception { + public void should_index() { DefaultModuleFileSystem fs = new DefaultModuleFileSystem(moduleInputFileCache, new Project("foo"), settings, fileIndexer, initializer, componentIndexer); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java index 3235301f031..2797d65ea20 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java @@ -46,7 +46,7 @@ public class DeprecatedFileFiltersTest { FileSystemFilter filter = mock(FileSystemFilter.class); @Test - public void no_filters() throws Exception { + public void no_filters() { DeprecatedFileFilters filters = new DeprecatedFileFilters(); InputFile inputFile = new DeprecatedDefaultInputFile("foo", "src/main/java/Foo.java"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java index c5bd36cddf5..e638bd42efb 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java @@ -123,7 +123,7 @@ public class ExclusionFiltersTest { } @Test - public void trim_pattern() throws IOException { + public void trim_pattern() { Settings settings = new Settings(); settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, " **/*Dao.java "); ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings)); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java index 0c83abfa01e..60f85a52e17 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java @@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock; public class InputFileBuilderFactoryTest { @Test - public void create_builder() throws Exception { + public void create_builder() { PathResolver pathResolver = new PathResolver(); LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS); StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java index f14e2a9b957..84b24fa9355 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java @@ -39,7 +39,7 @@ public class InputPathCacheTest { public TemporaryFolder temp = new TemporaryFolder(); @Before - public void start() throws Exception { + public void start() { } @After diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java index 95d3631eaa5..65ae7125c60 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java @@ -122,7 +122,7 @@ public class LanguageDetectionTest { } @Test - public void fail_if_invalid_language() throws Exception { + public void fail_if_invalid_language() { thrown.expect(MessageException.class); thrown.expectMessage("No language is installed with key 'unknown'. Please update property 'sonar.language'"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java index cc5feed7883..c8db34b4542 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class StatusDetectionTest { @Test - public void detect_status() throws Exception { + public void detect_status() { ProjectRepositories ref = new ProjectRepositories(); ref.addFileData("foo", "src/Foo.java", new FileData("ABCDE", true)); ref.addFileData("foo", "src/Bar.java", new FileData("FGHIJ", true)); diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java index fce979b23c4..598f2a5ce2e 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java @@ -69,7 +69,7 @@ public class MeasureCacheTest { private MeasureCache cache; @Before - public void start() throws Exception { + public void start() { caches = CachesTest.createCacheOnTemp(temp); caches.start(); metricFinder = mock(MetricFinder.class); @@ -84,7 +84,7 @@ public class MeasureCacheTest { } @Test - public void should_add_measure() throws Exception { + public void should_add_measure() { Project p = new Project("struts"); assertThat(cache.entries()).hasSize(0); @@ -114,7 +114,7 @@ public class MeasureCacheTest { } @Test - public void should_add_measure_with_big_data() throws Exception { + public void should_add_measure_with_big_data() { Project p = new Project("struts"); assertThat(cache.entries()).hasSize(0); @@ -153,7 +153,7 @@ public class MeasureCacheTest { * This test fails with stock PersisitIt. */ @Test - public void should_add_measure_with_too_big_data_for_persistit_pre_patch() throws Exception { + public void should_add_measure_with_too_big_data_for_persistit_pre_patch() { Project p = new Project("struts"); assertThat(cache.entries()).hasSize(0); @@ -188,7 +188,7 @@ public class MeasureCacheTest { } @Test - public void should_add_measure_with_too_big_data_for_persistit() throws Exception { + public void should_add_measure_with_too_big_data_for_persistit() { Project p = new Project("struts"); assertThat(cache.entries()).hasSize(0); @@ -210,7 +210,7 @@ public class MeasureCacheTest { } @Test - public void should_add_measure_with_same_metric() throws Exception { + public void should_add_measure_with_same_metric() { Project p = new Project("struts"); assertThat(cache.entries()).hasSize(0); @@ -231,7 +231,7 @@ public class MeasureCacheTest { } @Test - public void should_get_measures() throws Exception { + public void should_get_measures() { Project p = new Project("struts"); Resource dir = Directory.create("foo/bar").setEffectiveKey("struts:foo/bar"); Resource file1 = Directory.create("foo/bar/File1.txt").setEffectiveKey("struts:foo/bar/File1.txt"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java b/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java index 12d5e00dc0c..968544e84fa 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java @@ -60,14 +60,14 @@ public class SensorOptimizerTest { } @Test - public void should_run_analyzer_with_no_metadata() throws Exception { + public void should_run_analyzer_with_no_metadata() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor(); assertThat(optimizer.shouldExecute(descriptor)).isTrue(); } @Test - public void should_optimize_on_language() throws Exception { + public void should_optimize_on_language() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() .onlyOnLanguages("java", "php"); assertThat(optimizer.shouldExecute(descriptor)).isFalse(); @@ -77,7 +77,7 @@ public class SensorOptimizerTest { } @Test - public void should_optimize_on_type() throws Exception { + public void should_optimize_on_type() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() .onlyOnFileType(InputFile.Type.MAIN); assertThat(optimizer.shouldExecute(descriptor)).isFalse(); @@ -90,7 +90,7 @@ public class SensorOptimizerTest { } @Test - public void should_optimize_on_both_type_and_language() throws Exception { + public void should_optimize_on_both_type_and_language() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() .onlyOnLanguages("java", "php") .onlyOnFileType(InputFile.Type.MAIN); @@ -105,7 +105,7 @@ public class SensorOptimizerTest { } @Test - public void should_optimize_on_repository() throws Exception { + public void should_optimize_on_repository() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() .createIssuesForRuleRepositories("squid"); assertThat(optimizer.shouldExecute(descriptor)).isFalse(); @@ -129,7 +129,7 @@ public class SensorOptimizerTest { } @Test - public void should_optimize_on_settings() throws Exception { + public void should_optimize_on_settings() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() .requireProperty("sonar.foo.reportPath"); assertThat(optimizer.shouldExecute(descriptor)).isFalse(); @@ -139,7 +139,7 @@ public class SensorOptimizerTest { } @Test - public void should_disabled_in_preview() throws Exception { + public void should_disabled_in_preview() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() .disabledInPreview(); assertThat(optimizer.shouldExecute(descriptor)).isTrue(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java index 7b3d3987bf3..4ef06e4a0e5 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java @@ -40,7 +40,7 @@ public class DefaultHighlightableTest { public ExpectedException throwable = ExpectedException.none(); @Test - public void should_store_highlighting_rules() throws Exception { + public void should_store_highlighting_rules() { SensorStorage sensorStorage = mock(SensorStorage.class); DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php") .initMetadata(new FileMetadata().readMetadata(new StringReader("azerty\nbla bla"))); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java index a0489a7c209..385ce1bbd6a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java @@ -47,7 +47,7 @@ public class DefaultSymbolTableTest { } @Test - public void should_order_symbol_and_references() throws Exception { + public void should_order_symbol_and_references() { Symbolizable.SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTable.Builder(inputFile); Symbol firstSymbol = symbolTableBuilder.newSymbol(10, 20); @@ -62,7 +62,7 @@ public class DefaultSymbolTableTest { } @Test - public void should_reject_reference_conflicting_with_declaration() throws Exception { + public void should_reject_reference_conflicting_with_declaration() { throwable.expect(UnsupportedOperationException.class); Symbolizable.SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTable.Builder(inputFile); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java index d3b1018ace5..21803da6c85 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.verify; public class DefaultSymbolizableTest { @Test - public void should_update_cache_when_done() throws Exception { + public void should_update_cache_when_done() { DefaultSensorStorage sensorStorage = mock(DefaultSensorStorage.class); DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php") diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java index 893957a80a5..e98f3bad906 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.when; public class HighlightableBuilderTest { @Test - public void should_load_default_perspective() throws Exception { + public void should_load_default_perspective() { Resource file = File.create("foo.c").setEffectiveKey("myproject:path/to/foo.c"); Component component = new ResourceComponent(file); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java index 16c4fe669a7..8a1d3cbe580 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.when; public class SymbolizableBuilderTest { @Test - public void should_load_perspective() throws Exception { + public void should_load_perspective() { Resource file = File.create("foo.c").setEffectiveKey("myproject:path/to/foo.c"); Component component = new ResourceComponent(file); diff --git a/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java index 40c9df1e3f9..ce1dc931ff6 100644 --- a/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java @@ -29,13 +29,13 @@ import static org.junit.Assert.fail; public class UtcDateUtilsTest { @Test - public void parse_then_format() throws Exception { + public void parse_then_format() { Date date = UtcDateUtils.parseDateTime("2014-01-14T14:00:00+0200"); assertThat(UtcDateUtils.formatDateTime(date)).isEqualTo("2014-01-14T12:00:00+0000"); } @Test - public void fail_if_bad_format() throws Exception { + public void fail_if_bad_format() { try { UtcDateUtils.parseDateTime("2014-01-14"); fail(); diff --git a/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java b/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java index ddc26aaa064..5383b6472d1 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ComponentDtoTest { @Test - public void setters_and_getters() throws Exception { + public void setters_and_getters() { ComponentDto componentDto = new ComponentDto() .setId(1L) .setKey("org.struts:struts-core:src/org/struts/RequestContext.java") @@ -59,7 +59,7 @@ public class ComponentDtoTest { } @Test - public void equals_and_hashcode() throws Exception { + public void equals_and_hashcode() { ComponentDto dto = new ComponentDto().setId(1L); ComponentDto dtoWithSameId = new ComponentDto().setId(1L); ComponentDto dtoWithDifferentId = new ComponentDto().setId(2L); @@ -74,13 +74,13 @@ public class ComponentDtoTest { } @Test - public void toString_does_not_fail_if_empty() throws Exception { + public void toString_does_not_fail_if_empty() { ComponentDto dto = new ComponentDto(); assertThat(dto.toString()).isNotEmpty(); } @Test - public void is_root_project() throws Exception { + public void is_root_project() { assertThat(new ComponentDto().setModuleUuid("ABCD").isRootProject()).isFalse(); assertThat(new ComponentDto().setModuleUuid("ABCD").setScope(Scopes.DIRECTORY).isRootProject()).isFalse(); assertThat(new ComponentDto().setModuleUuid(null).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT).isRootProject()).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java b/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java index 2de2110104f..d699dc6a30e 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java @@ -34,7 +34,7 @@ import static org.mockito.Mockito.when; public class GraphPerspectiveBuilderTest { @Test - public void should_return_null_on_null_component() throws Exception { + public void should_return_null_on_null_component() { String componentKey = "org.foo.Bar"; @@ -55,7 +55,7 @@ public class GraphPerspectiveBuilderTest { } @Test - public void should_load_perspective() throws Exception { + public void should_load_perspective() { ScanGraph graph = ScanGraph.create(); MutablePerspective expectedPerspective = mock(MutablePerspective.class); @@ -73,7 +73,7 @@ public class GraphPerspectiveBuilderTest { } @Test - public void should_create_perspective_when_loaded_one_is_null() throws Exception { + public void should_create_perspective_when_loaded_one_is_null() { String perspectiveKey = "perspectiveKey"; diff --git a/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java b/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java index 35d53aba1bf..bdd39ad8b61 100644 --- a/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java +++ b/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java @@ -54,7 +54,7 @@ public class DefaultPurgeTaskTest { private PurgeProfiler profiler; @Before - public void before() throws Exception { + public void before() { this.purgeDao = mock(PurgeDao.class); this.resourceDao = mock(ResourceDao.class); when(resourceDao.getResource(anyLong())).thenReturn(new ResourceDto().setQualifier(Qualifiers.PROJECT).setUuid("1").setId(1L)); @@ -140,7 +140,7 @@ public class DefaultPurgeTaskTest { } @Test - public void call_dao_delete_when_deleting() throws Exception { + public void call_dao_delete_when_deleting() { when(resourceDao.getResource(123L)).thenReturn(new ResourceDto().setId(123L).setUuid("A")); sut.delete(123L); diff --git a/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java b/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java index 4f3ec24bae7..1d03f781ffb 100644 --- a/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java @@ -37,13 +37,13 @@ public class ActiveDashboardDaoTest { private ActiveDashboardDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dbTester.truncateTables(); dao = new ActiveDashboardDao(dbTester.myBatis()); } @Test - public void shouldInsert() throws Exception { + public void shouldInsert() { dbTester.prepareDbUnit(getClass(), "shouldInsert.xml"); ActiveDashboardDto dashboard = new ActiveDashboardDto(); @@ -56,7 +56,7 @@ public class ActiveDashboardDaoTest { } @Test - public void shouldInsertWithNoUser() throws Exception { + public void shouldInsertWithNoUser() { dbTester.prepareDbUnit(getClass(), "shouldInsert.xml"); ActiveDashboardDto dashboard = new ActiveDashboardDto(); @@ -68,7 +68,7 @@ public class ActiveDashboardDaoTest { } @Test - public void shouldGetMaxOrderIndexForNullUser() throws Exception { + public void shouldGetMaxOrderIndexForNullUser() { dbTester.prepareDbUnit(getClass(), "shouldGetMaxOrderIndexForNullUser.xml"); int index = dao.selectMaxOrderIndexForNullUser(); @@ -77,7 +77,7 @@ public class ActiveDashboardDaoTest { } @Test - public void shouldGetZeroMaxOrderIndex() throws Exception { + public void shouldGetZeroMaxOrderIndex() { dbTester.prepareDbUnit(getClass(), "empty.xml"); int index = dao.selectMaxOrderIndexForNullUser(); @@ -86,28 +86,28 @@ public class ActiveDashboardDaoTest { } @Test - public void should_get_dashboards_for_anonymous() throws Exception { + public void should_get_dashboards_for_anonymous() { dbTester.prepareDbUnit(getClass(), "shouldSelectDashboardsForAnonymous.xml"); assertThat(dao.selectGlobalDashboardsForUserLogin(null)).hasSize(2).extracting("id").containsExactly(2L, 1L); } @Test - public void should_get_dashboards_for_user() throws Exception { + public void should_get_dashboards_for_user() { dbTester.prepareDbUnit(getClass(), "shouldSelectDashboardsForUser.xml"); assertThat(dao.selectGlobalDashboardsForUserLogin("obiwan")).hasSize(2).extracting("id").containsExactly(2L, 1L); } @Test - public void should_get_project_dashboards_for_anonymous() throws Exception { + public void should_get_project_dashboards_for_anonymous() { dbTester.prepareDbUnit(getClass(), "shouldSelectProjectDashboardsForAnonymous.xml"); assertThat(dao.selectProjectDashboardsForUserLogin(null)).hasSize(2).extracting("id").containsExactly(2L, 1L); } @Test - public void should_get_project_dashboards_for_user() throws Exception { + public void should_get_project_dashboards_for_user() { dbTester.prepareDbUnit(getClass(), "shouldSelectProjectDashboardsForUser.xml"); assertThat(dao.selectProjectDashboardsForUserLogin("obiwan")).hasSize(2).extracting("id").containsExactly(2L, 1L); diff --git a/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java b/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java index f4a76577d5d..f7ddd44cbf2 100644 --- a/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java @@ -94,7 +94,7 @@ public class DashboardDaoTest { } @Test - public void shouldInsertWithNullableColumns() throws Exception { + public void shouldInsertWithNullableColumns() { dbTester.prepareDbUnit(getClass(), "shouldInsert.xml"); DashboardDto dashboardDto = new DashboardDto(); diff --git a/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java b/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java index 90bb71c54dd..ba7a89ce431 100644 --- a/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java @@ -34,12 +34,12 @@ public class DuplicationDaoTest extends AbstractDaoTestCase { private DuplicationDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new DuplicationDao(getMyBatis()); } @Test - public void shouldGetByHash() throws Exception { + public void shouldGetByHash() { setupData("shouldGetByHash"); List blocks = dao.selectCandidates(10, 7, "java"); @@ -58,7 +58,7 @@ public class DuplicationDaoTest extends AbstractDaoTestCase { } @Test - public void shouldInsert() throws Exception { + public void shouldInsert() { setupData("shouldInsert"); dao.insert(Arrays.asList(new DuplicationUnitDto(1, 2, "bb", 0, 1, 2))); diff --git a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java index 233f086e976..c877a1493bc 100644 --- a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java @@ -39,7 +39,7 @@ import java.util.Set; public class GraphsonReaderTest { @Test - public void inputGraphModeExtended() throws Exception { + public void inputGraphModeExtended() { TinkerGraph graph = new TinkerGraph(); String json = "{ \"mode\":\"EXTENDED\", \"vertices\": [ {\"_id\":1, \"_type\":\"vertex\", \"test\": { \"type\":\"string\", \"value\":\"please work\"}, \"testlist\":{\"type\":\"list\", \"value\":[{\"type\":\"int\", \"value\":1}, {\"type\":\"int\",\"value\":2}, {\"type\":\"int\",\"value\":3}, {\"type\":\"unknown\",\"value\":null}]}, \"testmap\":{\"type\":\"map\", \"value\":{\"big\":{\"type\":\"long\", \"value\":10000000000}, \"small\":{\"type\":\"double\", \"value\":0.4954959595959}, \"nullKey\":{\"type\":\"unknown\", \"value\":null}}}}, {\"_id\":2, \"_type\":\"vertex\", \"testagain\":{\"type\":\"string\", \"value\":\"please work again\"}}], \"edges\":[{\"_id\":100, \"_type\":\"edge\", \"_outV\":1, \"_inV\":2, \"_label\":\"works\", \"teste\": {\"type\":\"string\", \"value\":\"please worke\"}, \"keyNull\":{\"type\":\"unknown\", \"value\":null}}]}"; @@ -88,7 +88,7 @@ public class GraphsonReaderTest { } @Test - public void inputGraphModeNormal() throws Exception { + public void inputGraphModeNormal() { TinkerGraph graph = new TinkerGraph(); String json = "{ \"mode\":\"NORMAL\",\"vertices\": [ {\"_id\":1, \"_type\":\"vertex\", \"test\": \"please work\", \"testlist\":[1, 2, 3, null], \"testmap\":{\"big\":10000000000, \"small\":0.4954959595959, \"nullKey\":null}}, {\"_id\":2, \"_type\":\"vertex\", \"testagain\":\"please work again\"}], \"edges\":[{\"_id\":100, \"_type\":\"edge\", \"_outV\":1, \"_inV\":2, \"_label\":\"works\", \"teste\": \"please worke\", \"keyNull\":null}]}"; @@ -137,7 +137,7 @@ public class GraphsonReaderTest { } @Test - public void inputGraphModeCompact() throws Exception { + public void inputGraphModeCompact() { TinkerGraph graph = new TinkerGraph(); String json = "{ \"mode\":\"COMPACT\",\"vertices\": [ {\"_id\":1, \"test\": \"please work\", \"testlist\":[1, 2, 3, null], \"testmap\":{\"big\":10000000000, \"small\":0.4954959595959, \"nullKey\":null}}, {\"_id\":2, \"testagain\":\"please work again\"}], \"edges\":[{\"_id\":100, \"_outV\":1, \"_inV\":2, \"_label\":\"works\", \"teste\": \"please worke\", \"keyNull\":null}]}"; diff --git a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java index 607ffc3d0a0..6fb3611a9ef 100644 --- a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java +++ b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java @@ -994,7 +994,7 @@ public class GraphsonUtilTest { } @Test - public void vertexFromJsonIgnoreKeyValid() throws Exception { + public void vertexFromJsonIgnoreKeyValid() { Graph g = new TinkerGraph(); ElementFactory factory = new ElementFactory(g); diff --git a/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java b/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java index 57db8e33aef..971a7573965 100644 --- a/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java @@ -69,7 +69,7 @@ public class I18nClassloaderTest { } @Test - public void override_toString() throws ClassNotFoundException { + public void override_toString() { assertThat(i18nClassloader.toString()).isEqualTo("i18n-classloader"); } diff --git a/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java b/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java index 2132f0b32fe..9950e249cb6 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java @@ -36,7 +36,7 @@ public class ActionPlanDeadlineComparatorTest { ActionPlan noDeadline = new DefaultActionPlan().setDeadLine(null); @Test - public void compare_plans_with_deadlines() throws Exception { + public void compare_plans_with_deadlines() { List plans = Arrays.asList(shortTerm, longTerm); Collections.sort(plans, new ActionPlanDeadlineComparator()); assertThat(plans).containsSequence(shortTerm, longTerm); @@ -47,7 +47,7 @@ public class ActionPlanDeadlineComparatorTest { } @Test - public void end_with_plans_without_deadline() throws Exception { + public void end_with_plans_without_deadline() { List plans = Arrays.asList(noDeadline, longTerm, shortTerm); Collections.sort(plans, new ActionPlanDeadlineComparator()); assertThat(plans).containsSequence(shortTerm, longTerm, noDeadline); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java index d3475234280..a84e1111836 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DefaultIssueBuilderTest { @Test - public void build_new_issue() throws Exception { + public void build_new_issue() { String componentKey = "org.apache.struts:struts-core:Action.java"; String projectKey = "org.apache.struts"; DefaultIssue issue = (DefaultIssue) new DefaultIssueBuilder() diff --git a/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java b/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java index 0ff082750e3..8a4181f47b5 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java @@ -42,12 +42,12 @@ public class IssueUpdaterTest { IssueUpdater updater; @Before - public void setUp() throws Exception { + public void setUp() { updater = new IssueUpdater(); } @Test - public void assign() throws Exception { + public void assign() { User user = new DefaultUser().setLogin("emmerik").setName("Emmerik"); boolean updated = updater.assign(issue, user, context); @@ -60,7 +60,7 @@ public class IssueUpdaterTest { } @Test - public void unassign() throws Exception { + public void unassign() { issue.setAssignee("morgan"); boolean updated = updater.assign(issue, null, context); assertThat(updated).isTrue(); @@ -72,7 +72,7 @@ public class IssueUpdaterTest { } @Test - public void change_assignee() throws Exception { + public void change_assignee() { User user = new DefaultUser().setLogin("emmerik").setName("Emmerik"); issue.setAssignee("morgan"); @@ -86,7 +86,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_assignee() throws Exception { + public void not_change_assignee() { User user = new DefaultUser().setLogin("morgan").setName("Morgan"); issue.setAssignee("morgan"); @@ -97,7 +97,7 @@ public class IssueUpdaterTest { } @Test - public void set_severity() throws Exception { + public void set_severity() { boolean updated = updater.setSeverity(issue, "BLOCKER", context); assertThat(updated).isTrue(); assertThat(issue.severity()).isEqualTo("BLOCKER"); @@ -110,7 +110,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_severity() throws Exception { + public void set_past_severity() { issue.setSeverity("BLOCKER"); boolean updated = updater.setPastSeverity(issue, "INFO", context); assertThat(updated).isTrue(); @@ -123,7 +123,7 @@ public class IssueUpdaterTest { } @Test - public void update_severity() throws Exception { + public void update_severity() { issue.setSeverity("BLOCKER"); boolean updated = updater.setSeverity(issue, "MINOR", context); @@ -136,7 +136,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_severity() throws Exception { + public void not_change_severity() { issue.setSeverity("MINOR"); boolean updated = updater.setSeverity(issue, "MINOR", context); assertThat(updated).isFalse(); @@ -145,7 +145,7 @@ public class IssueUpdaterTest { } @Test - public void not_revert_manual_severity() throws Exception { + public void not_revert_manual_severity() { issue.setSeverity("MINOR").setManualSeverity(true); try { updater.setSeverity(issue, "MAJOR", context); @@ -155,7 +155,7 @@ public class IssueUpdaterTest { } @Test - public void set_manual_severity() throws Exception { + public void set_manual_severity() { issue.setSeverity("BLOCKER"); boolean updated = updater.setManualSeverity(issue, "MINOR", context); @@ -169,7 +169,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_manual_severity() throws Exception { + public void not_change_manual_severity() { issue.setSeverity("MINOR").setManualSeverity(true); boolean updated = updater.setManualSeverity(issue, "MINOR", context); assertThat(updated).isFalse(); @@ -178,7 +178,7 @@ public class IssueUpdaterTest { } @Test - public void set_line() throws Exception { + public void set_line() { boolean updated = updater.setLine(issue, 123); assertThat(updated).isTrue(); assertThat(issue.line()).isEqualTo(123); @@ -188,7 +188,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_line() throws Exception { + public void set_past_line() { issue.setLine(42); boolean updated = updater.setPastLine(issue, 123); assertThat(updated).isTrue(); @@ -200,7 +200,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_line() throws Exception { + public void not_change_line() { issue.setLine(123); boolean updated = updater.setLine(issue, 123); assertThat(updated).isFalse(); @@ -210,7 +210,7 @@ public class IssueUpdaterTest { } @Test - public void set_resolution() throws Exception { + public void set_resolution() { boolean updated = updater.setResolution(issue, "OPEN", context); assertThat(updated).isTrue(); assertThat(issue.resolution()).isEqualTo("OPEN"); @@ -222,7 +222,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_resolution() throws Exception { + public void not_change_resolution() { issue.setResolution("FIXED"); boolean updated = updater.setResolution(issue, "FIXED", context); assertThat(updated).isFalse(); @@ -232,7 +232,7 @@ public class IssueUpdaterTest { } @Test - public void set_status() throws Exception { + public void set_status() { boolean updated = updater.setStatus(issue, "OPEN", context); assertThat(updated).isTrue(); assertThat(issue.status()).isEqualTo("OPEN"); @@ -244,7 +244,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_status() throws Exception { + public void not_change_status() { issue.setStatus("CLOSED"); boolean updated = updater.setStatus(issue, "CLOSED", context); assertThat(updated).isFalse(); @@ -254,7 +254,7 @@ public class IssueUpdaterTest { } @Test - public void set_new_attribute_value() throws Exception { + public void set_new_attribute_value() { boolean updated = updater.setAttribute(issue, "JIRA", "FOO-123", context); assertThat(updated).isTrue(); assertThat(issue.attribute("JIRA")).isEqualTo("FOO-123"); @@ -265,7 +265,7 @@ public class IssueUpdaterTest { } @Test - public void unset_attribute() throws Exception { + public void unset_attribute() { issue.setAttribute("JIRA", "FOO-123"); boolean updated = updater.setAttribute(issue, "JIRA", null, context); assertThat(updated).isTrue(); @@ -277,7 +277,7 @@ public class IssueUpdaterTest { } @Test - public void not_update_attribute() throws Exception { + public void not_update_attribute() { issue.setAttribute("JIRA", "FOO-123"); boolean updated = updater.setAttribute(issue, "JIRA", "FOO-123", context); assertThat(updated).isFalse(); @@ -285,7 +285,7 @@ public class IssueUpdaterTest { } @Test - public void plan_with_no_existing_plan() throws Exception { + public void plan_with_no_existing_plan() { ActionPlan newActionPlan = DefaultActionPlan.create("newName"); boolean updated = updater.plan(issue, newActionPlan, context); @@ -299,7 +299,7 @@ public class IssueUpdaterTest { } @Test - public void plan_with_existing_plan() throws Exception { + public void plan_with_existing_plan() { issue.setActionPlanKey("formerActionPlan"); ActionPlan newActionPlan = DefaultActionPlan.create("newName").setKey("newKey"); @@ -315,7 +315,7 @@ public class IssueUpdaterTest { } @Test - public void unplan() throws Exception { + public void unplan() { issue.setActionPlanKey("formerActionPlan"); boolean updated = updater.plan(issue, null, context); @@ -329,7 +329,7 @@ public class IssueUpdaterTest { } @Test - public void not_plan_again() throws Exception { + public void not_plan_again() { issue.setActionPlanKey("existingActionPlan"); ActionPlan newActionPlan = DefaultActionPlan.create("existingActionPlan").setKey("existingActionPlan"); @@ -341,7 +341,7 @@ public class IssueUpdaterTest { } @Test - public void set_effort_to_fix() throws Exception { + public void set_effort_to_fix() { boolean updated = updater.setEffortToFix(issue, 3.14, context); assertThat(updated).isTrue(); assertThat(issue.isChanged()).isTrue(); @@ -350,7 +350,7 @@ public class IssueUpdaterTest { } @Test - public void not_set_effort_to_fix_if_unchanged() throws Exception { + public void not_set_effort_to_fix_if_unchanged() { issue.setEffortToFix(3.14); boolean updated = updater.setEffortToFix(issue, 3.14, context); assertThat(updated).isFalse(); @@ -360,7 +360,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_effort() throws Exception { + public void set_past_effort() { issue.setEffortToFix(3.14); boolean updated = updater.setPastEffortToFix(issue, 1.0, context); assertThat(updated).isTrue(); @@ -372,7 +372,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_technical_debt() throws Exception { + public void set_past_technical_debt() { Duration newDebt = Duration.create(15 * 8 * 60); Duration previousDebt = Duration.create(10 * 8 * 60); issue.setDebt(newDebt); @@ -387,7 +387,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_technical_debt_without_previous_value() throws Exception { + public void set_past_technical_debt_without_previous_value() { Duration newDebt = Duration.create(15 * 8 * 60); issue.setDebt(newDebt); boolean updated = updater.setPastTechnicalDebt(issue, null, context); @@ -401,7 +401,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_technical_debt_with_null_new_value() throws Exception { + public void set_past_technical_debt_with_null_new_value() { issue.setDebt(null); Duration previousDebt = Duration.create(10 * 8 * 60); boolean updated = updater.setPastTechnicalDebt(issue, previousDebt, context); @@ -415,7 +415,7 @@ public class IssueUpdaterTest { } @Test - public void set_message() throws Exception { + public void set_message() { boolean updated = updater.setMessage(issue, "the message", context); assertThat(updated).isTrue(); assertThat(issue.isChanged()).isTrue(); @@ -424,7 +424,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_message() throws Exception { + public void set_past_message() { issue.setMessage("new message"); boolean updated = updater.setPastMessage(issue, "past message", context); assertThat(updated).isTrue(); @@ -436,7 +436,7 @@ public class IssueUpdaterTest { } @Test - public void set_author() throws Exception { + public void set_author() { boolean updated = updater.setAuthorLogin(issue, "eric", context); assertThat(updated).isTrue(); assertThat(issue.authorLogin()).isEqualTo("eric"); @@ -448,7 +448,7 @@ public class IssueUpdaterTest { } @Test - public void set_project() throws Exception { + public void set_project() { boolean updated = updater.setProject(issue, "sample", context); assertThat(updated).isTrue(); assertThat(issue.projectKey()).isEqualTo("sample"); @@ -459,7 +459,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_project() throws Exception { + public void set_past_project() { issue.setProjectKey("new project key"); boolean updated = updater.setPastProject(issue, "past project key", context); assertThat(updated).isTrue(); @@ -471,7 +471,7 @@ public class IssueUpdaterTest { } @Test - public void not_set_past_project_if_no_change() throws Exception { + public void not_set_past_project_if_no_change() { issue.setProjectKey("key"); boolean updated = updater.setPastProject(issue, "key", context); assertThat(updated).isFalse(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java index c6d5d6219bf..d9de4aa528f 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java @@ -51,7 +51,7 @@ public class IssueChangeDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java index 3ae8f107ba0..3b383c1c974 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java @@ -30,7 +30,7 @@ import static org.sonar.api.utils.DateUtils.parseDate; public class IssueChangeDtoTest { @Test - public void create_from_comment() throws Exception { + public void create_from_comment() { DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); IssueChangeDto dto = IssueChangeDto.of(comment); @@ -45,7 +45,7 @@ public class IssueChangeDtoTest { } @Test - public void create_from_comment_with_created_at() throws Exception { + public void create_from_comment_with_created_at() { DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); comment.setCreatedAt(parseDate("2015-01-13")); @@ -55,7 +55,7 @@ public class IssueChangeDtoTest { } @Test - public void create_from_diff() throws Exception { + public void create_from_diff() { FieldDiffs diffs = new FieldDiffs(); diffs.setDiff("severity", "INFO", "BLOCKER"); diffs.setUserLogin("emmerik"); @@ -72,7 +72,7 @@ public class IssueChangeDtoTest { } @Test - public void create_from_diff_with_created_at() throws Exception { + public void create_from_diff_with_created_at() { FieldDiffs diffs = new FieldDiffs(); diffs.setDiff("severity", "INFO", "BLOCKER"); diffs.setUserLogin("emmerik"); @@ -84,7 +84,7 @@ public class IssueChangeDtoTest { } @Test - public void to_comment() throws Exception { + public void to_comment() { IssueChangeDto changeDto = new IssueChangeDto() .setKey("EFGH") .setUserLogin("emmerik") @@ -103,7 +103,7 @@ public class IssueChangeDtoTest { } @Test - public void to_field_diffs_with_issue_creation_date() throws Exception { + public void to_field_diffs_with_issue_creation_date() { IssueChangeDto changeDto = new IssueChangeDto() .setKey("EFGH") .setUserLogin("emmerik") @@ -118,7 +118,7 @@ public class IssueChangeDtoTest { } @Test - public void to_field_diffs_with_create_at() throws Exception { + public void to_field_diffs_with_create_at() { IssueChangeDto changeDto = new IssueChangeDto() .setKey("EFGH") .setUserLogin("emmerik") @@ -133,7 +133,7 @@ public class IssueChangeDtoTest { } @Test - public void to_string() throws Exception { + public void to_string() { DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); IssueChangeDto dto = IssueChangeDto.of(comment); assertThat(dto.toString()).contains("ABCDE"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java index 070cd2641d8..f9d51c39c37 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java @@ -42,7 +42,7 @@ public class IssueChangeMapperTest extends AbstractDaoTestCase { } @Test - public void insert_diff() throws Exception { + public void insert_diff() { IssueChangeDto dto = new IssueChangeDto(); dto.setKey(null /* no key on field changes */); dto.setUserLogin("emmerik"); @@ -59,7 +59,7 @@ public class IssueChangeMapperTest extends AbstractDaoTestCase { } @Test - public void insert_comment() throws Exception { + public void insert_comment() { IssueChangeDto dto = new IssueChangeDto(); dto.setKey("COMMENT-1234"); dto.setUserLogin("emmerik"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java index d8495ccb6d2..7958aa26674 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java @@ -42,7 +42,7 @@ public class IssueDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java index d9561829aa7..9e81671a899 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java @@ -46,7 +46,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void insert() throws Exception { + public void insert() { IssueDto dto = new IssueDto(); dto.setComponentUuid("uuid-123"); dto.setProjectUuid("uuid-100"); @@ -79,7 +79,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void update() throws Exception { + public void update() { setupData("testUpdate"); IssueDto dto = new IssueDto(); @@ -114,7 +114,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void updateBeforeSelectedDate_without_conflict() throws Exception { + public void updateBeforeSelectedDate_without_conflict() { setupData("testUpdate"); IssueDto dto = new IssueDto(); @@ -152,7 +152,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void updateBeforeSelectedDate_with_conflict() throws Exception { + public void updateBeforeSelectedDate_with_conflict() { setupData("updateBeforeSelectedDate_with_conflict"); IssueDto dto = new IssueDto(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java index bdda38311e9..62e10059629 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java @@ -51,12 +51,12 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @After - public void after() throws Exception { + public void after() { session.close(); } @Test - public void batch_insert_new_issues() throws Exception { + public void batch_insert_new_issues() { FakeBatchSaver saver = new FakeBatchSaver(getMyBatis(), new FakeRuleFinder()); DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); @@ -91,7 +91,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void batch_insert_new_issues_with_session() throws Exception { + public void batch_insert_new_issues_with_session() { FakeBatchSaver saver = new FakeBatchSaver(getMyBatis(), new FakeRuleFinder()); DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); @@ -127,7 +127,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void server_insert_new_issues_with_session() throws Exception { + public void server_insert_new_issues_with_session() { ComponentDto project = new ComponentDto().setId(10L).setUuid("uuid-10"); ComponentDto component = new ComponentDto().setId(100L).setUuid("uuid-100"); FakeServerSaver saver = new FakeServerSaver(getMyBatis(), new FakeRuleFinder(), component, project); @@ -165,7 +165,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void batch_update_issues() throws Exception { + public void batch_update_issues() { setupData("should_update_issues"); FakeBatchSaver saver = new FakeBatchSaver(getMyBatis(), new FakeRuleFinder()); @@ -209,7 +209,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void server_update_issues() throws Exception { + public void server_update_issues() { setupData("should_update_issues"); ComponentDto project = new ComponentDto().setId(10L).setUuid("whatever-uuid"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java index ba6599d789d..2dc79d30b8d 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.*; public class UpdateConflictResolverTest { @Test - public void should_reload_issue_and_resolve_conflict() throws Exception { + public void should_reload_issue_and_resolve_conflict() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setRuleKey(RuleKey.of("squid", "AvoidCycles")) @@ -66,7 +66,7 @@ public class UpdateConflictResolverTest { } @Test - public void should_keep_changes_made_by_user() throws Exception { + public void should_keep_changes_made_by_user() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setRuleKey(RuleKey.of("squid", "AvoidCycles")) @@ -121,7 +121,7 @@ public class UpdateConflictResolverTest { } @Test - public void severity_changed_by_user_should_be_kept() throws Exception { + public void severity_changed_by_user_should_be_kept() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setRuleKey(RuleKey.of("squid", "AvoidCycles")) diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java index 57823a87d7b..47ca6b3d526 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java @@ -28,14 +28,14 @@ public class IsEndOfLifeTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_be_end_of_life() throws Exception { + public void should_be_end_of_life() { IsEndOfLife condition = new IsEndOfLife(true); assertThat(condition.matches(issue.setEndOfLife(true))).isTrue(); assertThat(condition.matches(issue.setEndOfLife(false))).isFalse(); } @Test - public void should_not_be_end_of_life() throws Exception { + public void should_not_be_end_of_life() { IsEndOfLife condition = new IsEndOfLife(false); assertThat(condition.matches(issue.setEndOfLife(true))).isFalse(); assertThat(condition.matches(issue.setEndOfLife(false))).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java index 7deaf627aa6..16a82274f04 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java @@ -28,14 +28,14 @@ public class IsManualTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_match() throws Exception { + public void should_match() { IsManual condition = new IsManual(true); assertThat(condition.matches(issue.setReporter("you"))).isTrue(); assertThat(condition.matches(issue.setReporter(null))).isFalse(); } @Test - public void should_match_dead() throws Exception { + public void should_match_dead() { IsManual condition = new IsManual(false); assertThat(condition.matches(issue.setReporter("you"))).isFalse(); assertThat(condition.matches(issue.setReporter(null))).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java index 1eb2430420a..8cc01a72189 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java @@ -47,7 +47,7 @@ public class IssueWorkflowTest { IssueWorkflow workflow = new IssueWorkflow(new FunctionExecutor(updater), updater); @Test - public void init_state_machine() throws Exception { + public void init_state_machine() { assertThat(workflow.machine()).isNull(); workflow.start(); assertThat(workflow.machine()).isNotNull(); @@ -60,14 +60,14 @@ public class IssueWorkflowTest { } @Test - public void list_statuses() throws Exception { + public void list_statuses() { workflow.start(); // order is important for UI assertThat(workflow.statusKeys()).containsSequence(Issue.STATUS_OPEN, Issue.STATUS_CONFIRMED, Issue.STATUS_REOPENED, Issue.STATUS_RESOLVED, Issue.STATUS_CLOSED); } @Test - public void list_out_transitions_from_status_open() throws Exception { + public void list_out_transitions_from_status_open() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_OPEN); @@ -76,7 +76,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_confirmed() throws Exception { + public void list_out_transitions_from_status_confirmed() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_CONFIRMED); @@ -85,7 +85,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_resolved() throws Exception { + public void list_out_transitions_from_status_resolved() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_RESOLVED); @@ -94,7 +94,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_reopen() throws Exception { + public void list_out_transitions_from_status_reopen() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_REOPENED); @@ -103,7 +103,7 @@ public class IssueWorkflowTest { } @Test - public void list_no_out_transition_from_status_closed() throws Exception { + public void list_no_out_transition_from_status_closed() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_CLOSED); @@ -112,7 +112,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_closed_on_manual_issue() throws Exception { + public void list_out_transitions_from_status_closed_on_manual_issue() { workflow.start(); // Manual issue because of reporter @@ -127,7 +127,7 @@ public class IssueWorkflowTest { } @Test - public void fail_if_unknown_status_when_listing_transitions() throws Exception { + public void fail_if_unknown_status_when_listing_transitions() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus("xxx"); @@ -141,7 +141,7 @@ public class IssueWorkflowTest { @Test - public void do_automatic_transition() throws Exception { + public void do_automatic_transition() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -159,7 +159,7 @@ public class IssueWorkflowTest { } @Test - public void close_open_dead_issue() throws Exception { + public void close_open_dead_issue() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -177,7 +177,7 @@ public class IssueWorkflowTest { } @Test - public void close_reopened_dead_issue() throws Exception { + public void close_reopened_dead_issue() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -195,7 +195,7 @@ public class IssueWorkflowTest { } @Test - public void close_confirmed_dead_issue() throws Exception { + public void close_confirmed_dead_issue() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -214,7 +214,7 @@ public class IssueWorkflowTest { @Test - public void fail_if_unknown_status_on_automatic_trans() throws Exception { + public void fail_if_unknown_status_on_automatic_trans() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -232,7 +232,7 @@ public class IssueWorkflowTest { } @Test - public void flag_as_false_positive() throws Exception { + public void flag_as_false_positive() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(Issue.STATUS_OPEN) @@ -250,7 +250,7 @@ public class IssueWorkflowTest { } @Test - public void wont_fix() throws Exception { + public void wont_fix() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(Issue.STATUS_OPEN) @@ -268,7 +268,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issues_be_resolved_then_closed() throws Exception { + public void manual_issues_be_resolved_then_closed() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") @@ -299,7 +299,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issues_be_confirmed_then_kept_open() throws Exception { + public void manual_issues_be_confirmed_then_kept_open() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") @@ -339,7 +339,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issue_on_removed_rule_be_closed() throws Exception { + public void manual_issue_on_removed_rule_be_closed() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") @@ -357,7 +357,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issue_on_removed_component_be_closed() throws Exception { + public void manual_issue_on_removed_component_be_closed() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java index 1e12908b4c4..ebadb4bccd9 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java @@ -28,7 +28,7 @@ import static org.mockito.Mockito.*; public class SetAssigneeTest { @Test - public void assign() throws Exception { + public void assign() { User user = new DefaultUser().setLogin("eric").setName("eric"); SetAssignee function = new SetAssignee(user); Function.Context context = mock(Function.Context.class); @@ -37,7 +37,7 @@ public class SetAssigneeTest { } @Test - public void unassign() throws Exception { + public void unassign() { Function.Context context = mock(Function.Context.class); SetAssignee.UNASSIGN.execute(context); verify(context, times(1)).setAssignee(null); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java index 21e8a2c72a1..e4cb9f59783 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.verify; public class SetCloseDateTest { @Test - public void should_set_close_date() throws Exception { + public void should_set_close_date() { SetCloseDate function = new SetCloseDate(true); Function.Context context = mock(Function.Context.class); function.execute(context); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java index a05e9d0e056..014a8c2d087 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java @@ -33,7 +33,7 @@ public class SetEndOfLifeTest { SetEndOfLife function = new SetEndOfLife(); @Test - public void should_resolve_as_fixed() throws Exception { + public void should_resolve_as_fixed() { Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(false); when(context.issue()).thenReturn(issue); function.execute(context); @@ -41,7 +41,7 @@ public class SetEndOfLifeTest { } @Test - public void should_resolve_as_removed_when_rule_is_disabled() throws Exception { + public void should_resolve_as_removed_when_rule_is_disabled() { Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(true); when(context.issue()).thenReturn(issue); function.execute(context); @@ -49,7 +49,7 @@ public class SetEndOfLifeTest { } @Test - public void should_fail_if_issue_is_not_resolved() throws Exception { + public void should_fail_if_issue_is_not_resolved() { Issue issue = new DefaultIssue().setEndOfLife(false); when(context.issue()).thenReturn(issue); try { @@ -62,7 +62,7 @@ public class SetEndOfLifeTest { } @Test - public void line_number_must_be_unset() throws Exception { + public void line_number_must_be_unset() { Issue issue = new DefaultIssue().setEndOfLife(true).setLine(10); when(context.issue()).thenReturn(issue); function.execute(context); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java index db88e155ff4..0ef18d3ab5d 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.verify; public class SetResolutionTest { @Test - public void execute() throws Exception { + public void execute() { SetResolution function = new SetResolution("FIXED"); Function.Context context = mock(Function.Context.class); function.execute(context); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java index 0f4640fc583..db598bc805a 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java @@ -25,14 +25,14 @@ import static org.assertj.core.api.Assertions.assertThat; public class StateMachineTest { @Test - public void keep_order_of_state_keys() throws Exception { + public void keep_order_of_state_keys() { StateMachine machine = StateMachine.builder().states("OPEN", "RESOLVED", "CLOSED").build(); assertThat(machine.stateKeys()).containsSequence("OPEN", "RESOLVED", "CLOSED"); } @Test - public void stateKey() throws Exception { + public void stateKey() { StateMachine machine = StateMachine.builder() .states("OPEN", "RESOLVED", "CLOSED") .transition(Transition.builder("resolve").from("OPEN").to("RESOLVED").build()) diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java index 4845435612c..c9ad378df48 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java @@ -29,7 +29,7 @@ public class StateTest { Transition t1 = Transition.builder("close").from("OPEN").to("CLOSED").build(); @Test - public void key_should_be_set() throws Exception { + public void key_should_be_set() { try { new State("", new Transition[0]); fail(); @@ -39,7 +39,7 @@ public class StateTest { } @Test - public void key_should_be_upper_case() throws Exception { + public void key_should_be_upper_case() { try { new State("close", new Transition[0]); fail(); @@ -49,7 +49,7 @@ public class StateTest { } @Test - public void no_duplicated_out_transitions() throws Exception { + public void no_duplicated_out_transitions() { try { new State("CLOSE", new Transition[]{t1, t1}); fail(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java index 0ac9809fdec..4c680c54ec1 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java @@ -63,7 +63,7 @@ public class TransitionTest { } @Test - public void key_should_be_set() throws Exception { + public void key_should_be_set() { try { Transition.builder("").from("OPEN").to("CLOSED").build(); fail(); @@ -73,7 +73,7 @@ public class TransitionTest { } @Test - public void key_should_be_lower_case() throws Exception { + public void key_should_be_lower_case() { try { Transition.builder("CLOSE").from("OPEN").to("CLOSED").build(); fail(); @@ -83,7 +83,7 @@ public class TransitionTest { } @Test - public void originating_status_should_be_set() throws Exception { + public void originating_status_should_be_set() { try { Transition.builder("close").from("").to("CLOSED").build(); fail(); @@ -93,7 +93,7 @@ public class TransitionTest { } @Test - public void destination_status_should_be_set() throws Exception { + public void destination_status_should_be_set() { try { Transition.builder("close").from("OPEN").to("").build(); fail(); @@ -103,7 +103,7 @@ public class TransitionTest { } @Test - public void should_verify_conditions() throws Exception { + public void should_verify_conditions() { DefaultIssue issue = new DefaultIssue(); Transition transition = Transition.builder("close") .from("OPEN").to("CLOSED") diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java index e75676287e8..c3f3dd852f3 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java @@ -55,32 +55,32 @@ public class MeasureDtoTest { } @Test - public void value_with_text_over_4000_characters() throws Exception { + public void value_with_text_over_4000_characters() { assertThat(sut.setData(Strings.repeat("1", 4001)).getData()).isNotNull(); } @Test - public void text_value_under_4000_characters() throws Exception { + public void text_value_under_4000_characters() { assertThat(sut.setData("text value").getData()).isEqualTo("text value"); } @Test(expected = IndexOutOfBoundsException.class) - public void fail_to_set_out_of_bounds_variation() throws Exception { + public void fail_to_set_out_of_bounds_variation() { sut.setVariation(6, 1d); } @Test(expected = IndexOutOfBoundsException.class) - public void fail_to_get_out_of_bounds_variation() throws Exception { + public void fail_to_get_out_of_bounds_variation() { sut.getVariation(6); } @Test(expected = IllegalArgumentException.class) - public void fail_if_non_existent_severity() throws Exception { + public void fail_if_non_existent_severity() { sut.setSeverity("MAYOR"); } @Test - public void severity_values_are_retrieved() throws Exception { + public void severity_values_are_retrieved() { assertThat(sut.getSeverity()).isNull(); for (String severity : Severity.ALL) { diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java index 19641d6c94a..93ce3e37163 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MetricDtoTest { @Test - public void getters_and_setters() throws Exception { + public void getters_and_setters() { MetricDto metricDto = new MetricDto() .setId(1) .setKey("coverage") diff --git a/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java b/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java index 015b2e72e46..9e1dae9de30 100644 --- a/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java @@ -88,7 +88,7 @@ public class DefaultNotificationManagerTest extends AbstractDbUnitTestCase { } @Test - public void shouldPersist() throws Exception { + public void shouldPersist() { Notification notification = new Notification("test"); manager.scheduleForSending(notification); @@ -96,7 +96,7 @@ public class DefaultNotificationManagerTest extends AbstractDbUnitTestCase { } @Test - public void shouldGetFromQueueAndDelete() throws Exception { + public void shouldGetFromQueueAndDelete() { Notification notification = new Notification("test"); NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification); List dtos = Arrays.asList(dto); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java index 7a054560f48..7b79f0f1600 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java @@ -40,7 +40,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_groups_for_project_permission() throws Exception { + public void select_groups_for_project_permission() { setupData("groups_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -69,7 +69,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void anyone_group_is_not_returned_when_it_has_no_permission() throws Exception { + public void anyone_group_is_not_returned_when_it_has_no_permission() { setupData("groups_with_permissions"); // Anyone group has not the permission 'admin', so it's not returned @@ -91,7 +91,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_groups_for_global_permission() throws Exception { + public void select_groups_for_global_permission() { setupData("groups_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("admin").build(); @@ -112,7 +112,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_groups_name() throws Exception { + public void search_by_groups_name() { setupData("groups_with_permissions"); List result = dao.selectGroups(PermissionQuery.builder().permission("user").search("aDMini").build(), COMPONENT_ID); @@ -124,7 +124,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void search_groups_should_be_sorted_by_group_name() throws Exception { + public void search_groups_should_be_sorted_by_group_name() { setupData("groups_with_permissions_should_be_sorted_by_group_name"); List result = dao.selectGroups(PermissionQuery.builder().permission("user").build(), COMPONENT_ID); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java index bbff4ba4c58..ef4a30aef47 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GroupWithPermissionDtoTest { @Test - public void to_group_with_permission_having_permission() throws Exception { + public void to_group_with_permission_having_permission() { GroupWithPermission group = new GroupWithPermissionDto() .setName("users") .setDescription("desc") @@ -40,7 +40,7 @@ public class GroupWithPermissionDtoTest { } @Test - public void to_group_with_permission_not_having_permission() throws Exception { + public void to_group_with_permission_not_having_permission() { GroupWithPermission group = new GroupWithPermissionDto() .setName("users") .setPermission(null) diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java index 6ab511947d3..28ff2c3ed32 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java @@ -41,7 +41,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_groups() throws Exception { + public void select_groups() { setupData("groups_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -71,7 +71,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void anyone_group_is_not_returned_when_it_has_no_permission() throws Exception { + public void anyone_group_is_not_returned_when_it_has_no_permission() { setupData("groups_with_permissions"); // Anyone group has not the permission 'admin', so it's not returned @@ -93,7 +93,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_groups_name() throws Exception { + public void search_by_groups_name() { setupData("groups_with_permissions"); List result = dao.selectGroups(PermissionQuery.builder().permission("user").search("aDMini").build(), TEMPLATE_ID); @@ -105,7 +105,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void search_groups_should_be_sorted_by_group_name() throws Exception { + public void search_groups_should_be_sorted_by_group_name() { setupData("groups_with_permissions_should_be_sorted_by_group_name"); List result = dao.selectGroups(PermissionQuery.builder().permission("user").build(), TEMPLATE_ID); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java b/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java index 324bcb61995..8eafb61e80c 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java @@ -64,12 +64,12 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void should_apply_permission_template() throws Exception { + public void should_apply_permission_template() { setupData("should_apply_permission_template"); assertThat(permissionFacade.selectGroupPermissions(session, "sonar-administrators", 123L)).isEmpty(); @@ -89,14 +89,14 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_count_component_permissions() throws Exception { + public void should_count_component_permissions() { setupData("should_count_component_permissions"); assertThat(permissionFacade.countComponentPermissions(session, 123L)).isEqualTo(2); } @Test - public void should_add_user_permission() throws Exception { + public void should_add_user_permission() { setupData("should_add_user_permission"); permissionFacade.insertUserPermission(123L, 200L, UserRole.ADMIN, session); @@ -107,7 +107,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_delete_user_permission() throws Exception { + public void should_delete_user_permission() { setupData("should_delete_user_permission"); permissionFacade.deleteUserPermission(123L, 200L, UserRole.ADMIN, session); @@ -118,7 +118,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_insert_group_permission() throws Exception { + public void should_insert_group_permission() { setupData("should_insert_group_permission"); permissionFacade.insertGroupPermission(123L, 100L, UserRole.USER, session); @@ -129,7 +129,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_insert_group_name_permission() throws Exception { + public void should_insert_group_name_permission() { setupData("should_insert_group_permission"); permissionFacade.insertGroupPermission(123L, "devs", UserRole.USER, session); @@ -140,7 +140,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_insert_anyone_group_permission() throws Exception { + public void should_insert_anyone_group_permission() { setupData("should_insert_anyone_group_permission"); permissionFacade.insertGroupPermission(123L, "Anyone", UserRole.USER, session); @@ -151,7 +151,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_delete_group_permission() throws Exception { + public void should_delete_group_permission() { setupData("should_delete_group_permission"); permissionFacade.deleteGroupPermission(123L, 100L, UserRole.USER, session); @@ -162,7 +162,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_delete_group_name_permission() throws Exception { + public void should_delete_group_name_permission() { setupData("should_delete_group_permission"); permissionFacade.deleteGroupPermission(123L, "devs", UserRole.USER, session); @@ -173,7 +173,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_retrieve_permission_template() throws Exception { + public void should_retrieve_permission_template() { PermissionTemplateDto permissionTemplateDto = new PermissionTemplateDto().setName("Test template").setKee("test_template"); PermissionTemplateDto templateWithPermissions = new PermissionTemplateDto().setKee("test_template"); permissionTemplateDao = mock(PermissionTemplateDao.class); @@ -188,7 +188,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_fail_on_unmatched_template() throws Exception { + public void should_fail_on_unmatched_template() { throwable.expect(IllegalArgumentException.class); permissionTemplateDao = mock(PermissionTemplateDao.class); @@ -198,7 +198,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_remove_all_permissions() throws Exception { + public void should_remove_all_permissions() { setupData("should_remove_all_permissions"); assertThat(permissionFacade.selectGroupPermissions(session, "devs", 123L)).hasSize(1); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java index e4c5b8de4ec..c3bfc1fa000 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java @@ -57,7 +57,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_create_permission_template() throws Exception { + public void should_create_permission_template() { setupData("createPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.createPermissionTemplate("my template", "my description", "myregexp"); assertThat(permissionTemplate).isNotNull(); @@ -66,7 +66,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_normalize_kee_on_template_creation() throws Exception { + public void should_normalize_kee_on_template_creation() { setupData("createNonAsciiPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.createPermissionTemplate("Môü Gnô Gnèçàß", "my description", null); assertThat(permissionTemplate).isNotNull(); @@ -75,7 +75,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_skip_key_normalization_on_default_template() throws Exception { + public void should_skip_key_normalization_on_default_template() { PermissionTemplateMapper mapper = mock(PermissionTemplateMapper.class); @@ -95,7 +95,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_permission_template() throws Exception { + public void should_select_permission_template() { setupData("selectPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.selectPermissionTemplate("my_template_20130102_030405"); @@ -115,7 +115,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_empty_permission_template() throws Exception { + public void should_select_empty_permission_template() { setupData("selectEmptyPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.selectPermissionTemplate("my_template_20130102_030405"); @@ -127,7 +127,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_permission_template_by_key() throws Exception { + public void should_select_permission_template_by_key() { setupData("selectPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.selectTemplateByKey("my_template_20130102_030405"); @@ -140,7 +140,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_all_permission_templates() throws Exception { + public void should_select_all_permission_templates() { setupData("selectAllPermissionTemplates"); List permissionTemplates = permissionTemplateDao.selectAllPermissionTemplates(); @@ -153,7 +153,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_update_permission_template() throws Exception { + public void should_update_permission_template() { setupData("updatePermissionTemplate"); permissionTemplateDao.updatePermissionTemplate(1L, "new_name", "new_description", "new_regexp"); @@ -162,7 +162,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_delete_permission_template() throws Exception { + public void should_delete_permission_template() { setupData("deletePermissionTemplate"); permissionTemplateDao.deletePermissionTemplate(1L); @@ -173,7 +173,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_add_user_permission_to_template() throws Exception { + public void should_add_user_permission_to_template() { setupData("addUserPermissionToTemplate"); permissionTemplateDao.addUserPermission(1L, 1L, "new_permission"); @@ -183,7 +183,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_remove_user_permission_from_template() throws Exception { + public void should_remove_user_permission_from_template() { setupData("removeUserPermissionFromTemplate"); permissionTemplateDao.removeUserPermission(1L, 2L, "permission_to_remove"); @@ -193,7 +193,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_add_group_permission_to_template() throws Exception { + public void should_add_group_permission_to_template() { setupData("addGroupPermissionToTemplate"); permissionTemplateDao.addGroupPermission(1L, 1L, "new_permission"); @@ -203,7 +203,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_remove_group_permission_from_template() throws Exception { + public void should_remove_group_permission_from_template() { setupData("removeGroupPermissionFromTemplate"); permissionTemplateDao.removeGroupPermission(1L, 2L, "permission_to_remove"); @@ -213,7 +213,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void remove_by_group() throws Exception { + public void remove_by_group() { setupData("remove_by_group"); permissionTemplateDao.removeByGroup(2L, session); session.commit(); @@ -222,7 +222,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_add_group_permission_with_null_name() throws Exception { + public void should_add_group_permission_with_null_name() { setupData("addNullGroupPermissionToTemplate"); permissionTemplateDao.addGroupPermission(1L, null, "new_permission"); @@ -232,7 +232,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_remove_group_permission_with_null_name() throws Exception { + public void should_remove_group_permission_with_null_name() { setupData("removeNullGroupPermissionFromTemplate"); permissionTemplateDao.removeGroupPermission(1L, null, "permission_to_remove"); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java index 44d365c61df..852915106cd 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java @@ -44,7 +44,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_users_for_project_permission() throws Exception { + public void select_all_users_for_project_permission() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -68,7 +68,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_users_for_global_permission() throws Exception { + public void select_all_users_for_global_permission() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("admin").build(); @@ -89,7 +89,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_with_permission() throws Exception { + public void select_only_user_with_permission() { setupData("users_with_permissions"); // user1 and user2 have permission user @@ -97,7 +97,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_without_permission() throws Exception { + public void select_only_user_without_permission() { setupData("users_with_permissions"); // Only user3 has not the user permission @@ -105,7 +105,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_user_name() throws Exception { + public void search_by_user_name() { setupData("users_with_permissions"); List result = dao.selectUsers(PermissionQuery.builder().permission("user").search("SEr1").build(), COMPONENT_ID); @@ -117,7 +117,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_enable_users() throws Exception { + public void select_only_enable_users() { setupData("select_only_enable_users"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -134,7 +134,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_sorted_by_user_name() throws Exception { + public void should_be_sorted_by_user_name() { setupData("users_with_permissions_should_be_sorted_by_user_name"); List result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), COMPONENT_ID); @@ -145,7 +145,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_paginated() throws Exception { + public void should_be_paginated() { setupData("users_with_permissions"); List result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), COMPONENT_ID, 0, 2); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java index 665d6e6401a..ab1f38990f7 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class UserWithPermissionDtoTest { @Test - public void to_user_with_permission_having_permission() throws Exception { + public void to_user_with_permission_having_permission() { UserWithPermission user = new UserWithPermissionDto() .setName("Arthur") .setLogin("arthur") @@ -40,7 +40,7 @@ public class UserWithPermissionDtoTest { } @Test - public void to_user_with_permission_not_having_permission() throws Exception { + public void to_user_with_permission_not_having_permission() { UserWithPermission user = new UserWithPermissionDto() .setName("Arthur") .setLogin("arthur") diff --git a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java index 5cfa6fd43c1..61d1f4f9479 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java @@ -45,7 +45,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_users() throws Exception { + public void select_all_users() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -69,7 +69,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void return_nothing_on_unknown_template_key() throws Exception { + public void return_nothing_on_unknown_template_key() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -87,7 +87,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_with_permission() throws Exception { + public void select_only_user_with_permission() { setupData("users_with_permissions"); // user1 and user2 have permission user @@ -95,7 +95,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_without_permission() throws Exception { + public void select_only_user_without_permission() { setupData("users_with_permissions"); // Only user3 has not the user permission @@ -103,7 +103,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_enable_users() throws Exception { + public void select_only_enable_users() { setupData("select_only_enable_users"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -120,7 +120,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_user_name() throws Exception { + public void search_by_user_name() { setupData("users_with_permissions"); List result = dao.selectUsers(PermissionQuery.builder().permission("user").search("SEr1").build(), TEMPLATE_ID); @@ -132,7 +132,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_sorted_by_user_name() throws Exception { + public void should_be_sorted_by_user_name() { setupData("users_with_permissions_should_be_sorted_by_user_name"); List result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), TEMPLATE_ID); @@ -143,7 +143,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_paginated() throws Exception { + public void should_be_paginated() { setupData("users_with_permissions"); List result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), TEMPLATE_ID, 0, 2); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java index 03e1d41d380..4715e7f4a2c 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java @@ -40,13 +40,13 @@ public class DaoUtilsTest { } @Test - public void repeatCondition() throws Exception { + public void repeatCondition() { assertThat(DaoUtils.repeatCondition("uuid=?", 1, "or")).isEqualTo("uuid=?"); assertThat(DaoUtils.repeatCondition("uuid=?", 3, "or")).isEqualTo("uuid=? or uuid=? or uuid=?"); } @Test - public void execute_large_inputs() throws Exception { + public void execute_large_inputs() { List inputs = newArrayList(); List expectedOutputs = newArrayList(); for (int i = 0; i < 2010; i++) { @@ -72,7 +72,7 @@ public class DaoUtilsTest { } @Test - public void execute_large_inputs_on_empty_list() throws Exception { + public void execute_large_inputs_on_empty_list() { List outputs = DaoUtils.executeLargeInputs(Collections.emptyList(), new Function, List>() { @Override public List apply(List input) { diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java index 6d9c6d74eb1..b12abc5da36 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java @@ -83,7 +83,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void create_and_acquire_semaphore() throws Exception { + public void create_and_acquire_semaphore() { Semaphores.Semaphore lock = dao.acquire("foo", 60); assertThat(lock.isLocked()).isTrue(); assertThat(lock.getDurationSinceLocked()).isNull(); @@ -120,7 +120,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void fail_to_update_null_semaphore() throws Exception { + public void fail_to_update_null_semaphore() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Semaphore must not be null"); @@ -128,7 +128,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void create_and_acquire_semaphore_when_maxage_is_zeo() throws Exception { + public void create_and_acquire_semaphore_when_maxage_is_zeo() { Semaphores.Semaphore lock = dao.acquire("foo", 0); assertThat(lock.isLocked()).isTrue(); assertThat(lock.getDurationSinceLocked()).isNull(); @@ -145,7 +145,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void create_and_acquire_semaphore_when_no_timeout() throws Exception { + public void create_and_acquire_semaphore_when_no_timeout() { Semaphores.Semaphore lock = dao.acquire("foo"); assertThat(lock.isLocked()).isTrue(); assertThat(lock.getDurationSinceLocked()).isNull(); @@ -162,7 +162,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void fail_to_acquire_locked_semaphore() throws Exception { + public void fail_to_acquire_locked_semaphore() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo", Integer.MAX_VALUE); assertThat(lock.isLocked()).isFalse(); @@ -177,7 +177,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void acquire_long_locked_semaphore() throws Exception { + public void acquire_long_locked_semaphore() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo", 60); assertThat(lock.isLocked()).isTrue(); @@ -192,7 +192,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void acquire_locked_semaphore_when_timeout_is_zero() throws Exception { + public void acquire_locked_semaphore_when_timeout_is_zero() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo", 0); assertThat(lock.isLocked()).isTrue(); @@ -210,7 +210,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void fail_to_acquire_locked_semaphore_when_no_timeout() throws Exception { + public void fail_to_acquire_locked_semaphore_when_no_timeout() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo"); assertThat(lock.isLocked()).isFalse(); @@ -225,7 +225,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_semaphore_return_current_semaphore_when_acquiring() throws Exception { + public void should_select_semaphore_return_current_semaphore_when_acquiring() { dao.acquire("foo"); SemaphoreDto semaphore = selectSemaphore("foo"); @@ -255,7 +255,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } } - private SemaphoreDto selectSemaphore(String name) throws Exception { + private SemaphoreDto selectSemaphore(String name) { SqlSession session = getMyBatis().openSession(); try { return dao.selectSemaphore(name, session); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java index d6f36fcc77c..170d5d59c2e 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java @@ -66,7 +66,7 @@ public class SemaphoreUpdaterTest extends AbstractDaoTestCase { } @Test - public void shouldNotFailWhenCancelNotExistingSemaphore() throws Exception { + public void shouldNotFailWhenCancelNotExistingSemaphore() { updater.stopUpdate("foo"); } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java index ae6f853a60b..e187c55b4b8 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java @@ -53,7 +53,7 @@ public class H2Test { } @Test - public void h2_does_not_supportMigration() throws Exception { + public void h2_does_not_supportMigration() { assertThat(dialect.supportsMigration()).isFalse(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java index 33c92f224eb..8719be31490 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java @@ -51,7 +51,7 @@ public class MsSqlTest { } @Test - public void msSql_does_supportMigration() throws Exception { + public void msSql_does_supportMigration() { assertThat(msSql.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java index 6694d035f68..b9d9990f8e8 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java @@ -57,7 +57,7 @@ public class MySqlTest { } @Test - public void mysql_does_supportMigration() throws Exception { + public void mysql_does_supportMigration() { assertThat(mySql.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java index b3710e9f27e..4b91a15a040 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java @@ -54,7 +54,7 @@ public class OracleTest { } @Test - public void oracle_does_supportMigration() throws Exception { + public void oracle_does_supportMigration() { assertThat(dialect.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java index 61a71212ac1..c6b437dc3bf 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java @@ -59,7 +59,7 @@ public class PostgreSqlTest { } @Test - public void postgres_does_supportMigration() throws Exception { + public void postgres_does_supportMigration() { assertThat(dialect.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java index 9fbdfbd7845..16f58339d03 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java @@ -70,7 +70,7 @@ public class InvocationUtilsTest { } @Test - public void only_static_methods() throws Exception { + public void only_static_methods() { assertThat(TestUtils.hasOnlyPrivateConstructors(InvocationUtils.class)).isTrue(); } diff --git a/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java b/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java index bbf91377797..d9b3ada4254 100644 --- a/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java +++ b/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java @@ -61,7 +61,7 @@ public class PluginClassloadersTest { } @Test - public void shouldImport() throws Exception { + public void shouldImport() { classloaders.add(DefaultPluginMetadata.create("foo").addDeployedFile(getFile("PluginClassloadersTest/foo.jar"))); classloaders.add(DefaultPluginMetadata.create("bar").addDeployedFile(getFile("PluginClassloadersTest/bar.jar"))); classloaders.done(); diff --git a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java index 3b20680b2dc..908003b855e 100644 --- a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java @@ -51,7 +51,7 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -106,7 +106,7 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @Test - public void hasNotificationSubscribers() throws Exception { + public void hasNotificationSubscribers() { setupData("findNotificationSubscribers"); // Nobody is subscribed @@ -175,7 +175,7 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @Test - public void select_module_properties_tree() throws Exception { + public void select_module_properties_tree() { setupData("select_module_properties_tree"); List properties = dao.selectEnabledDescendantModuleProperties("ABCD", session); diff --git a/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java index c4ce1c89af7..9a0605a2ee9 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class IdUuidPairsTest { @Test - public void extract_ids() throws Exception { + public void extract_ids() { List idUuidPairList = Lists.newArrayList(new IdUuidPair(1L, "ABCD"), new IdUuidPair(2L, "EFGH")); List ids = IdUuidPairs.ids(idUuidPairList); @@ -39,7 +39,7 @@ public class IdUuidPairsTest { } @Test - public void is_non_instantiable() throws Exception { + public void is_non_instantiable() { assertThat(TestUtils.hasOnlyPrivateConstructors(IdUuidPairs.class)).isTrue(); } diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java index 71dc8567ba1..b78687ff1d0 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class PurgeConfigurationTest { @Test - public void should_delete_all_closed_issues() throws Exception { + public void should_delete_all_closed_issues() { PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 0); assertThat(conf.maxLiveDateOfClosedIssues()).isNull(); @@ -37,7 +37,7 @@ public class PurgeConfigurationTest { } @Test - public void should_delete_only_old_closed_issues() throws Exception { + public void should_delete_only_old_closed_issues() { Date now = DateUtils.parseDate("2013-05-18"); PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java index 2ca41dc05c5..1be6ad63dd3 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java @@ -38,7 +38,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_projects_by_query() throws Exception { + public void select_all_projects_by_query() { setupData("shared"); ProjectQgateAssociationQuery query = ProjectQgateAssociationQuery.builder().gateId("42").build(); @@ -47,7 +47,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void select_projects_by_query() throws Exception { + public void select_projects_by_query() { setupData("shared"); assertThat(dao.selectProjects(ProjectQgateAssociationQuery.builder().gateId("42").membership(ProjectQgateAssociationQuery.IN).build(), 42L)).hasSize(3); @@ -55,7 +55,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_project_name() throws Exception { + public void search_by_project_name() { setupData("shared"); List result = dao.selectProjects(ProjectQgateAssociationQuery.builder().gateId("42").projectSearch("one").build(), 42L); @@ -70,7 +70,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_sorted_by_project_name() throws Exception { + public void should_be_sorted_by_project_name() { setupData("shared"); List result = dao.selectProjects(ProjectQgateAssociationQuery.builder().gateId("42").build(), 42L); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java index 98cd26c1874..e5213a74319 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ProjectQgateAssociationDtoTest { @Test - public void to_assoc_with_project_having_assoc() throws Exception { + public void to_assoc_with_project_having_assoc() { ProjectQgateAssociation project = new ProjectQgateAssociationDto() .setId(1L) .setName("polop") @@ -40,7 +40,7 @@ public class ProjectQgateAssociationDtoTest { } @Test - public void to_assoc_with_project_not_having_assoc() throws Exception { + public void to_assoc_with_project_not_having_assoc() { ProjectQgateAssociation project = new ProjectQgateAssociationDto() .setId(1L) .setName("polop") diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java index 6269c92139c..0a08efecac9 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class ProjectQgateAssociationQueryTest { @Test - public void fail_on_null_login() throws Exception { + public void fail_on_null_login() { ProjectQgateAssociationQuery.Builder builder = ProjectQgateAssociationQuery.builder(); builder.gateId(null); @@ -41,7 +41,7 @@ public class ProjectQgateAssociationQueryTest { } @Test - public void fail_on_invalid_membership() throws Exception { + public void fail_on_invalid_membership() { ProjectQgateAssociationQuery.Builder builder = ProjectQgateAssociationQuery.builder(); builder.gateId("nelson"); builder.membership("unknwown"); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java index 6ca42061c5b..7402e5c3456 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java @@ -34,7 +34,7 @@ public class QualityGateConditionDaoTest extends AbstractDaoTestCase { private static QualityGateConditionDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new QualityGateConditionDao(getMyBatis()); } @@ -84,7 +84,7 @@ public class QualityGateConditionDaoTest extends AbstractDaoTestCase { checkTable("update", "quality_gate_conditions", COLUMNS_WITHOUT_TIMESTAMPS); } - public void shouldCleanConditions() throws Exception { + public void shouldCleanConditions() { setupData("shouldCleanConditions"); dao.deleteConditionsWithInvalidMetrics(); checkTables("shouldCleanConditions", "quality_gate_conditions"); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java index e5dd4364e58..a7ac27d5286 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java @@ -33,7 +33,7 @@ public class QualityGateDaoTest extends AbstractDaoTestCase { private static QualityGateDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new QualityGateDao(getMyBatis()); } diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java index 89c2970dba1..f2c1ddbf51b 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class ActiveRuleKeyTest { @Test - public void of() throws Exception { + public void of() { RuleKey ruleKey = RuleKey.of("xoo", "R1"); ActiveRuleKey key = ActiveRuleKey.of("P1", ruleKey); assertThat(key.qProfile()).isEqualTo("P1"); @@ -37,7 +37,7 @@ public class ActiveRuleKeyTest { } @Test - public void rule_key_can_contain_colons() throws Exception { + public void rule_key_can_contain_colons() { RuleKey ruleKey = RuleKey.of("squid", "Key:With:Some::Colons"); ActiveRuleKey key = ActiveRuleKey.of("P1", ruleKey); assertThat(key.qProfile()).isEqualTo("P1"); @@ -46,7 +46,7 @@ public class ActiveRuleKeyTest { } @Test - public void profile_must_not_be_null() throws Exception { + public void profile_must_not_be_null() { try { ActiveRuleKey.of(null, RuleKey.of("xoo", "R1")); fail(); @@ -56,7 +56,7 @@ public class ActiveRuleKeyTest { } @Test - public void rule_key_must_not_be_null() throws Exception { + public void rule_key_must_not_be_null() { try { ActiveRuleKey.of("P1", null); fail(); @@ -66,7 +66,7 @@ public class ActiveRuleKeyTest { } @Test - public void parse() throws Exception { + public void parse() { ActiveRuleKey key = ActiveRuleKey.parse("P1:xoo:R1"); assertThat(key.qProfile()).isEqualTo("P1"); assertThat(key.ruleKey().repository()).isEqualTo("xoo"); @@ -74,7 +74,7 @@ public class ActiveRuleKeyTest { } @Test - public void parse_fail_when_less_than_three_colons() throws Exception { + public void parse_fail_when_less_than_three_colons() { try { ActiveRuleKey.parse("P1:xoo"); fail(); @@ -84,7 +84,7 @@ public class ActiveRuleKeyTest { } @Test - public void equals_and_hashcode() throws Exception { + public void equals_and_hashcode() { ActiveRuleKey key1 = ActiveRuleKey.parse("P1:xoo:R1"); ActiveRuleKey key1b = ActiveRuleKey.parse("P1:xoo:R1"); ActiveRuleKey key2 = ActiveRuleKey.parse("P1:xoo:R2"); diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java index c8238bb7740..d930967fd12 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ActiveRuleParamDtoTest { @Test - public void groupByKey() throws Exception { + public void groupByKey() { assertThat(ActiveRuleParamDto.groupByKey(Collections.emptyList())).isEmpty(); Collection dtos = Arrays.asList( diff --git a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java index 2a8c5bcbccc..a3f75efac0b 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java @@ -62,7 +62,7 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -224,7 +224,7 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase { } @Test - public void should_fail_when_no_default_template_is_defined() throws Exception { + public void should_fail_when_no_default_template_is_defined() { throwable.expect(IllegalStateException.class); permissions.grantDefaultRoles(project); diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java index cb3f32dff32..c154a7c0e80 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java @@ -59,7 +59,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -291,7 +291,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase { } @Test - public void should_insert_using_existing_session() throws Exception { + public void should_insert_using_existing_session() { setupData("insert"); ResourceDto file1 = new ResourceDto().setUuid("ABCD") diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java index fe0d55bd040..227d0925cbb 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java @@ -89,7 +89,7 @@ public class ResourceKeyUpdaterDaoTest extends AbstractDaoTestCase { } @Test - public void shouldNotUpdateAllSubmodules() throws Exception { + public void shouldNotUpdateAllSubmodules() { setupData("shouldNotUpdateAllSubmodules"); dao.bulkUpdateKey(1, "org.struts", "org.apache.struts"); diff --git a/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java index 6794e0e47f1..b6e59773e8c 100644 --- a/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java @@ -33,12 +33,12 @@ public class RuleDaoTest extends AbstractDaoTestCase { private static RuleDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new RuleDao(getMyBatis()); } @Test - public void select_enables_and_non_manual() throws Exception { + public void select_enables_and_non_manual() { setupData("select_enables_and_non_manual"); List ruleDtos = dao.selectEnablesAndNonManual(); @@ -63,7 +63,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_parameters() throws Exception { + public void select_parameters() { setupData("selectParameters"); List ruleDtos = dao.selectParameters(); diff --git a/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java b/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java index 4c35513a294..a9c08b44a17 100644 --- a/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class FileSourceDtoTest { @Test - public void encode_and_decode_test_data() throws Exception { + public void encode_and_decode_test_data() { List tests = Arrays.asList( FileSourceDb.Test.newBuilder() .setName("name#1") diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java index f0a97767e0e..3ea3a311fda 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java @@ -34,7 +34,7 @@ public class DefaultTechnicalDebtModelTest { private DefaultTechnicalDebtModel sqaleModel; @Before - public void setUp() throws Exception { + public void setUp() { DefaultDebtModel debtModel = new DefaultDebtModel(); debtModel.addCharacteristic( new DefaultDebtCharacteristic().setId(1) @@ -53,7 +53,7 @@ public class DefaultTechnicalDebtModelTest { } @Test - public void get_characteristics() throws Exception { + public void get_characteristics() { assertThat(sqaleModel.rootCharacteristics()).hasSize(1); DefaultCharacteristic resultRootCharacteristic = sqaleModel.rootCharacteristics().get(0); @@ -67,7 +67,7 @@ public class DefaultTechnicalDebtModelTest { } @Test - public void get_characteristic_by_key() throws Exception { + public void get_characteristic_by_key() { assertThat(sqaleModel.characteristicByKey("MEMORY_EFFICIENCY")).isNotNull(); assertThat(sqaleModel.characteristicByKey("EFFICIENCY")).isNotNull(); assertThat(sqaleModel.characteristicByKey("EFFICIENCY").parent()).isNotNull(); @@ -76,24 +76,24 @@ public class DefaultTechnicalDebtModelTest { } @Test - public void characteristic_by_id() throws Exception { + public void characteristic_by_id() { assertThat(sqaleModel.characteristicById(1)).isNotNull(); assertThat(sqaleModel.characteristicById(2)).isNotNull(); assertThat(sqaleModel.characteristicById(123)).isNull(); } @Test - public void get_requirement_by_rule_key_always_return_null() throws Exception { + public void get_requirement_by_rule_key_always_return_null() { assertThat(sqaleModel.requirementsByRule(RuleKey.of("checkstyle", "Regexp"))).isNull(); } @Test - public void get_requirement_by_id_always_return_null() throws Exception { + public void get_requirement_by_id_always_return_null() { assertThat(sqaleModel.requirementsById(1)).isNull(); } @Test - public void get_requirements_always_return_empty_list() throws Exception { + public void get_requirements_always_return_empty_list() { assertThat(sqaleModel.requirements()).isEmpty(); } diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java index fa86283adf7..1289e38132c 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java @@ -172,7 +172,7 @@ public class CharacteristicDaoTest extends AbstractDaoTestCase { } @Test - public void insert_characteristic() throws Exception { + public void insert_characteristic() { CharacteristicDto dto = new CharacteristicDto() .setKey("COMPILER_RELATED_PORTABILITY") .setName("Compiler related portability") @@ -186,7 +186,7 @@ public class CharacteristicDaoTest extends AbstractDaoTestCase { } @Test - public void update_characteristic() throws Exception { + public void update_characteristic() { setupData("update_characteristic"); CharacteristicDto dto = new CharacteristicDto() diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java index 28b278d2e0b..8d66dd657bc 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CharacteristicDtoTest { @Test - public void to_dto_from_characteristic() throws Exception { + public void to_dto_from_characteristic() { DefaultCharacteristic rootCharacteristic = new DefaultCharacteristic() .setId(1) .setKey("MEMORY_EFFICIENCY") @@ -57,7 +57,7 @@ public class CharacteristicDtoTest { } @Test - public void to_characteristic() throws Exception { + public void to_characteristic() { DefaultCharacteristic rootCharacteristic = new DefaultCharacteristic() .setId(1) .setKey("MEMORY_EFFICIENCY") diff --git a/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java index 63050f1e1a2..c4ecf345a32 100644 --- a/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java @@ -31,12 +31,12 @@ public class LoadedTemplateDaoTest extends AbstractDaoTestCase { private LoadedTemplateDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new LoadedTemplateDao(getMyBatis()); } @Test - public void shouldCountByTypeAndKey() throws Exception { + public void shouldCountByTypeAndKey() { setupData("shouldCountByTypeAndKey"); assertThat(dao.countByTypeAndKey("DASHBOARD", "HOTSPOTS"), is(1)); assertThat(dao.countByTypeAndKey("DASHBOARD", "UNKNOWN"), is(0)); @@ -44,7 +44,7 @@ public class LoadedTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void shouldInsert() throws Exception { + public void shouldInsert() { setupData("shouldInsert"); LoadedTemplateDto template = new LoadedTemplateDto("SQALE", "DASHBOARD"); diff --git a/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java index 8b547471fe2..3d9fe278bb3 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java @@ -68,7 +68,7 @@ public class AuthorDaoTest extends AbstractDaoTestCase { } @Test - public void shouldInsertAuthorAndDeveloper() throws Exception { + public void shouldInsertAuthorAndDeveloper() { setupData("shouldInsertAuthorAndDeveloper"); String login = "developer@company.net"; @@ -82,7 +82,7 @@ public class AuthorDaoTest extends AbstractDaoTestCase { } @Test - public void add_missing_module_uuid_path() throws Exception { + public void add_missing_module_uuid_path() { setupData("add_missing_module_uuid_path"); dao.insertAuthorAndDeveloper("developer@company.net", new ResourceDto().setName("developer@company.net").setQualifier("DEV").setUuid("ABCD").setProjectUuid("ABCD") @@ -109,7 +109,7 @@ public class AuthorDaoTest extends AbstractDaoTestCase { } @Test - public void shouldPreventAuthorsAndDevelopersDuplication() throws Exception { + public void shouldPreventAuthorsAndDevelopersDuplication() { setupData("shouldPreventAuthorsAndDevelopersDuplication"); String login = "developer@company.net"; diff --git a/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java index 3389d1f6204..1390d638c0b 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java @@ -43,13 +43,13 @@ public class AuthorizationDaoTest extends AbstractDaoTestCase { AuthorizationDao authorization; @Before - public void setUp() throws Exception { + public void setUp() { session = getMyBatis().openSession(false); authorization = new AuthorizationDao(getMyBatis()); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -286,7 +286,7 @@ public class AuthorizationDaoTest extends AbstractDaoTestCase { } @Test - public void should_return_global_permissions_for_group_anyone() throws Exception { + public void should_return_global_permissions_for_group_anyone() { setupData("should_return_global_permissions_for_group_anyone"); assertThat(authorization.selectGlobalPermissions("anyone_user")).containsOnly("user", "profileadmin"); diff --git a/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java b/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java index 55da48e5823..125f6e2d7e1 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java @@ -34,7 +34,7 @@ public class DefaultUserFinderTest { DefaultUserFinder finder = new DefaultUserFinder(dao); @Test - public void findByLogin() throws Exception { + public void findByLogin() { UserDto dto = new UserDto().setLogin("david").setName("David").setEmail("dav@id.com"); when(dao.selectActiveUserByLogin("david")).thenReturn(dto); @@ -42,7 +42,7 @@ public class DefaultUserFinderTest { } @Test - public void findByLogins() throws Exception { + public void findByLogins() { UserDto david = new UserDto().setLogin("david").setName("David").setEmail("dav@id.com"); UserDto john = new UserDto().setLogin("john").setName("John").setEmail("jo@hn.com"); when(dao.selectUsersByLogins(Arrays.asList("david", "john"))).thenReturn(Arrays.asList(david, john)); @@ -55,7 +55,7 @@ public class DefaultUserFinderTest { } @Test - public void findByQuery() throws Exception { + public void findByQuery() { UserQuery query = UserQuery.builder().logins("simon").build(); finder.find(query); verify(dao).selectUsers(query); diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java index 47f9fbd71aa..41434d92e6c 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GroupDtoTest { @Test - public void getter_and_setter() throws Exception { + public void getter_and_setter() { GroupDto dto = new GroupDto() .setId(1L) .setName("sonar-users") diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java index ea1fd3bdd5a..d6cb76d9dcf 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java @@ -47,7 +47,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_all_groups_by_query() throws Exception { + public void select_all_groups_by_query() { dbTester.prepareDbUnit(getClass(), "shared.xml"); GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").build(); @@ -56,7 +56,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_user_group() throws Exception { + public void select_user_group() { dbTester.prepareDbUnit(getClass(), "select_user_group.xml"); GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").build(); @@ -71,7 +71,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_user_groups_by_query() throws Exception { + public void select_user_groups_by_query() { dbTester.prepareDbUnit(getClass(), "shared.xml"); // 200 is member of 3 groups @@ -83,7 +83,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_groups_not_affected_to_a_user_by_query() throws Exception { + public void select_groups_not_affected_to_a_user_by_query() { dbTester.prepareDbUnit(getClass(), "shared.xml"); // 200 is member of 3 groups @@ -95,7 +95,7 @@ public class GroupMembershipDaoTest { } @Test - public void search_by_group_name() throws Exception { + public void search_by_group_name() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").groupSearch("user").build(), 200L); @@ -108,7 +108,7 @@ public class GroupMembershipDaoTest { } @Test - public void search_by_group_name_with_capitalization() throws Exception { + public void search_by_group_name_with_capitalization() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").groupSearch("UsER").build(), 200L); @@ -121,7 +121,7 @@ public class GroupMembershipDaoTest { } @Test - public void should_be_sorted_by_group_name() throws Exception { + public void should_be_sorted_by_group_name() { dbTester.prepareDbUnit(getClass(), "should_be_sorted_by_group_name.xml"); List result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").build(), 200L); @@ -132,7 +132,7 @@ public class GroupMembershipDaoTest { } @Test - public void should_be_paginated() throws Exception { + public void should_be_paginated() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").build(), 200L, 0, 2); @@ -151,7 +151,7 @@ public class GroupMembershipDaoTest { } @Test - public void count_groups() throws Exception { + public void count_groups() { dbTester.prepareDbUnit(getClass(), "shared.xml"); DbSession session = dbTester.myBatis().openSession(false); diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java index f4825d7441e..a5148779db0 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GroupMembershipDtoTest { @Test - public void to_group_with_permission_having_permission() throws Exception { + public void to_group_with_permission_having_permission() { GroupMembership group = new GroupMembershipDto() .setId(1L) .setName("users") @@ -42,7 +42,7 @@ public class GroupMembershipDtoTest { } @Test - public void to_group_with_permission_not_having_permission() throws Exception { + public void to_group_with_permission_not_having_permission() { GroupMembership group = new GroupMembershipDto() .setId(1L) .setName("users") diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java index 393e9288fb5..8478c83c10b 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class GroupMembershipQueryTest { @Test - public void fail_on_null_login() throws Exception { + public void fail_on_null_login() { GroupMembershipQuery.Builder builder = GroupMembershipQuery.builder(); builder.login(null); @@ -41,7 +41,7 @@ public class GroupMembershipQueryTest { } @Test - public void fail_on_invalid_membership() throws Exception { + public void fail_on_invalid_membership() { GroupMembershipQuery.Builder builder = GroupMembershipQuery.builder(); builder.login("nelson"); builder.membership("unknwown"); diff --git a/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java index d3f0051d8ee..932f25c874a 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java @@ -38,18 +38,18 @@ public class RoleDaoTest extends AbstractDaoTestCase { RoleDao dao; @Before - public void setUp() throws Exception { + public void setUp() { session = getMyBatis().openSession(false); dao = new RoleDao(); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void retrieve_global_user_permissions() throws Exception { + public void retrieve_global_user_permissions() { setupData("globalUserPermissions"); assertThat(dao.selectUserPermissions(session, "admin_user", null)).containsOnly(GlobalPermissions.SYSTEM_ADMIN, GlobalPermissions.QUALITY_PROFILE_ADMIN); @@ -57,7 +57,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void retrieve_resource_user_permissions() throws Exception { + public void retrieve_resource_user_permissions() { setupData("resourceUserPermissions"); assertThat(dao.selectUserPermissions(session, "admin_user", 1L)).containsOnly(UserRole.ADMIN, UserRole.USER); @@ -65,7 +65,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void retrieve_global_group_permissions() throws Exception { + public void retrieve_global_group_permissions() { setupData("globalGroupPermissions"); assertThat(dao.selectGroupPermissions(session, "sonar-administrators", null)).containsOnly(GlobalPermissions.SYSTEM_ADMIN, GlobalPermissions.QUALITY_PROFILE_ADMIN, @@ -77,7 +77,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void retrieve_resource_group_permissions() throws Exception { + public void retrieve_resource_group_permissions() { setupData("resourceGroupPermissions"); assertThat(dao.selectGroupPermissions(session, "sonar-administrators", 1L)).containsOnly(UserRole.ADMIN, UserRole.CODEVIEWER); @@ -85,7 +85,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_global_user_permission() throws Exception { + public void delete_global_user_permission() { setupData("globalUserPermissions"); UserRoleDto userRoleToDelete = new UserRoleDto().setUserId(200L).setRole(GlobalPermissions.QUALITY_PROFILE_ADMIN); @@ -97,7 +97,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_resource_user_permission() throws Exception { + public void delete_resource_user_permission() { setupData("resourceUserPermissions"); UserRoleDto userRoleToDelete = new UserRoleDto().setUserId(200L).setRole(UserRole.USER).setResourceId(1L); @@ -109,7 +109,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_global_group_permission() throws Exception { + public void delete_global_group_permission() { setupData("globalGroupPermissions"); GroupRoleDto groupRoleToDelete = new GroupRoleDto().setGroupId(100L).setRole(GlobalPermissions.QUALITY_PROFILE_ADMIN); @@ -121,7 +121,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_resource_group_permission() throws Exception { + public void delete_resource_group_permission() { setupData("resourceGroupPermissions"); GroupRoleDto groupRoleToDelete = new GroupRoleDto().setGroupId(100L).setRole(UserRole.CODEVIEWER).setResourceId(1L); diff --git a/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java index 92150278869..c1d92ffd452 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java @@ -53,7 +53,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -77,7 +77,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByLogins() throws Exception { + public void selectUsersByLogins() { setupData("selectUsersByLogins"); Collection users = dao.selectUsersByLogins(Arrays.asList("marius", "inactive_user", "other")); @@ -86,14 +86,14 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByLogins_empty_logins() throws Exception { + public void selectUsersByLogins_empty_logins() { // no need to access db Collection users = dao.selectUsersByLogins(Collections.emptyList()); assertThat(users).isEmpty(); } @Test - public void selectUsersByQuery_all() throws Exception { + public void selectUsersByQuery_all() { setupData("selectUsersByQuery"); UserQuery query = UserQuery.builder().includeDeactivated().build(); @@ -102,7 +102,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_only_actives() throws Exception { + public void selectUsersByQuery_only_actives() { setupData("selectUsersByQuery"); UserQuery query = UserQuery.ALL_ACTIVES; @@ -112,7 +112,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_filter_by_login() throws Exception { + public void selectUsersByQuery_filter_by_login() { setupData("selectUsersByQuery"); UserQuery query = UserQuery.builder().logins("marius", "john").build(); @@ -122,7 +122,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_search_by_login_text() throws Exception { + public void selectUsersByQuery_search_by_login_text() { setupData("selectUsersByText"); UserQuery query = UserQuery.builder().searchText("sbr").build(); @@ -132,7 +132,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_search_by_name_text() throws Exception { + public void selectUsersByQuery_search_by_name_text() { setupData("selectUsersByText"); UserQuery query = UserQuery.builder().searchText("Simon").build(); @@ -142,7 +142,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_escape_special_characters_in_like() throws Exception { + public void selectUsersByQuery_escape_special_characters_in_like() { setupData("selectUsersByText"); UserQuery query = UserQuery.builder().searchText("%s%").build(); diff --git a/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java b/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java index 23150850e60..ca2ce0601bd 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class UserDtoTest { @Test - public void encode_scm_accounts() throws Exception { + public void encode_scm_accounts() { assertThat(UserDto.encodeScmAccounts(null)).isNull(); assertThat(UserDto.encodeScmAccounts(Collections.emptyList())).isNull(); assertThat(UserDto.encodeScmAccounts(Arrays.asList("foo"))).isEqualTo("\nfoo\n"); @@ -37,7 +37,7 @@ public class UserDtoTest { } @Test - public void decode_scm_accounts() throws Exception { + public void decode_scm_accounts() { assertThat(UserDto.decodeScmAccounts(null)).isEmpty(); assertThat(UserDto.decodeScmAccounts("\nfoo\n")).containsOnly("foo"); assertThat(UserDto.decodeScmAccounts("\nfoo\nbar\n")).containsOnly("foo", "bar"); diff --git a/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java b/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java index c7f40b0c83b..9f5109a36b3 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MultiSetsTest { @Test - public void order_with_highest_count_first() throws Exception { + public void order_with_highest_count_first() { Multiset multiset = HashMultiset.create(); add(multiset, "seneca", 10); add(multiset, "plato", 5); diff --git a/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java b/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java index 45f4ae03548..100ab15cce3 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java @@ -29,7 +29,7 @@ public class NonNullInputFunctionTest { NonNullInputFunction sut = new TestFunction(); @Test - public void fail_if_null_input() throws Exception { + public void fail_if_null_input() { try { sut.apply(null); fail(); @@ -39,7 +39,7 @@ public class NonNullInputFunctionTest { } @Test - public void apply() throws Exception { + public void apply() { assertThat(sut.apply("foo")).isEqualTo(3); } diff --git a/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java b/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java index b9a58a2605b..d525fe3c7c6 100644 --- a/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java @@ -38,7 +38,7 @@ public class MeasuresDaoTest extends AbstractDbUnitTestCase { private ResourceModel project; @Before - public void before() throws Exception { + public void before() { service = new MeasuresDao(getSession()); project = new ResourceModel(ResourceModel.SCOPE_PROJECT, "foo:bar", ResourceModel.QUALIFIER_PROJECT_TRUNK, null, "Foo"); project.setName("project name"); diff --git a/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java b/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java index af7ba9655af..b3d0c14da46 100644 --- a/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java +++ b/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java @@ -50,7 +50,7 @@ public class DatabaseSessionTest extends AbstractDbUnitTestCase { } @Test - public void performanceTestOnBatchInserts() throws Exception { + public void performanceTestOnBatchInserts() { getSession().save(project1); Snapshot snapshot = new Snapshot(project1, true, "", new Date(1)); getSession().save(snapshot); diff --git a/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java b/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java index 4cc3bda8872..d2d098b9402 100644 --- a/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java +++ b/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java @@ -72,7 +72,7 @@ public class NoSonarFilterTest { } @Test - public void should_accept_violations_from_no_sonar_rules() throws Exception { + public void should_accept_violations_from_no_sonar_rules() { // The "No Sonar" rule logs violations on the lines that are flagged with "NOSONAR" !! Set noSonarLines = new HashSet(); diff --git a/sonar-home/src/test/java/org/sonar/home/cache/FileCacheBuilderTest.java b/sonar-home/src/test/java/org/sonar/home/cache/FileCacheBuilderTest.java index 22af2e52a73..59125570012 100644 --- a/sonar-home/src/test/java/org/sonar/home/cache/FileCacheBuilderTest.java +++ b/sonar-home/src/test/java/org/sonar/home/cache/FileCacheBuilderTest.java @@ -42,7 +42,7 @@ public class FileCacheBuilderTest { } @Test - public void user_home_property_can_be_null() throws Exception { + public void user_home_property_can_be_null() { FileCache cache = new FileCacheBuilder().setUserHome((String) null).build(); // does not fail. It uses default path or env variable @@ -51,7 +51,7 @@ public class FileCacheBuilderTest { } @Test - public void use_default_path_or_env_variable() throws Exception { + public void use_default_path_or_env_variable() { FileCache cache = new FileCacheBuilder().build(); assertThat(cache.getDir()).isDirectory().exists(); diff --git a/sonar-home/src/test/java/org/sonar/home/cache/FileCacheTest.java b/sonar-home/src/test/java/org/sonar/home/cache/FileCacheTest.java index 2387a796ab7..c831e5af598 100644 --- a/sonar-home/src/test/java/org/sonar/home/cache/FileCacheTest.java +++ b/sonar-home/src/test/java/org/sonar/home/cache/FileCacheTest.java @@ -122,7 +122,7 @@ public class FileCacheTest { } @Test - public void unzip_from_cache() throws IOException, URISyntaxException, InterruptedException, ExecutionException { + public void unzip_from_cache() throws IOException, URISyntaxException { final File samplePlugin = new File(this.getClass().getResource("/sonar-checkstyle-plugin-2.8.jar").toURI()); FileHashes hashes = mock(FileHashes.class); final FileCache cache = new FileCache(tempFolder.newFolder(), log, hashes); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/DebtRemediationFunctionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/DebtRemediationFunctionTest.java index d81198ba11d..09c65ee553d 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/DebtRemediationFunctionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/DebtRemediationFunctionTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DebtRemediationFunctionTest { @Test - public void create_linear() throws Exception { + public void create_linear() { DebtRemediationFunction function = DebtRemediationFunction.createLinear(Duration.create(10)); assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR); assertThat(function.coefficient()).isEqualTo(Duration.create(10)); @@ -36,7 +36,7 @@ public class DebtRemediationFunctionTest { } @Test - public void create_linear_with_offset() throws Exception { + public void create_linear_with_offset() { DebtRemediationFunction function = DebtRemediationFunction.createLinearWithOffset(Duration.create(10), Duration.create(5)); assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET); assertThat(function.coefficient()).isEqualTo(Duration.create(10)); @@ -44,7 +44,7 @@ public class DebtRemediationFunctionTest { } @Test - public void create_constant_per_issue() throws Exception { + public void create_constant_per_issue() { DebtRemediationFunction function = DebtRemediationFunction.createConstantPerIssue(Duration.create(10)); assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE); assertThat(function.coefficient()).isNull(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtCharacteristicTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtCharacteristicTest.java index 0dd4dca7531..932e7d22d0a 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtCharacteristicTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtCharacteristicTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DefaultDebtCharacteristicTest { @Test - public void setter_and_getter_on_characteristic() throws Exception { + public void setter_and_getter_on_characteristic() { DefaultDebtCharacteristic debtCharacteristic = new DefaultDebtCharacteristic() .setId(1) .setKey("PORTABILITY") @@ -49,7 +49,7 @@ public class DefaultDebtCharacteristicTest { } @Test - public void setter_and_getter_on_sub_characteristic() throws Exception { + public void setter_and_getter_on_sub_characteristic() { DefaultDebtCharacteristic debtCharacteristic = new DefaultDebtCharacteristic() .setId(1) .setKey("COMPILER") @@ -69,7 +69,7 @@ public class DefaultDebtCharacteristicTest { } @Test - public void to_string() throws Exception { + public void to_string() { assertThat(new DefaultDebtCharacteristic() .setId(1) .setKey("PORTABILITY") diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtModelTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtModelTest.java index 944c892ca72..6840f37d576 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtModelTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/debt/internal/DefaultDebtModelTest.java @@ -30,7 +30,7 @@ public class DefaultDebtModelTest { private DefaultDebtModel debtModel; @Before - public void setUp() throws Exception { + public void setUp() { debtModel = new DefaultDebtModel() .addCharacteristic( new DefaultDebtCharacteristic().setId(1) @@ -48,22 +48,22 @@ public class DefaultDebtModelTest { } @Test - public void all_characteristics() throws Exception { + public void all_characteristics() { assertThat(debtModel.allCharacteristics()).hasSize(2); } @Test - public void characteristics() throws Exception { + public void characteristics() { assertThat(debtModel.characteristics()).hasSize(1); } @Test - public void sub_characteristics() throws Exception { + public void sub_characteristics() { assertThat(debtModel.subCharacteristics("MEMORY_EFFICIENCY")).hasSize(1); } @Test - public void characteristic_by_id() throws Exception { + public void characteristic_by_id() { DefaultDebtCharacteristic debtCharacteristic = (DefaultDebtCharacteristic) debtModel.characteristicById(1); assertThat(debtCharacteristic).isNotNull(); assertThat(debtCharacteristic.id()).isEqualTo(1); @@ -78,7 +78,7 @@ public class DefaultDebtModelTest { } @Test - public void characteristic_by_key() throws Exception { + public void characteristic_by_key() { DefaultDebtCharacteristic debtCharacteristic = (DefaultDebtCharacteristic) debtModel.characteristicByKey("EFFICIENCY"); assertThat(debtCharacteristic).isNotNull(); assertThat(debtCharacteristic.id()).isEqualTo(2); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFilePredicatesTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFilePredicatesTest.java index 4fdabac2ad9..1877b74831c 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFilePredicatesTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFilePredicatesTest.java @@ -53,45 +53,45 @@ public class DefaultFilePredicatesTest { } @Test - public void all() throws Exception { + public void all() { Assertions.assertThat(predicates.all().apply(javaFile)).isTrue(); } @Test - public void none() throws Exception { + public void none() { assertThat(predicates.none().apply(javaFile)).isFalse(); } @Test - public void matches_inclusion_pattern() throws Exception { + public void matches_inclusion_pattern() { assertThat(predicates.matchesPathPattern("src/main/**/Action.java").apply(javaFile)).isTrue(); assertThat(predicates.matchesPathPattern("Action.java").apply(javaFile)).isFalse(); assertThat(predicates.matchesPathPattern("src/**/*.php").apply(javaFile)).isFalse(); } @Test - public void matches_inclusion_patterns() throws Exception { + public void matches_inclusion_patterns() { assertThat(predicates.matchesPathPatterns(new String[] {"src/other/**.java", "src/main/**/Action.java"}).apply(javaFile)).isTrue(); assertThat(predicates.matchesPathPatterns(new String[] {}).apply(javaFile)).isTrue(); assertThat(predicates.matchesPathPatterns(new String[] {"src/other/**.java", "src/**/*.php"}).apply(javaFile)).isFalse(); } @Test - public void does_not_match_exclusion_pattern() throws Exception { + public void does_not_match_exclusion_pattern() { assertThat(predicates.doesNotMatchPathPattern("src/main/**/Action.java").apply(javaFile)).isFalse(); assertThat(predicates.doesNotMatchPathPattern("Action.java").apply(javaFile)).isTrue(); assertThat(predicates.doesNotMatchPathPattern("src/**/*.php").apply(javaFile)).isTrue(); } @Test - public void does_not_match_exclusion_patterns() throws Exception { + public void does_not_match_exclusion_patterns() { assertThat(predicates.doesNotMatchPathPatterns(new String[] {}).apply(javaFile)).isTrue(); assertThat(predicates.doesNotMatchPathPatterns(new String[] {"src/other/**.java", "src/**/*.php"}).apply(javaFile)).isTrue(); assertThat(predicates.doesNotMatchPathPatterns(new String[] {"src/other/**.java", "src/main/**/Action.java"}).apply(javaFile)).isFalse(); } @Test - public void has_relative_path() throws Exception { + public void has_relative_path() { assertThat(predicates.hasRelativePath("src/main/java/struts/Action.java").apply(javaFile)).isTrue(); assertThat(predicates.hasRelativePath("src/main/java/struts/Other.java").apply(javaFile)).isFalse(); @@ -139,38 +139,38 @@ public class DefaultFilePredicatesTest { } @Test - public void has_language() throws Exception { + public void has_language() { assertThat(predicates.hasLanguage("java").apply(javaFile)).isTrue(); assertThat(predicates.hasLanguage("php").apply(javaFile)).isFalse(); } @Test - public void has_languages() throws Exception { + public void has_languages() { assertThat(predicates.hasLanguages(Arrays.asList("java", "php")).apply(javaFile)).isTrue(); assertThat(predicates.hasLanguages(Arrays.asList("cobol", "php")).apply(javaFile)).isFalse(); assertThat(predicates.hasLanguages(Collections.emptyList()).apply(javaFile)).isTrue(); } @Test - public void has_status() throws Exception { + public void has_status() { assertThat(predicates.hasStatus(InputFile.Status.ADDED).apply(javaFile)).isTrue(); assertThat(predicates.hasStatus(InputFile.Status.CHANGED).apply(javaFile)).isFalse(); } @Test - public void has_type() throws Exception { + public void has_type() { assertThat(predicates.hasType(InputFile.Type.MAIN).apply(javaFile)).isTrue(); assertThat(predicates.hasType(InputFile.Type.TEST).apply(javaFile)).isFalse(); } @Test - public void not() throws Exception { + public void not() { assertThat(predicates.not(predicates.hasType(InputFile.Type.MAIN)).apply(javaFile)).isFalse(); assertThat(predicates.not(predicates.hasType(InputFile.Type.TEST)).apply(javaFile)).isTrue(); } @Test - public void and() throws Exception { + public void and() { // empty assertThat(predicates.and().apply(javaFile)).isTrue(); assertThat(predicates.and(new FilePredicate[0]).apply(javaFile)).isTrue(); @@ -191,7 +191,7 @@ public class DefaultFilePredicatesTest { } @Test - public void or() throws Exception { + public void or() { // empty assertThat(predicates.or().apply(javaFile)).isTrue(); assertThat(predicates.or(new FilePredicate[0]).apply(javaFile)).isTrue(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFileSystemTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFileSystemTest.java index 6c7a5bd9f0d..0b9ecdeecec 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFileSystemTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultFileSystemTest.java @@ -70,7 +70,7 @@ public class DefaultFileSystemTest { } @Test - public void add_languages() throws Exception { + public void add_languages() { assertThat(fs.languages()).isEmpty(); fs.addLanguages("java", "php", "cobol"); @@ -78,7 +78,7 @@ public class DefaultFileSystemTest { } @Test - public void files() throws Exception { + public void files() { assertThat(fs.inputFiles(fs.predicates().all())).isEmpty(); fs.add(new DefaultInputFile("foo", "src/Foo.php").setLanguage("php")); @@ -108,13 +108,13 @@ public class DefaultFileSystemTest { } @Test - public void input_file_returns_null_if_file_not_found() throws Exception { + public void input_file_returns_null_if_file_not_found() { assertThat(fs.inputFile(fs.predicates().hasRelativePath("src/Bar.java"))).isNull(); assertThat(fs.inputFile(fs.predicates().hasLanguage("cobol"))).isNull(); } @Test - public void input_file_fails_if_too_many_results() throws Exception { + public void input_file_fails_if_too_many_results() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("expected one element"); @@ -125,7 +125,7 @@ public class DefaultFileSystemTest { } @Test - public void input_file_supports_non_indexed_predicates() throws Exception { + public void input_file_supports_non_indexed_predicates() { fs.add(new DefaultInputFile("foo", "src/Bar.java").setLanguage("java")); // it would fail if more than one java file diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/PathPatternTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/PathPatternTest.java index aa0e0c4abe5..b1bb79fce9b 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/PathPatternTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/PathPatternTest.java @@ -33,7 +33,7 @@ public class PathPatternTest { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void match_relative_path() throws Exception { + public void match_relative_path() { PathPattern pattern = PathPattern.create("**/*Foo.java"); assertThat(pattern.toString()).isEqualTo("**/*Foo.java"); @@ -91,7 +91,7 @@ public class PathPatternTest { } @Test - public void create_array_of_patterns() throws Exception { + public void create_array_of_patterns() { PathPattern[] patterns = PathPattern.create(new String[] { "**/src/main/**Foo.java", "file:**/src/main/**Bar.java" diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java index b3a7c4306f9..29cfc369d0a 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java @@ -30,14 +30,14 @@ import static org.junit.Assert.fail; public class ActiveRulesBuilderTest { @Test - public void no_rules() throws Exception { + public void no_rules() { ActiveRulesBuilder builder = new ActiveRulesBuilder(); ActiveRules rules = builder.build(); assertThat(rules.findAll()).isEmpty(); } @Test - public void build_rules() throws Exception { + public void build_rules() { ActiveRules activeRules = new ActiveRulesBuilder() .create(RuleKey.of("squid", "S0001")) .setName("My Rule") @@ -78,7 +78,7 @@ public class ActiveRulesBuilderTest { } @Test - public void fail_to_add_twice_the_same_rule() throws Exception { + public void fail_to_add_twice_the_same_rule() { ActiveRulesBuilder builder = new ActiveRulesBuilder(); builder.create(RuleKey.of("squid", "S0001")).activate(); try { diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java index 6dcd026ef35..95f0cea83cd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java @@ -33,14 +33,14 @@ import static org.junit.Assert.fail; public class RulesBuilderTest { @Test - public void no_rules() throws Exception { + public void no_rules() { RulesBuilder builder = new RulesBuilder(); Rules rules = builder.build(); assertThat(rules.findAll()).isEmpty(); } @Test - public void build_rules() throws Exception { + public void build_rules() { RulesBuilder builder = new RulesBuilder(); NewRule newSquid1 = builder.add(RuleKey.of("squid", "S0001")); newSquid1.setName("Detect bug"); @@ -95,7 +95,7 @@ public class RulesBuilderTest { } @Test - public void fail_to_add_twice_the_same_rule() throws Exception { + public void fail_to_add_twice_the_same_rule() { RulesBuilder builder = new RulesBuilder(); builder.add(RuleKey.of("squid", "S0001")); try { @@ -107,7 +107,7 @@ public class RulesBuilderTest { } @Test - public void fail_to_add_twice_the_same_param() throws Exception { + public void fail_to_add_twice_the_same_param() { RulesBuilder builder = new RulesBuilder(); NewRule newRule = builder.add(RuleKey.of("squid", "S0001")); newRule.addParam("min"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/internal/DefaultHighlightingTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/internal/DefaultHighlightingTest.java index 03726d4d74a..acd24d674cb 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/internal/DefaultHighlightingTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/internal/DefaultHighlightingTest.java @@ -67,7 +67,7 @@ public class DefaultHighlightingTest { } @Test - public void should_register_highlighting_rule() throws Exception { + public void should_register_highlighting_rule() { assertThat(highlightingRules).hasSize(6); } @@ -76,7 +76,7 @@ public class DefaultHighlightingTest { } @Test - public void should_order_by_start_then_end_offset() throws Exception { + public void should_order_by_start_then_end_offset() { assertThat(highlightingRules).extracting("range", TextRange.class).containsExactly(rangeOf(1, 0, 1, 10), rangeOf(1, 10, 1, 12), rangeOf(1, 12, 1, 20), @@ -87,7 +87,7 @@ public class DefaultHighlightingTest { } @Test - public void should_suport_overlapping() throws Exception { + public void should_suport_overlapping() { new DefaultHighlighting(mock(SensorStorage.class)) .onFile(INPUT_FILE) .highlight(0, 15, KEYWORD) @@ -96,7 +96,7 @@ public class DefaultHighlightingTest { } @Test - public void should_prevent_boudaries_overlapping() throws Exception { + public void should_prevent_boudaries_overlapping() { throwable.expect(IllegalStateException.class); throwable .expectMessage("Cannot register highlighting rule for characters at Range[from [line=1, lineOffset=8] to [line=1, lineOffset=15]] as it overlaps at least one existing rule"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/AesCipherTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/AesCipherTest.java index b2dccf589b3..ad50caadfc6 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/AesCipherTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/AesCipherTest.java @@ -175,7 +175,7 @@ public class AesCipherTest { } @Test - public void doesNotHaveSecretKey() throws Exception { + public void doesNotHaveSecretKey() { AesCipher cipher = new AesCipher("/my/twitter/id/is/SimonBrandhof"); assertThat(cipher.hasSecretKey(), Matchers.is(false)); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java index 3a9fc4d29a2..2244d81f0a6 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java @@ -39,12 +39,12 @@ public class CategoryTest { } @Test - public void should_normalize_key() throws Exception { + public void should_normalize_key() { assertThat(new Category("Licenses").key()).isEqualTo("licenses"); } @Test - public void should_use_original_key() throws Exception { + public void should_use_original_key() { assertThat(new Category("Licenses").toString()).isEqualTo("Licenses"); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java index ff14eae997f..32a2d772d0b 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java @@ -123,7 +123,7 @@ public class SettingsTest { } @Test - public void setProperty_date() throws Exception { + public void setProperty_date() { Settings settings = new Settings(); Date date = DateUtils.parseDateTime("2010-05-18T15:50:45+0100"); settings.setProperty("aDate", date); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/database/model/MeasureModelTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/database/model/MeasureModelTest.java index 24547b68d06..4a8ec6601a0 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/database/model/MeasureModelTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/database/model/MeasureModelTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MeasureModelTest { @Test - public void text_is_utf8() throws UnsupportedEncodingException { + public void text_is_utf8() { String s = "accents éà and special characters ç€"; MeasureModel measure = new MeasureModel(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java index ddcaacbb992..230826a8b87 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java @@ -69,7 +69,7 @@ public class NoSonarFilterTest { } @Test - public void should_accept_issues_on_no_sonar_rules() throws Exception { + public void should_accept_issues_on_no_sonar_rules() { // The "No Sonar" rule logs violations on the lines that are flagged with "NOSONAR" !! Issue issue = mock(Issue.class); when(issue.componentKey()).thenReturn("struts:org.apache.Action"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java index a2d1aef5eef..e1fb1f2bb41 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionTest.java @@ -48,7 +48,7 @@ public class ActionTest { } @Test - public void key_should_be_set() throws Exception { + public void key_should_be_set() { try { new Action(""); fail(); @@ -58,7 +58,7 @@ public class ActionTest { } @Test - public void should_verify_conditions() throws Exception { + public void should_verify_conditions() { DefaultIssue issue = new DefaultIssue(); Action action = new Action("link-to-jira") .setConditions(condition1, condition2); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java index 898d1570458..805cfd9a49e 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/action/ActionsTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ActionsTest { @Test - public void add_action() throws Exception { + public void add_action() { Actions actions = new Actions(); actions.add("plan"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java index fe0937fe1d4..67467178ba1 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasResolutionTest.java @@ -30,7 +30,7 @@ public class HasResolutionTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_match() throws Exception { + public void should_match() { HasResolution condition = new HasResolution(Issue.RESOLUTION_FIXED, Issue.RESOLUTION_FALSE_POSITIVE); assertThat(condition.matches(issue.setResolution("FIXED"))).isTrue(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasStatusTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasStatusTest.java index ab9705a7068..4b3b6e834cd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasStatusTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/HasStatusTest.java @@ -30,7 +30,7 @@ public class HasStatusTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_match() throws Exception { + public void should_match() { HasStatus condition = new HasStatus("OPEN", "REOPENED", "CONFIRMED"); assertThat(condition.matches(issue.setStatus("OPEN"))).isTrue(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java index f626e00ed86..3e826ba0ebf 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/IsUnResolvedTest.java @@ -30,7 +30,7 @@ public class IsUnResolvedTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_match() throws Exception { + public void should_match() { IsUnResolved condition = new IsUnResolved(); assertThat(condition.matches(issue)).isTrue(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/NotConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/NotConditionTest.java index 52897dc7672..4f35e961efd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/NotConditionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/condition/NotConditionTest.java @@ -33,7 +33,7 @@ public class NotConditionTest { Condition target = Mockito.mock(Condition.class); @Test - public void should_match_opposite() throws Exception { + public void should_match_opposite() { NotCondition condition = new NotCondition(target); when(target.matches(any(Issue.class))).thenReturn(true); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java index 998d89e1451..6ab20d2dc64 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/DefaultIssueTest.java @@ -99,7 +99,7 @@ public class DefaultIssueTest { } @Test - public void set_empty_dates() throws Exception { + public void set_empty_dates() { issue .setCreationDate(null) .setUpdateDate(null) @@ -124,7 +124,7 @@ public class DefaultIssueTest { } @Test - public void setAttributes_should_not_clear_existing_values() throws Exception { + public void setAttributes_should_not_clear_existing_values() { issue.setAttributes(ImmutableMap.of("1", "one")); assertThat(issue.attribute("1")).isEqualTo("one"); @@ -193,7 +193,7 @@ public class DefaultIssueTest { } @Test - public void comments_should_not_be_modifiable() throws Exception { + public void comments_should_not_be_modifiable() { DefaultIssue issue = new DefaultIssue().setKey("AAA"); List comments = issue.comments(); @@ -210,7 +210,7 @@ public class DefaultIssueTest { } @Test - public void all_changes_contain_current_change() throws Exception { + public void all_changes_contain_current_change() { IssueChangeContext issueChangeContext = mock(IssueChangeContext.class); DefaultIssue issue = new DefaultIssue().setKey("AAA").setFieldChange(issueChangeContext, "actionPlan", "1.0", "1.1"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/FieldDiffsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/FieldDiffsTest.java index 1e00d66167c..3de9680e8d0 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/FieldDiffsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/internal/FieldDiffsTest.java @@ -28,7 +28,7 @@ public class FieldDiffsTest { FieldDiffs diffs = new FieldDiffs(); @Test - public void diffs_should_be_empty_by_default() throws Exception { + public void diffs_should_be_empty_by_default() { assertThat(diffs.diffs()).isEmpty(); } @@ -49,7 +49,7 @@ public class FieldDiffsTest { } @Test - public void diff_with_long_values() throws Exception { + public void diff_with_long_values() { diffs.setDiff("technicalDebt", 50l, "100"); FieldDiffs.Diff diff = diffs.diffs().get("technicalDebt"); @@ -58,7 +58,7 @@ public class FieldDiffsTest { } @Test - public void diff_with_empty_long_values() throws Exception { + public void diff_with_empty_long_values() { diffs.setDiff("technicalDebt", null, ""); FieldDiffs.Diff diff = diffs.diffs().get("technicalDebt"); @@ -83,7 +83,7 @@ public class FieldDiffsTest { } @Test - public void should_keep_old_value() throws Exception { + public void should_keep_old_value() { diffs.setDiff("severity", "BLOCKER", "INFO"); diffs.setDiff("severity", null, "MAJOR"); FieldDiffs.Diff diff = diffs.diffs().get("severity"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureUtilsTest.java index 1935e5c19a7..30a0ce20bad 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureUtilsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureUtilsTest.java @@ -114,7 +114,7 @@ public class MeasureUtilsTest { } @Test - public void shouldSumOnVariation() throws Exception { + public void shouldSumOnVariation() { Measure measure1 = new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation1(1.0).setVariation2(1.0).setVariation3(3.0); Measure measure2 = new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation1(1.0).setVariation2(2.0).setVariation3(3.0); List children = Arrays.asList(measure1, measure2); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/SumChildDistributionFormulaTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/SumChildDistributionFormulaTest.java index 6129400fede..b4d64fd8551 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/SumChildDistributionFormulaTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/SumChildDistributionFormulaTest.java @@ -96,7 +96,7 @@ public class SumChildDistributionFormulaTest { } @Test - public void shouldNotPersistWhenScopeLowerThanMinimun() throws Exception { + public void shouldNotPersistWhenScopeLowerThanMinimun() { when(context.getResource()).thenReturn(File.create("org/Foo.java")); initContextWithChildren(); @@ -107,7 +107,7 @@ public class SumChildDistributionFormulaTest { } @Test - public void shouldPersistWhenScopeEqualsMinimun() throws Exception { + public void shouldPersistWhenScopeEqualsMinimun() { when(context.getResource()).thenReturn(File.create("org/Foo.java")); initContextWithChildren(); @@ -118,7 +118,7 @@ public class SumChildDistributionFormulaTest { } @Test - public void shouldPersistWhenScopeHigherThanMinimun() throws Exception { + public void shouldPersistWhenScopeHigherThanMinimun() { when(context.getResource()).thenReturn(Directory.create("org/foo")); initContextWithChildren(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java index 44660bf61c7..8cbe1f5d3b4 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java @@ -293,7 +293,7 @@ public class ComponentContainerTest { * are not defined. */ @Test - public void should_close_components_without_lifecycle() throws Exception { + public void should_close_components_without_lifecycle() { ComponentContainer container = new ComponentContainer(); CloseableComponent component = new CloseableComponent(); container.add(component); @@ -307,7 +307,7 @@ public class ComponentContainerTest { * Method close() must be executed after stop() */ @Test - public void should_close_components_with_lifecycle() throws Exception { + public void should_close_components_with_lifecycle() { ComponentContainer container = new ComponentContainer(); StartableCloseableComponent component = new StartableCloseableComponent(); container.add(component); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentKeysTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentKeysTest.java index 2a882663993..067a14f964e 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentKeysTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentKeysTest.java @@ -31,17 +31,17 @@ public class ComponentKeysTest { ComponentKeys keys = new ComponentKeys(); @Test - public void generate_key_of_class() throws Exception { + public void generate_key_of_class() { assertThat(keys.of(FakeComponent.class)).isEqualTo(FakeComponent.class); } @Test - public void generate_key_of_object() throws Exception { + public void generate_key_of_object() { assertThat(keys.of(new FakeComponent())).isEqualTo("org.sonar.api.platform.ComponentKeysTest.FakeComponent-fake"); } @Test - public void should_log_warning_if_toString_is_not_overridden() throws Exception { + public void should_log_warning_if_toString_is_not_overridden() { Logger log = mock(Logger.class); keys.of(new Object(), log); verifyZeroInteractions(log); @@ -52,7 +52,7 @@ public class ComponentKeysTest { } @Test - public void should_generate_unique_key_when_toString_is_not_overridden() throws Exception { + public void should_generate_unique_key_when_toString_is_not_overridden() { Object key = keys.of(new WrongToStringImpl()); assertThat(key).isNotEqualTo(WrongToStringImpl.KEY); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java index 85a43f7c105..252a030d93f 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java @@ -34,14 +34,14 @@ public class RuleKeyTest { } @Test - public void key_can_contain_colons() throws Exception { + public void key_can_contain_colons() { RuleKey key = RuleKey.of("squid", "Key:With:Some::Colons"); assertThat(key.repository()).isEqualTo("squid"); assertThat(key.rule()).isEqualTo("Key:With:Some::Colons"); } @Test - public void repository_must_not_be_null() throws Exception { + public void repository_must_not_be_null() { try { RuleKey.of(null, "NullDeref"); fail(); @@ -51,7 +51,7 @@ public class RuleKeyTest { } @Test - public void repository_must_not_be_empty() throws Exception { + public void repository_must_not_be_empty() { try { RuleKey.of("", "NullDeref"); fail(); @@ -61,7 +61,7 @@ public class RuleKeyTest { } @Test - public void rule_must_not_be_null() throws Exception { + public void rule_must_not_be_null() { try { RuleKey.of("squid", null); fail(); @@ -71,7 +71,7 @@ public class RuleKeyTest { } @Test - public void rule_must_not_be_empty() throws Exception { + public void rule_must_not_be_empty() { try { RuleKey.of("squid", ""); fail(); @@ -81,7 +81,7 @@ public class RuleKeyTest { } @Test - public void encode_and_decode_string() throws Exception { + public void encode_and_decode_string() { RuleKey key = RuleKey.of("squid", "NullDeref"); String serialized = key.toString(); assertThat(serialized).isEqualTo("squid:NullDeref"); @@ -92,14 +92,14 @@ public class RuleKeyTest { } @Test - public void parse_key_with_colons() throws Exception { + public void parse_key_with_colons() { RuleKey key = RuleKey.parse("squid:Key:With:Some::Colons"); assertThat(key.repository()).isEqualTo("squid"); assertThat(key.rule()).isEqualTo("Key:With:Some::Colons"); } @Test - public void not_accept_bad_format() throws Exception { + public void not_accept_bad_format() { try { RuleKey.parse("foo"); fail(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java index 806253f44cb..a66e5ce96d7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class RuleStatusTest { @Test - public void default_is_ready() throws Exception { + public void default_is_ready() { assertThat(RuleStatus.defaultStatus()).isEqualTo(RuleStatus.READY); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java index ab472eba523..cab92e394c6 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java @@ -31,7 +31,7 @@ public class SeverityTest { } @Test - public void default_is_major() throws Exception { + public void default_is_major() { assertThat(Severity.defaultSeverity()).isEqualTo(Severity.MAJOR); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java index dadf72f3486..c3bd9bca348 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristicTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DefaultDebtCharacteristicTest { @Test - public void setter_and_getter_on_characteristic() throws Exception { + public void setter_and_getter_on_characteristic() { DefaultDebtCharacteristic debtCharacteristic = new DefaultDebtCharacteristic() .setId(1) .setKey("PORTABILITY") @@ -49,7 +49,7 @@ public class DefaultDebtCharacteristicTest { } @Test - public void setter_and_getter_on_sub_characteristic() throws Exception { + public void setter_and_getter_on_sub_characteristic() { DefaultDebtCharacteristic debtCharacteristic = new DefaultDebtCharacteristic() .setId(1) .setKey("COMPILER") @@ -69,7 +69,7 @@ public class DefaultDebtCharacteristicTest { } @Test - public void to_string() throws Exception { + public void to_string() { assertThat(new DefaultDebtCharacteristic() .setId(1) .setKey("PORTABILITY") diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java index 33cd1fe777e..d7d4e0cba4c 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java @@ -111,7 +111,7 @@ public class RuleParamTypeTest { } @Test - public void support_deprecated_formats() throws Exception { + public void support_deprecated_formats() { assertThat(RuleParamType.parse("b")).isEqualTo(RuleParamType.BOOLEAN); assertThat(RuleParamType.parse("i")).isEqualTo(RuleParamType.INTEGER); assertThat(RuleParamType.parse("i{}")).isEqualTo(RuleParamType.INTEGER); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionI18nLoaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionI18nLoaderTest.java index ffe3aae54ad..58e0ac6c44c 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionI18nLoaderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionI18nLoaderTest.java @@ -32,7 +32,7 @@ public class RulesDefinitionI18nLoaderTest { RulesDefinitionI18nLoader loader = new RulesDefinitionI18nLoader(i18n); @Test - public void complete_rule_name_and_description() throws Exception { + public void complete_rule_name_and_description() { when(i18n.getName("squid", "S0001")).thenReturn("SOne"); when(i18n.getDescription("squid", "S0001")).thenReturn("S One"); @@ -50,7 +50,7 @@ public class RulesDefinitionI18nLoaderTest { } @Test - public void do_not_override_if_no_bundle() throws Exception { + public void do_not_override_if_no_bundle() { // i18n returns null values RulesDefinition.Context context = new RulesDefinition.Context(); @@ -66,7 +66,7 @@ public class RulesDefinitionI18nLoaderTest { } @Test - public void override_existing() throws Exception { + public void override_existing() { when(i18n.getName("squid", "S0001")).thenReturn("SOne"); when(i18n.getDescription("squid", "S0001")).thenReturn("S One"); @@ -83,7 +83,7 @@ public class RulesDefinitionI18nLoaderTest { } @Test - public void complete_param_description() throws Exception { + public void complete_param_description() { when(i18n.getParamDescription("squid", "S0001", "max")).thenReturn("Maximum"); RulesDefinition.Context context = new RulesDefinition.Context(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java index 2257a725c26..e3ee4f76be9 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java @@ -34,7 +34,7 @@ public class RulesDefinitionTest { RulesDefinition.Context context = new RulesDefinition.Context(); @Test - public void define_repositories() throws Exception { + public void define_repositories() { assertThat(context.repositories()).isEmpty(); context.createRepository("findbugs", "java").setName("Findbugs").done(); @@ -221,7 +221,7 @@ public class RulesDefinitionTest { } @Test - public void cant_set_blank_repository_name() throws Exception { + public void cant_set_blank_repository_name() { context.createRepository("findbugs", "java").setName(null).done(); assertThat(context.repository("findbugs").name()).isEqualTo("findbugs"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java index 5f615298372..3c372bd19fd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java @@ -45,7 +45,7 @@ public class RulesDefinitionXmlLoaderTest { } @Test - public void parse_xml() throws Exception { + public void parse_xml() { InputStream input = getClass().getResourceAsStream("/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/rules.xml"); RulesDefinition.Repository repository = load(input, Charsets.UTF_8.name()); assertThat(repository.rules()).hasSize(2); @@ -94,7 +94,7 @@ public class RulesDefinitionXmlLoaderTest { } @Test - public void fail_if_invalid_xml() throws UnsupportedEncodingException { + public void fail_if_invalid_xml() { thrown.expect(IllegalStateException.class); thrown.expectMessage("XML is not valid"); @@ -117,7 +117,7 @@ public class RulesDefinitionXmlLoaderTest { } @Test - public void support_deprecated_format() throws UnsupportedEncodingException { + public void support_deprecated_format() { // the deprecated format uses some attributes instead of nodes InputStream input = getClass().getResourceAsStream("/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/deprecated.xml"); RulesDefinition.Repository repository = load(input, Charsets.UTF_8.name()); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java index 965419a7491..e0ba0f40ef3 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java @@ -112,14 +112,14 @@ public class RequestTest { SimpleRequest request = new SimpleRequest(); @Before - public void before() throws Exception { + public void before() { WebService.Context context = new WebService.Context(); new SimpleWebService().define(context); request.setAction(context.controller("my_controller").action("my_action")); } @Test - public void has_param() throws Exception { + public void has_param() { request.setParam("a_required_string", "foo"); assertThat(request.hasParam("a_required_string")).isTrue(); @@ -127,7 +127,7 @@ public class RequestTest { } @Test - public void required_param_is_missing() throws Exception { + public void required_param_is_missing() { try { request.mandatoryParam("required_param"); fail(); @@ -137,7 +137,7 @@ public class RequestTest { } @Test - public void required_param() throws Exception { + public void required_param() { request.setParam("a_required_string", "foo"); request.setParam("a_required_number", "42"); request.setParam("a_required_boolean", "true"); @@ -151,7 +151,7 @@ public class RequestTest { } @Test - public void required_param_as_strings() throws Exception { + public void required_param_as_strings() { try { request.mandatoryParamAsStrings("a_required_string"); } catch (IllegalArgumentException e) { @@ -163,17 +163,17 @@ public class RequestTest { } @Test - public void default_value_of_optional_param() throws Exception { + public void default_value_of_optional_param() { assertThat(request.param("has_default_string")).isEqualTo("the_default_string"); } @Test - public void param_as_string() throws Exception { + public void param_as_string() { assertThat(request.setParam("a_string", "foo").param("a_string")).isEqualTo("foo"); } @Test - public void null_param() throws Exception { + public void null_param() { assertThat(request.param("a_string")).isNull(); assertThat(request.paramAsBoolean("a_boolean")).isNull(); assertThat(request.paramAsInt("a_number")).isNull(); @@ -181,19 +181,19 @@ public class RequestTest { } @Test - public void param_as_int() throws Exception { + public void param_as_int() { assertThat(request.setParam("a_number", "123").paramAsInt("a_number")).isEqualTo(123); } @Test - public void param_as_long() throws Exception { + public void param_as_long() { assertThat(request.setParam("a_number", "123").paramAsLong("a_number")).isEqualTo(123L); assertThat(request.setParam("a_number", "123").paramAsLong("a_number", 42L)).isEqualTo(123L); assertThat(request.setParam("a_number", null).paramAsLong("a_number", 42L)).isEqualTo(123L); } @Test - public void param_as_boolean() throws Exception { + public void param_as_boolean() { assertThat(request.setParam("a_boolean", "true").paramAsBoolean("a_boolean")).isTrue(); assertThat(request.setParam("a_boolean", "yes").paramAsBoolean("a_boolean")).isTrue(); assertThat(request.setParam("a_boolean", "false").paramAsBoolean("a_boolean")).isFalse(); @@ -207,23 +207,23 @@ public class RequestTest { } @Test - public void param_as_enum() throws Exception { + public void param_as_enum() { assertThat(request.setParam("a_enum", "BETA").paramAsEnum("a_enum", RuleStatus.class)).isEqualTo(RuleStatus.BETA); } @Test - public void param_as_enums() throws Exception { + public void param_as_enums() { assertThat(request.setParam("a_enum", "BETA,READY").paramAsEnums("a_enum", RuleStatus.class)).containsOnly( RuleStatus.BETA, RuleStatus.READY); } @Test - public void param_as_date() throws Exception { + public void param_as_date() { assertThat(request.setParam("a_date", "2014-05-27").paramAsDate("a_date")).isEqualTo(DateUtils.parseDate("2014-05-27")); } @Test - public void param_as_datetime() throws Exception { + public void param_as_datetime() { assertThat(request.setParam("a_datetime", "2014-05-27T15:50:45+0100").paramAsDateTime("a_datetime")).isEqualTo(DateUtils.parseDateTime("2014-05-27T15:50:45+0100")); assertThat(request.setParam("a_datetime", "2014-05-27").paramAsDateTime("a_datetime")).isEqualTo(DateUtils.parseDate("2014-05-27")); try { @@ -234,7 +234,7 @@ public class RequestTest { } @Test - public void param_as_strings() throws Exception { + public void param_as_strings() { assertThat(request.paramAsStrings("a_string")).isNull(); assertThat(request.setParam("a_string", "").paramAsStrings("a_string")).isEmpty(); assertThat(request.setParam("a_string", "bar").paramAsStrings("a_string")).containsExactly("bar"); @@ -243,12 +243,12 @@ public class RequestTest { } @Test - public void deprecated_key() throws Exception { + public void deprecated_key() { assertThat(request.setParam("deprecated_param", "bar").param("new_param")).isEqualTo("bar"); } @Test - public void fail_if_param_is_not_defined() throws Exception { + public void fail_if_param_is_not_defined() { try { request.param("unknown"); } catch (IllegalArgumentException e) { @@ -257,7 +257,7 @@ public class RequestTest { } @Test - public void verify_possible_values() throws Exception { + public void verify_possible_values() { request.setParam("has_possible_values", "foo"); assertThat(request.param("has_possible_values")).isEqualTo("foo"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java index f05e6f6d30a..9d81b9469d5 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/internal/SimpleGetRequestTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class SimpleGetRequestTest { @Test - public void method() throws Exception { + public void method() { SimpleGetRequest request = new SimpleGetRequest(); assertThat(request.method()).isEqualTo("GET"); @@ -36,7 +36,7 @@ public class SimpleGetRequestTest { } @Test - public void has_param() throws Exception { + public void has_param() { SimpleGetRequest request = new SimpleGetRequest(); assertThat(request.method()).isEqualTo("GET"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristicTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristicTest.java index 8ab6cec2010..a3bddd6d0a8 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristicTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/batch/internal/DefaultCharacteristicTest.java @@ -54,7 +54,7 @@ public class DefaultCharacteristicTest { } @Test - public void set_name_as_key() throws Exception { + public void set_name_as_key() { DefaultCharacteristic characteristic = new DefaultCharacteristic() .setId(1) .setName("Compiler related portability", true); @@ -64,7 +64,7 @@ public class DefaultCharacteristicTest { } @Test - public void add_requirement() throws Exception { + public void add_requirement() { DefaultRequirement requirement = new DefaultRequirement().setRuleKey(RuleKey.of("repo", "rule")); DefaultCharacteristic characteristic = new DefaultCharacteristic() @@ -76,7 +76,7 @@ public class DefaultCharacteristicTest { } @Test - public void add_child() throws Exception { + public void add_child() { DefaultCharacteristic root = new DefaultCharacteristic() .setId(1) .setKey("REUSABILITY"); @@ -93,7 +93,7 @@ public class DefaultCharacteristicTest { @Test - public void is_root() throws Exception { + public void is_root() { DefaultCharacteristic characteristic = new DefaultCharacteristic() .setId(1) .setKey("NETWORK_USE") diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristicTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristicTest.java index 98514fa2119..9bb3addb0ea 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristicTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristicTest.java @@ -81,7 +81,7 @@ public class DefaultCharacteristicTest { } @Test - public void is_root() throws Exception { + public void is_root() { DefaultCharacteristic characteristic = new DefaultCharacteristic() .setId(1) .setKey("NETWORK_USE") @@ -94,7 +94,7 @@ public class DefaultCharacteristicTest { } @Test - public void is_requirement() throws Exception { + public void is_requirement() { DefaultCharacteristic requirement = new DefaultCharacteristic() .setId(1) .setRuleKey(RuleKey.of("repo", "rule")) diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java index 5d9b7e6575d..fa36ab4986b 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java @@ -55,7 +55,7 @@ public class UserQueryTest { } @Test - public void should_limit_number_of_logins() throws Exception { + public void should_limit_number_of_logins() { List logins = new ArrayList(); for (int i = 0; i < 1010; i++) { logins.add(String.valueOf(i)); @@ -69,14 +69,14 @@ public class UserQueryTest { } @Test - public void searchText() throws Exception { + public void searchText() { UserQuery query = UserQuery.builder().searchText("sim").build(); assertThat(query.searchText()).isEqualTo("sim"); assertThat(query.searchTextSql).isEqualTo("%sim%"); } @Test - public void searchText_escape_special_characters_in_like() throws Exception { + public void searchText_escape_special_characters_in_like() { UserQuery query = UserQuery.builder().searchText("%sim_").build(); assertThat(query.searchText()).isEqualTo("%sim_"); assertThat(query.searchTextSql).isEqualTo("%/%sim/_%"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java index 71a39897940..ca4052f33e3 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java @@ -100,21 +100,21 @@ public class DateUtilsTest { } @Test - public void format_date_time_null_safe() throws Exception { + public void format_date_time_null_safe() { Assertions.assertThat(DateUtils.formatDateTimeNullSafe(new Date())).startsWith("20"); Assertions.assertThat(DateUtils.formatDateTimeNullSafe(new Date()).length()).isGreaterThan(20); Assertions.assertThat(DateUtils.formatDateTimeNullSafe(null)).isEmpty(); } @Test - public void long_to_date() throws Exception { + public void long_to_date() { Date date = new Date(); Assertions.assertThat(DateUtils.longToDate(date.getTime())).isEqualTo(date); Assertions.assertThat(DateUtils.longToDate(null)).isNull(); } @Test - public void date_to_long() throws Exception { + public void date_to_long() { Date date = new Date(); Assertions.assertThat(DateUtils.dateToLong(date)).isEqualTo(date.getTime()); Assertions.assertThat(DateUtils.dateToLong(null)).isEqualTo(null); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java index 99e91f84844..d8348f61fae 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java @@ -34,13 +34,13 @@ public class DurationTest { static final Long ONE_DAY_IN_MINUTES = ONE_HOUR_IN_MINUTES * HOURS_IN_DAY; @Test - public void create_from_duration_in_minutes() throws Exception { + public void create_from_duration_in_minutes() { Duration duration = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE); assertThat(duration.toMinutes()).isEqualTo(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE); } @Test - public void encode() throws Exception { + public void encode() { assertThat(Duration.create(2 * ONE_DAY_IN_MINUTES + 5 * ONE_HOUR_IN_MINUTES + 46 * ONE_MINUTE).encode(HOURS_IN_DAY)).isEqualTo("2d5h46min"); assertThat(Duration.create(ONE_DAY_IN_MINUTES).encode(HOURS_IN_DAY)).isEqualTo("1d"); assertThat(Duration.create(ONE_HOUR_IN_MINUTES).encode(HOURS_IN_DAY)).isEqualTo("1h"); @@ -49,7 +49,7 @@ public class DurationTest { } @Test - public void decode() throws Exception { + public void decode() { assertThat(Duration.decode(" 15 d 23 h 42min ", HOURS_IN_DAY)).isEqualTo(Duration.create(15 * ONE_DAY_IN_MINUTES + 23 * ONE_HOUR_IN_MINUTES + 42 * ONE_MINUTE)); assertThat(Duration.decode("15d23h42min", HOURS_IN_DAY)).isEqualTo(Duration.create(15 * ONE_DAY_IN_MINUTES + 23 * ONE_HOUR_IN_MINUTES + 42 * ONE_MINUTE)); assertThat(Duration.decode("23h", HOURS_IN_DAY)).isEqualTo(Duration.create(23 * ONE_HOUR_IN_MINUTES)); @@ -60,7 +60,7 @@ public class DurationTest { } @Test - public void fail_to_decode_if_unit_with_invalid_number() throws Exception { + public void fail_to_decode_if_unit_with_invalid_number() { try { Duration.decode("Xd", HOURS_IN_DAY); fail(); @@ -70,7 +70,7 @@ public class DurationTest { } @Test - public void fail_to_decode_if_no_valid_duration() throws Exception { + public void fail_to_decode_if_no_valid_duration() { try { Duration.decode("foo", HOURS_IN_DAY); fail(); @@ -80,7 +80,7 @@ public class DurationTest { } @Test - public void fail_to_decode_if_only_number() throws Exception { + public void fail_to_decode_if_only_number() { try { Duration.decode("15", HOURS_IN_DAY); fail(); @@ -90,7 +90,7 @@ public class DurationTest { } @Test - public void fail_to_decode_if_valid_unit_with_invalid_duration() throws Exception { + public void fail_to_decode_if_valid_unit_with_invalid_duration() { try { Duration.decode("15min foo", HOURS_IN_DAY); fail(); @@ -100,7 +100,7 @@ public class DurationTest { } @Test - public void is_greater_than() throws Exception { + public void is_greater_than() { assertThat(Duration.decode("1h", HOURS_IN_DAY).isGreaterThan(Duration.decode("1min", HOURS_IN_DAY))).isTrue(); assertThat(Duration.decode("1min", HOURS_IN_DAY).isGreaterThan(Duration.decode("1d", HOURS_IN_DAY))).isFalse(); assertThat(Duration.decode("1d", HOURS_IN_DAY).isGreaterThan(Duration.decode("1d", HOURS_IN_DAY))).isFalse(); @@ -108,17 +108,17 @@ public class DurationTest { } @Test - public void add() throws Exception { + public void add() { assertThat(Duration.decode("1h", HOURS_IN_DAY).add(Duration.decode("1min", HOURS_IN_DAY))).isEqualTo(Duration.decode("1h1min", HOURS_IN_DAY)); } @Test - public void subtract() throws Exception { + public void subtract() { assertThat(Duration.decode("1h", HOURS_IN_DAY).subtract(Duration.decode("1min", HOURS_IN_DAY))).isEqualTo(Duration.decode("59min", HOURS_IN_DAY)); } @Test - public void multiply() throws Exception { + public void multiply() { assertThat(Duration.decode("1h", HOURS_IN_DAY).multiply(2)).isEqualTo(Duration.decode("2h", HOURS_IN_DAY)); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java index b567da69803..f9931a818d2 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java @@ -54,19 +54,19 @@ public class DurationsTest { Durations durations; @Before - public void setUp() throws Exception { + public void setUp() { settings = new Settings(); settings.setProperty(CoreProperties.HOURS_IN_DAY, HOURS_IN_DAY); durations = new Durations(settings, i18n); } @Test - public void create_from_minutes() throws Exception { + public void create_from_minutes() { assertThat(durations.create(10L).toMinutes()).isEqualTo(10L); } @Test - public void decode() throws Exception { + public void decode() { // 1 working day -> 8 hours assertThat(durations.decode("1d").toMinutes()).isEqualTo(8L * ONE_HOUR); // 8 hours diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java index 78eb2ed7eaa..87ef606ba0f 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java @@ -168,7 +168,7 @@ public class KeyValueFormatTest { } @Test - public void helper_parse_methods() throws Exception { + public void helper_parse_methods() { assertThat(KeyValueFormat.parseIntDate("1=2014-01-15")).hasSize(1); assertThat(KeyValueFormat.parseIntDateTime("1=2014-01-15T15:50:45+0100")).hasSize(1); assertThat(KeyValueFormat.parseIntDouble("1=3.14")).hasSize(1); @@ -180,7 +180,7 @@ public class KeyValueFormatTest { } @Test - public void helper_format_methods() throws Exception { + public void helper_format_methods() { assertThat(KeyValueFormat.formatIntDateTime(ImmutableMap.of(1, new Date()))).startsWith("1="); assertThat(KeyValueFormat.formatIntDate(ImmutableMap.of(1, new Date()))).startsWith("1="); assertThat(KeyValueFormat.formatIntDouble(ImmutableMap.of(1, 3.14))).startsWith("1="); @@ -230,7 +230,7 @@ public class KeyValueFormatTest { } @Test - public void escape_strings() throws Exception { + public void escape_strings() { Map input = Maps.newLinkedHashMap(); input.put("foo", "a=b=c"); input.put("bar", "a;b;c"); @@ -245,7 +245,7 @@ public class KeyValueFormatTest { } @Test - public void not_instantiable() throws Exception { + public void not_instantiable() { // only static methods. Bad pattern, should be improved. TestUtils.hasOnlyPrivateConstructors(KeyValueFormat.class); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java index 562c95e3014..d47219a55db 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java @@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MessageExceptionTest { @Test - public void should_create_exception() throws Exception { + public void should_create_exception() { String message = "the message"; MessageException exception = MessageException.of(message); assertThat(exception.getMessage()).isEqualTo(message); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java index 658bdf38647..2a2619ee3e7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java @@ -54,7 +54,7 @@ public class PagingTest { } @Test - public void page_size_should_be_strictly_positive() throws Exception { + public void page_size_should_be_strictly_positive() { try { Paging.create(0, 5, 5); fail(); @@ -64,7 +64,7 @@ public class PagingTest { } @Test - public void page_index_should_be_strictly_positive() throws Exception { + public void page_index_should_be_strictly_positive() { try { Paging.create(5, 0, 5); fail(); @@ -74,7 +74,7 @@ public class PagingTest { } @Test - public void total_items_should_be_positive() throws Exception { + public void total_items_should_be_positive() { try { Paging.create(5, 5, -1); fail(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java index 64ea02cbfe5..3b76299f032 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java @@ -68,7 +68,7 @@ public class PathUtilsTest { } @Test - public void haveFunGetCoverage() throws Exception { + public void haveFunGetCoverage() { // does not fail new PathUtils(); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java index e0177fb4890..c9951833c9a 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java @@ -91,7 +91,7 @@ public class System2Test { } @Test - public void close() throws Exception { + public void close() { class MyCloseable implements Closeable { boolean isClosed = false; @Override @@ -106,7 +106,7 @@ public class System2Test { } @Test - public void close_throws_exception_on_error() throws Exception { + public void close_throws_exception_on_error() { Closeable closeable = new Closeable() { @Override public void close() throws IOException { @@ -122,7 +122,7 @@ public class System2Test { } @Test - public void getDefaultTimezone() throws Exception { + public void getDefaultTimezone() { assertThat(System2.INSTANCE.getDefaultTimeZone().getID()).isEqualTo(TimeZone.getDefault().getID()); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java index 8d5a09a44dd..4ed539385d9 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class TimeUtilsTest { @Test - public void formatDuration() throws Exception { + public void formatDuration() { assertThat(TimeUtils.formatDuration(0)).isEqualTo("0ms"); assertThat(TimeUtils.formatDuration(100)).isEqualTo("100ms"); assertThat(TimeUtils.formatDuration(1000)).isEqualTo("1s"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java index e42e8735e8f..c7f21de758f 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java @@ -52,13 +52,13 @@ public class UriReaderTest { } @Test - public void file_readString() throws Exception { + public void file_readString() { UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]); assertThat(uriReader.readString(testFile, Charsets.UTF_8)).isEqualTo("in foo"); } @Test - public void file_readBytes() throws Exception { + public void file_readBytes() { UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]); assertThat(new String(uriReader.readBytes(testFile))).isEqualTo("in foo"); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkUnitTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkUnitTest.java index b0649bf5b3f..6b9c9f632a6 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkUnitTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WorkUnitTest.java @@ -27,14 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat; public class WorkUnitTest { @Test - public void create() throws Exception { + public void create() { WorkUnit workUnit = WorkUnit.create(2.0, "mn"); assertThat(workUnit.getUnit()).isEqualTo("mn"); assertThat(workUnit.getValue()).isEqualTo(2.0); } @Test - public void create_default() throws Exception { + public void create_default() { WorkUnit workUnit = WorkUnit.create(); assertThat(workUnit.getUnit()).isEqualTo("d"); assertThat(workUnit.getValue()).isEqualTo(0.0); @@ -48,7 +48,7 @@ public class WorkUnitTest { } @Test - public void fail_with_bad_unit() throws Exception { + public void fail_with_bad_unit() { try { WorkUnit.create(2.0, "z"); } catch (Exception e) { @@ -57,7 +57,7 @@ public class WorkUnitTest { } @Test - public void fail_with_bad_value() throws Exception { + public void fail_with_bad_value() { try { WorkUnit.create(-2.0, "mn"); } catch (Exception e) { diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/UuidsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/UuidsTest.java index 321624c2246..a5b4aff24e7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/UuidsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/UuidsTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class UuidsTest { @Test - public void create_unique() throws Exception { + public void create_unique() { Set all = Sets.newHashSet(); for (int i = 0; i < 50; i++) { String uuid = Uuids.create(); @@ -41,7 +41,7 @@ public class UuidsTest { } @Test - public void constructor_is_private() throws Exception { + public void constructor_is_private() { TestUtils.hasOnlyPrivateConstructors(Uuids.class); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/WorkDurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/WorkDurationTest.java index 43d4bff5977..bb4b07e1cbd 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/WorkDurationTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/WorkDurationTest.java @@ -33,7 +33,7 @@ public class WorkDurationTest { static final Long ONE_DAY_IN_MINUTES = ONE_HOUR_IN_MINUTES * HOURS_IN_DAY; @Test - public void create_from_days_hours_minutes() throws Exception { + public void create_from_days_hours_minutes() { WorkDuration workDuration = WorkDuration.create(1, 1, 1, HOURS_IN_DAY); assertThat(workDuration.days()).isEqualTo(1); assertThat(workDuration.hours()).isEqualTo(1); @@ -43,7 +43,7 @@ public class WorkDurationTest { } @Test - public void create_from_value_and_unit() throws Exception { + public void create_from_value_and_unit() { WorkDuration result = WorkDuration.createFromValueAndUnit(1, WorkDuration.UNIT.DAYS, HOURS_IN_DAY); assertThat(result.days()).isEqualTo(1); assertThat(result.hours()).isEqualTo(0); @@ -57,7 +57,7 @@ public class WorkDurationTest { } @Test - public void create_from_minutes() throws Exception { + public void create_from_minutes() { WorkDuration workDuration = WorkDuration.createFromMinutes(ONE_MINUTE, HOURS_IN_DAY); assertThat(workDuration.days()).isEqualTo(0); assertThat(workDuration.hours()).isEqualTo(0); @@ -75,7 +75,7 @@ public class WorkDurationTest { } @Test - public void create_from_working_long() throws Exception { + public void create_from_working_long() { // 1 minute WorkDuration workDuration = WorkDuration.createFromLong(1L, HOURS_IN_DAY); assertThat(workDuration.days()).isEqualTo(0); @@ -96,14 +96,14 @@ public class WorkDurationTest { } @Test - public void convert_to_seconds() throws Exception { + public void convert_to_seconds() { assertThat(WorkDuration.createFromValueAndUnit(2, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY).toMinutes()).isEqualTo(2L * ONE_MINUTE); assertThat(WorkDuration.createFromValueAndUnit(2, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).toMinutes()).isEqualTo(2L * ONE_HOUR_IN_MINUTES); assertThat(WorkDuration.createFromValueAndUnit(2, WorkDuration.UNIT.DAYS, HOURS_IN_DAY).toMinutes()).isEqualTo(2L * ONE_DAY_IN_MINUTES); } @Test - public void convert_to_working_days() throws Exception { + public void convert_to_working_days() { assertThat(WorkDuration.createFromValueAndUnit(2, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY).toWorkingDays()).isEqualTo(2d / 60d / 8d); assertThat(WorkDuration.createFromValueAndUnit(240, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY).toWorkingDays()).isEqualTo(0.5); assertThat(WorkDuration.createFromValueAndUnit(4, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).toWorkingDays()).isEqualTo(0.5); @@ -113,7 +113,7 @@ public class WorkDurationTest { } @Test - public void convert_to_working_long() throws Exception { + public void convert_to_working_long() { assertThat(WorkDuration.createFromValueAndUnit(2, WorkDuration.UNIT.MINUTES, HOURS_IN_DAY).toLong()).isEqualTo(2l); assertThat(WorkDuration.createFromValueAndUnit(4, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).toLong()).isEqualTo(400l); assertThat(WorkDuration.createFromValueAndUnit(10, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).toLong()).isEqualTo(10200l); @@ -122,7 +122,7 @@ public class WorkDurationTest { } @Test - public void add() throws Exception { + public void add() { // 4h + 5h = 1d 1h WorkDuration result = WorkDuration.createFromValueAndUnit(4, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).add(WorkDuration.createFromValueAndUnit(5, WorkDuration.UNIT.HOURS, HOURS_IN_DAY)); assertThat(result.days()).isEqualTo(1); @@ -146,7 +146,7 @@ public class WorkDurationTest { } @Test - public void subtract() throws Exception { + public void subtract() { // 1d 1h - 5h = 4h WorkDuration result = WorkDuration.create(1, 1, 0, HOURS_IN_DAY).subtract(WorkDuration.createFromValueAndUnit(5, WorkDuration.UNIT.HOURS, HOURS_IN_DAY)); assertThat(result.days()).isEqualTo(0); @@ -169,7 +169,7 @@ public class WorkDurationTest { } @Test - public void multiply() throws Exception { + public void multiply() { // 5h * 2 = 1d 2h WorkDuration result = WorkDuration.createFromValueAndUnit(5, WorkDuration.UNIT.HOURS, HOURS_IN_DAY).multiply(2); assertThat(result.days()).isEqualTo(1); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java index 4aa1bd0bd9b..5f34386d175 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java @@ -26,7 +26,7 @@ public class BaseLoggerTest { ConsoleLogger sut = new ConsoleLogger(); @Test - public void log() throws Exception { + public void log() { sut.log(LoggerLevel.WARN, "message"); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java index 834860d7a83..4ee98c3c688 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ConsoleFormatterTest { @Test - public void format() throws Exception { + public void format() { assertThat(ConsoleFormatter.format("foo")).isEqualTo("foo"); assertThat(ConsoleFormatter.format("arg: {}", "foo")).isEqualTo("arg: foo"); assertThat(ConsoleFormatter.format("two args: {} and {}", "foo", 42)).isEqualTo("two args: foo and 42"); @@ -36,7 +36,7 @@ public class ConsoleFormatterTest { } @Test - public void only_static_methods() throws Exception { + public void only_static_methods() { assertThat(TestUtils.hasOnlyPrivateConstructors(ConsoleFormatter.class)).isTrue(); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java index 56d5f242dab..b58de37d1f2 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java @@ -37,7 +37,7 @@ public class ConsoleLoggerTest { public LogTester tester = new LogTester(); @Test - public void debug_enabled() throws Exception { + public void debug_enabled() { tester.setLevel(LoggerLevel.DEBUG); assertThat(sut.isDebugEnabled()).isTrue(); assertThat(sut.isTraceEnabled()).isFalse(); @@ -49,7 +49,7 @@ public class ConsoleLoggerTest { } @Test - public void debug_disabled() throws Exception { + public void debug_disabled() { tester.setLevel(LoggerLevel.INFO); assertThat(sut.isDebugEnabled()).isFalse(); assertThat(sut.isTraceEnabled()).isFalse(); @@ -61,7 +61,7 @@ public class ConsoleLoggerTest { } @Test - public void trace_enabled() throws Exception { + public void trace_enabled() { tester.setLevel(LoggerLevel.TRACE); assertThat(sut.isDebugEnabled()).isTrue(); assertThat(sut.isTraceEnabled()).isTrue(); @@ -73,7 +73,7 @@ public class ConsoleLoggerTest { } @Test - public void trace_disabled() throws Exception { + public void trace_disabled() { tester.setLevel(LoggerLevel.DEBUG); assertThat(sut.isTraceEnabled()).isFalse(); sut.trace("message"); @@ -84,7 +84,7 @@ public class ConsoleLoggerTest { } @Test - public void log() throws Exception { + public void log() { sut.info("message"); sut.info("message {}", "foo"); sut.info("message {} {}", "foo", "bar"); @@ -106,7 +106,7 @@ public class ConsoleLoggerTest { } @Test - public void level_change_not_implemented_yet() throws Exception { + public void level_change_not_implemented_yet() { assertThat(sut.setLevel(LoggerLevel.DEBUG)).isFalse(); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java index a77cd98a18a..197225cf515 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java @@ -28,13 +28,13 @@ public class ConsoleLoggersTest { ConsoleLoggers sut = new ConsoleLoggers(); @Test - public void newInstance() throws Exception { + public void newInstance() { Logger logger = sut.newInstance("foo"); assertThat(logger).isInstanceOf(ConsoleLogger.class); } @Test - public void level() throws Exception { + public void level() { // INFO by default assertThat(sut.getLevel()).isEqualTo(LoggerLevel.INFO); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java index 3bf72652db7..da6b46697e4 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java @@ -48,7 +48,7 @@ public class DefaultProfilerTest { } @Test - public void stop_reuses_start_message() throws Exception { + public void stop_reuses_start_message() { tester.setLevel(LoggerLevel.TRACE); // trace @@ -76,7 +76,7 @@ public class DefaultProfilerTest { } @Test - public void different_start_and_stop_messages() throws Exception { + public void different_start_and_stop_messages() { tester.setLevel(LoggerLevel.TRACE); // start TRACE and stop DEBUG @@ -104,7 +104,7 @@ public class DefaultProfilerTest { } @Test - public void log_on_at_stop() throws Exception { + public void log_on_at_stop() { tester.setLevel(LoggerLevel.TRACE); // trace @@ -129,7 +129,7 @@ public class DefaultProfilerTest { } @Test - public void add_context() throws Exception { + public void add_context() { Profiler profiler = Profiler.create(Loggers.get("DefaultProfilerTest")); profiler.addContext("a_string", "bar"); profiler.addContext("null_value", null); @@ -147,7 +147,7 @@ public class DefaultProfilerTest { } @Test - public void empty_message() throws Exception { + public void empty_message() { sut.addContext("foo", "bar"); sut.startInfo(""); assertThat(tester.logs()).containsOnly("foo=bar"); @@ -161,7 +161,7 @@ public class DefaultProfilerTest { } @Test - public void fail_if_stop_without_message() throws Exception { + public void fail_if_stop_without_message() { sut.start(); try { sut.stopInfo(); @@ -172,7 +172,7 @@ public class DefaultProfilerTest { } @Test - public void fail_if_stop_without_start() throws Exception { + public void fail_if_stop_without_start() { try { sut.stopDebug("foo"); fail(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java index d05a4395353..7de0f049668 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java @@ -27,18 +27,18 @@ import static org.assertj.core.api.Assertions.assertThat; public class LogInterceptorsTest { @Test - public void default_is_null_interceptor() throws Exception { + public void default_is_null_interceptor() { // production-ready assertThat(LogInterceptors.get()).isInstanceOf(NullInterceptor.class); } @Test(expected = IllegalArgumentException.class) - public void instance_cant_be_null() throws Exception { + public void instance_cant_be_null() { LogInterceptors.set(null); } @Test - public void private_constructor() throws Exception { + public void private_constructor() { assertThat(TestUtils.hasOnlyPrivateConstructors(LogInterceptors.class)); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java index f17cb9f799f..500b32b47d9 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java @@ -35,7 +35,7 @@ public class LogbackLoggerTest { public LogTester tester = new LogTester(); @Test - public void log() throws Exception { + public void log() { // no assertions. Simply verify that calls do not fail. sut.trace("message"); sut.trace("message {}", "foo"); @@ -65,7 +65,7 @@ public class LogbackLoggerTest { } @Test - public void change_level() throws Exception { + public void change_level() { assertThat(sut.setLevel(LoggerLevel.INFO)).isTrue(); assertThat(sut.logbackLogger().getLevel()).isEqualTo(Level.INFO); assertThat(sut.isDebugEnabled()).isFalse(); @@ -83,7 +83,7 @@ public class LogbackLoggerTest { } @Test - public void info_level_can_not_be_disabled() throws Exception { + public void info_level_can_not_be_disabled() { try { sut.setLevel(LoggerLevel.ERROR); fail(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java index b26094ce16a..0dd533207c1 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class LoggersTest { @Test - public void factory() throws Exception { + public void factory() { // logback is used by sonar-plugin-api assertThat(Loggers.getFactory()).isInstanceOf(LogbackLoggers.class); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java index f410fcd80ae..5b301769b95 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.mock; public class NullInterceptorTest { @Test - public void do_not_throws_exception() throws Exception { + public void do_not_throws_exception() { // verify that... it does nothing NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo"); NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {}", 42); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java index a094ebb368e..bc9af01a006 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java @@ -28,7 +28,7 @@ public class NullProfilerTest { NullProfiler sut = NullProfiler.NULL_INSTANCE; @Test - public void do_not_fail() throws Exception { + public void do_not_fail() { assertThat(sut.start()).isSameAs(sut); assertThat(sut.startTrace("")).isSameAs(sut); assertThat(sut.startDebug("")).isSameAs(sut); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java index 6a9e0b9c36d..6d45f7b818e 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java @@ -29,13 +29,13 @@ public class ProfilerTest { public LogTester tester = new LogTester(); @Test - public void create() throws Exception { + public void create() { Profiler profiler = Profiler.create(Loggers.get("foo")); assertThat(profiler).isInstanceOf(DefaultProfiler.class); } @Test - public void create_null_profiler_if_trace_level_is_disabled() throws Exception { + public void create_null_profiler_if_trace_level_is_disabled() { tester.setLevel(LoggerLevel.TRACE); Profiler profiler = Profiler.createIfTrace(Loggers.get("foo")); assertThat(profiler).isInstanceOf(DefaultProfiler.class); @@ -46,7 +46,7 @@ public class ProfilerTest { } @Test - public void create_null_profiler_if_debug_level_is_disabled() throws Exception { + public void create_null_profiler_if_debug_level_is_disabled() { tester.setLevel(LoggerLevel.TRACE); Profiler profiler = Profiler.createIfDebug(Loggers.get("foo")); assertThat(profiler).isInstanceOf(DefaultProfiler.class); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java index e0b945ddbe6..c4d4c6d9436 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java @@ -52,26 +52,26 @@ public class JsonWriterTest { } @Test - public void empty_object() throws Exception { + public void empty_object() { writer.beginObject().endObject().close(); expect("{}"); } @Test - public void empty_array() throws Exception { + public void empty_array() { writer.beginArray().endArray().close(); expect("[]"); } @Test - public void stop_while_streaming() throws Exception { + public void stop_while_streaming() { writer.beginObject().name("foo").value("bar"); // endObject() and close() are missing expect("{\"foo\":\"bar\""); } @Test - public void objects_and_arrays() throws Exception { + public void objects_and_arrays() { writer.beginObject().name("issues") .beginArray() .beginObject().prop("key", "ABC").endObject() @@ -82,13 +82,13 @@ public class JsonWriterTest { } @Test - public void array_values() throws Exception { + public void array_values() { writer.beginArray().values(Arrays.asList("foo", "bar", "baz")).endArray().close(); expect("[\"foo\",\"bar\",\"baz\"]"); } @Test - public void type_of_values() throws Exception { + public void type_of_values() { Date date = DateUtils.parseDateTime("2010-05-18T15:50:45+0100"); writer.beginObject() .prop("aBoolean", true) @@ -103,7 +103,7 @@ public class JsonWriterTest { } @Test - public void ignore_null_values_by_default() throws Exception { + public void ignore_null_values_by_default() { writer.beginObject() .prop("nullNumber", (Number) null) .prop("nullString", (String) null) @@ -116,7 +116,7 @@ public class JsonWriterTest { } @Test - public void serialize_null_values() throws Exception { + public void serialize_null_values() { writer.setSerializeNulls(true); writer.beginObject() .prop("nullNumber", (Number) null) @@ -130,7 +130,7 @@ public class JsonWriterTest { } @Test - public void serialize_empty_strings_by_default() throws Exception { + public void serialize_empty_strings_by_default() { writer.beginObject() .prop("emptyString", EMPTY_STRING) .name("emptyStringAsObject").valueObject(EMPTY_STRING) @@ -142,7 +142,7 @@ public class JsonWriterTest { } @Test - public void ignore_empty_strings_when_requested() throws Exception { + public void ignore_empty_strings_when_requested() { writer.setSerializeEmptys(false) .beginObject() .prop("emptyString", EMPTY_STRING) @@ -152,7 +152,7 @@ public class JsonWriterTest { } @Test - public void escape_values() throws Exception { + public void escape_values() { writer.beginObject() .prop("foo", "") .endObject().close(); @@ -160,7 +160,7 @@ public class JsonWriterTest { } @Test - public void valueObject() throws Exception { + public void valueObject() { writer.beginObject() .name("aString").valueObject("stringValue") .name("aBoolean").valueObject(true) @@ -175,14 +175,14 @@ public class JsonWriterTest { } @Test - public void valueObject_recursive() throws Exception { + public void valueObject_recursive() { Map map = ImmutableMap.of("a", ImmutableMap.of("b", "c")); writer.valueObject(map).close(); expect("{\"a\":{\"b\":\"c\"}}"); } @Test - public void valueObject_unsupported_type() throws Exception { + public void valueObject_unsupported_type() { try { writer.beginObject().valueObject(new StringWriter()).endObject().close(); fail(); @@ -192,13 +192,13 @@ public class JsonWriterTest { } @Test - public void fail_on_NaN_value() throws Exception { + public void fail_on_NaN_value() { thrown.expect(WriterException.class); writer.beginObject().prop("foo", Double.NaN).endObject().close(); } @Test - public void fail_if_not_valid() throws Exception { + public void fail_if_not_valid() { thrown.expect(WriterException.class); writer.beginObject().endArray().close(); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java index daa4bc5cccf..679eaf77423 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java @@ -51,25 +51,25 @@ public class XmlWriterTest { } @Test - public void only_root() throws Exception { + public void only_root() { writer.begin("foo").end().close(); expect(""); } @Test - public void escape_value() throws Exception { + public void escape_value() { writer.prop("foo", "1<2 & 2>=2").close(); expect("1<2 & 2>=2"); } @Test - public void only_root_with_value() throws Exception { + public void only_root_with_value() { writer.prop("foo", "bar").close(); expect("bar"); } @Test - public void ignore_null_values() throws Exception { + public void ignore_null_values() { writer.begin("root") .prop("nullNumber", (Number) null) .prop("nullString", (String) null) @@ -78,7 +78,7 @@ public class XmlWriterTest { } @Test - public void fail_on_NaN_value() throws Exception { + public void fail_on_NaN_value() { thrown.expect(WriterException.class); thrown.expectMessage("Fail to write XML. Double value is not valid: NaN"); writer.begin("root").prop("foo", Double.NaN).end().close(); diff --git a/sonar-testing-harness/src/test/java/org/sonar/test/JsonAssertTest.java b/sonar-testing-harness/src/test/java/org/sonar/test/JsonAssertTest.java index 59a05d6506f..21fbee1c439 100644 --- a/sonar-testing-harness/src/test/java/org/sonar/test/JsonAssertTest.java +++ b/sonar-testing-harness/src/test/java/org/sonar/test/JsonAssertTest.java @@ -32,7 +32,7 @@ import static org.sonar.test.JsonAssert.assertJson; public class JsonAssertTest { @Test - public void isSimilarAs_strings() throws Exception { + public void isSimilarAs_strings() { assertJson("{}").isSimilarTo("{}"); try { @@ -46,7 +46,7 @@ public class JsonAssertTest { } @Test - public void isSimilarAs_urls() throws Exception { + public void isSimilarAs_urls() { URL url1 = getClass().getResource("JsonAssertTest/sample1.json"); URL url2 = getClass().getResource("JsonAssertTest/sample2.json"); assertJson(url1).isSimilarTo(url1); @@ -60,7 +60,7 @@ public class JsonAssertTest { } @Test - public void actual_can_be_superset_of_expected() throws Exception { + public void actual_can_be_superset_of_expected() { assertJson("{\"foo\": \"bar\"}").isSimilarTo("{}"); try { assertJson("{}").isSimilarTo("{\"foo\": \"bar\"}"); @@ -76,7 +76,7 @@ public class JsonAssertTest { } @Test - public void enable_strict_order_of_arrays() throws Exception { + public void enable_strict_order_of_arrays() { try { assertJson("[1,2]").setStrictArrayOrder(true).isSimilarTo("[2, 1]"); fail(); @@ -86,7 +86,7 @@ public class JsonAssertTest { } @Test - public void enable_strict_timezone() throws Exception { + public void enable_strict_timezone() { try { assertJson("[\"2010-05-18T15:50:45+0100\"]").setStrictTimezone(true).isSimilarTo("[\"2010-05-18T16:50:45+0200\"]"); fail(); diff --git a/sonar-testing-harness/src/test/java/org/sonar/test/JsonComparisonTest.java b/sonar-testing-harness/src/test/java/org/sonar/test/JsonComparisonTest.java index 6dc57199a7c..d640a76367d 100644 --- a/sonar-testing-harness/src/test/java/org/sonar/test/JsonComparisonTest.java +++ b/sonar-testing-harness/src/test/java/org/sonar/test/JsonComparisonTest.java @@ -31,13 +31,13 @@ public class JsonComparisonTest { } @Test - public void syntax_agnostic() throws Exception { + public void syntax_agnostic() { assertThat(areSimilar("{}", " { } ")).isTrue(); assertThat(areSimilar("{\"foo\":\"bar\"}", "{\"foo\": \"bar\" \n }")).isTrue(); } @Test - public void object() throws Exception { + public void object() { assertThat(areSimilar("{}", "{}")).isTrue(); // exactly the same @@ -54,7 +54,7 @@ public class JsonComparisonTest { } @Test - public void strict_order_of_array() throws Exception { + public void strict_order_of_array() { assertThat(isSimilar_strict_array_order("[]", "[]")).isTrue(); assertThat(isSimilar_strict_array_order("[1, 2]", "[1, 2]")).isTrue(); @@ -66,7 +66,7 @@ public class JsonComparisonTest { } @Test - public void lenient_order_of_array() throws Exception { + public void lenient_order_of_array() { assertThat(areSimilar("[]", "[]")).isTrue(); assertThat(areSimilar("[1, 2]", "[1, 2]")).isTrue(); assertThat(areSimilar("[1, 2]", "[1]")).isFalse(); @@ -77,12 +77,12 @@ public class JsonComparisonTest { } @Test - public void lenient_order_of_arrays_by_default() throws Exception { + public void lenient_order_of_arrays_by_default() { assertThat(new JsonComparison().isStrictArrayOrder()).isFalse(); } @Test - public void null_value() throws Exception { + public void null_value() { assertThat(areSimilar("[null]", "[null]")).isTrue(); assertThat(areSimilar("[null]", "[]")).isFalse(); @@ -99,7 +99,7 @@ public class JsonComparisonTest { } @Test - public void maps_and_arrays() throws Exception { + public void maps_and_arrays() { assertThat(areSimilar("[]", "{}")).isFalse(); assertThat(areSimilar("{}", "[]")).isFalse(); @@ -121,7 +121,7 @@ public class JsonComparisonTest { } @Test - public void lenient_timezone() throws Exception { + public void lenient_timezone() { // lenient mode by default assertThat(new JsonComparison().isStrictTimezone()).isFalse(); @@ -136,7 +136,7 @@ public class JsonComparisonTest { } @Test - public void strict_timezone() throws Exception { + public void strict_timezone() { assertThat(new JsonComparison().setStrictTimezone(true).isStrictTimezone()).isTrue(); // same instant, same timezone @@ -151,7 +151,7 @@ public class JsonComparisonTest { } @Test - public void compare_doubles() throws Exception { + public void compare_doubles() { assertThat(areSimilar("{\"foo\": true}", "{\"foo\": false}")).isFalse(); assertThat(areSimilar("{\"foo\": true}", "{\"foo\": true}")).isTrue(); assertThat(areSimilar("{\"foo\": true}", "{\"foo\": \"true\"}")).isFalse(); @@ -159,7 +159,7 @@ public class JsonComparisonTest { } @Test - public void compare_booleans() throws Exception { + public void compare_booleans() { assertThat(areSimilar("{\"foo\": 3.14}", "{\"foo\": 3.14000000}")).isTrue(); assertThat(areSimilar("{\"foo\": 3.14}", "{\"foo\": 3.1400001}")).isTrue(); }