diff options
author | David Gageot <david@gageot.net> | 2015-05-07 19:04:22 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2015-05-07 19:12:29 +0200 |
commit | 5a587fb74fd9a8c8839b6f8582f5ff15f5183805 (patch) | |
tree | b0201ec0afc1dad985a53c06c703a429d4bf095b /sonar-plugin-api/src/test/java/org/sonar | |
parent | 18834f5bf7f0bdd34912c46a83caaaac70db1e87 (diff) | |
download | sonarqube-5a587fb74fd9a8c8839b6f8582f5ff15f5183805.tar.gz sonarqube-5a587fb74fd9a8c8839b6f8582f5ff15f5183805.zip |
Redundant throws clause in tests
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar')
65 files changed, 227 insertions, 227 deletions
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.<String>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<IssueComment> 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<Measure> 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<String> logins = new ArrayList<String>(); 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<String, String> 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<String> 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", "<hello \"world\">") .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("<foo/>"); } @Test - public void escape_value() throws Exception { + public void escape_value() { writer.prop("foo", "1<2 & 2>=2").close(); expect("<foo>1<2 & 2>=2</foo>"); } @Test - public void only_root_with_value() throws Exception { + public void only_root_with_value() { writer.prop("foo", "bar").close(); expect("<foo>bar</foo>"); } @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(); |