summaryrefslogtreecommitdiffstats
path: root/server/sonar-process
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2015-05-07 19:04:22 +0200
committerDavid Gageot <david@gageot.net>2015-05-07 19:12:29 +0200
commit5a587fb74fd9a8c8839b6f8582f5ff15f5183805 (patch)
treeb0201ec0afc1dad985a53c06c703a429d4bf095b /server/sonar-process
parent18834f5bf7f0bdd34912c46a83caaaac70db1e87 (diff)
downloadsonarqube-5a587fb74fd9a8c8839b6f8582f5ff15f5183805.tar.gz
sonarqube-5a587fb74fd9a8c8839b6f8582f5ff15f5183805.zip
Redundant throws clause in tests
Diffstat (limited to 'server/sonar-process')
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/AesCipherTest.java18
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java4
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/LifecycleTest.java4
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/LogbackHelperTest.java14
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/LoopbackAddressTest.java6
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/MinimumViableSystemTest.java6
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/NetworkUtilsTest.java6
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java4
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java8
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ProcessUtilsTest.java2
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/PropsTest.java16
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/SystemExitTest.java4
12 files changed, 46 insertions, 46 deletions
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<NetworkInterface> ifaces = Iterators.asEnumeration(Collections.<NetworkInterface>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