aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
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 /sonar-batch/src
parent18834f5bf7f0bdd34912c46a83caaaac70db1e87 (diff)
downloadsonarqube-5a587fb74fd9a8c8839b6f8582f5ff15f5183805.tar.gz
sonarqube-5a587fb74fd9a8c8839b6f8582f5ff15f5183805.zip
Redundant throws clause in tests
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java26
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java10
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java16
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java12
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java26
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java12
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java22
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java44
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java12
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java2
63 files changed, 207 insertions, 207 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
index 86a866c271e..2062e10f6b0 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
@@ -40,7 +40,7 @@ public class ProjectConfiguratorTest extends AbstractDbUnitTestCase {
System2 system2;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
system2 = mock(System2.class);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java
index 97402b8a913..e0ea0d6a440 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DatabaseCompatibilityTest.java
@@ -85,7 +85,7 @@ public class DatabaseCompatibilityTest {
}
@Test
- public void shouldFailIfNotSameServerId() throws Exception {
+ public void shouldFailIfNotSameServerId() {
when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("11111111"));
thrown.expect(MessageException.class);
@@ -97,7 +97,7 @@ public class DatabaseCompatibilityTest {
}
@Test
- public void shouldUseDefaultUserNameWhenFaillingIfNotSameServerIdAndNoUserNameFound() throws Exception {
+ public void shouldUseDefaultUserNameWhenFaillingIfNotSameServerIdAndNoUserNameFound() {
when(propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID)).thenReturn(new PropertyDto().setValue("11111111"));
settings.removeProperty(DatabaseProperties.PROP_USER);
@@ -109,7 +109,7 @@ public class DatabaseCompatibilityTest {
}
@Test
- public void shouldFailIfCantGetServerId() throws Exception {
+ public void shouldFailIfCantGetServerId() {
when(server.request("/api/server")).thenThrow(new IllegalStateException());
thrown.expect(IllegalStateException.class);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java
index f03d16bbd32..57e940ab7ae 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/DefaultPluginsRepositoryTest.java
@@ -77,7 +77,7 @@ public class DefaultPluginsRepositoryTest {
}
@Test
- public void should_fail_to_get_plugin_index() throws Exception {
+ public void should_fail_to_get_plugin_index() {
thrown.expect(IllegalStateException.class);
ServerClient server = mock(ServerClient.class);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java
index c6bc80c9862..0647b0e22ec 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java
@@ -58,7 +58,7 @@ public class ExtensionInstallerTest {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
mode = mock(DefaultAnalysisMode.class);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java
index a5040b47f35..e1e31dce2ad 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/JdbcDriverHolderTest.java
@@ -58,7 +58,7 @@ public class JdbcDriverHolderTest {
}
@Test
- public void extend_classloader_with_jdbc_driver() throws Exception {
+ public void extend_classloader_with_jdbc_driver() {
FileCache cache = mock(FileCache.class);
File fakeDriver = new File(Resources.getResource(JdbcDriverHolderTest.class, "JdbcDriverHolderTest/jdbc-driver.jar").getFile());
@@ -84,7 +84,7 @@ public class JdbcDriverHolderTest {
}
@Test
- public void do_nothing_when_jdbc_driver_file_is_empty() throws Exception {
+ public void do_nothing_when_jdbc_driver_file_is_empty() {
FileCache cache = mock(FileCache.class);
ServerClient server = mock(ServerClient.class);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java
index 1034c020957..2e13a5a9481 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ServerClientTest.java
@@ -64,7 +64,7 @@ public class ServerClientTest {
}
@Test
- public void should_remove_url_ending_slash() throws Exception {
+ public void should_remove_url_ending_slash() {
BootstrapProperties settings = mock(BootstrapProperties.class);
when(settings.property("sonar.host.url")).thenReturn("http://localhost:8080/sonar/");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java b/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java
index f712b04dbc4..be6c4ab057c 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java
@@ -151,7 +151,7 @@ public class PastSnapshotFinderTest {
}
@Test
- public void should_find_by_previous_analysis() throws ParseException {
+ public void should_find_by_previous_analysis() {
final Date date = DateUtils.parseDate("2010-05-18");
Snapshot snapshot = new Snapshot();
snapshot.setCreatedAtMs(date.getTime());
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java
index 7cb4b47c1c5..5ce426696d5 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtDecoratorTest.java
@@ -104,7 +104,7 @@ public class DebtDecoratorTest {
DebtDecorator decorator;
@Before
- public void before() throws Exception {
+ public void before() {
when(perspectives.as(Issuable.class, resource)).thenReturn(issuable);
RulesBuilder rulesBuilder = new RulesBuilder();
rulesBuilder.add(ruleKey1).setName("rule1").setDebtSubCharacteristic("MEMORY_EFFICIENCY");
@@ -124,12 +124,12 @@ public class DebtDecoratorTest {
}
@Test
- public void generates_metrics() throws Exception {
+ public void generates_metrics() {
assertThat(decorator.generatesMetrics()).hasSize(1);
}
@Test
- public void execute_on_project() throws Exception {
+ public void execute_on_project() {
assertThat(decorator.shouldExecuteOnProject(null)).isTrue();
}
@@ -143,7 +143,7 @@ public class DebtDecoratorTest {
}
@Test
- public void add_technical_debt_from_one_issue_and_no_parent() throws Exception {
+ public void add_technical_debt_from_one_issue_and_no_parent() {
Issue issue = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES));
when(issuable.issues()).thenReturn(newArrayList(issue));
@@ -154,7 +154,7 @@ public class DebtDecoratorTest {
}
@Test
- public void add_technical_debt_from_one_issue_without_debt() throws Exception {
+ public void add_technical_debt_from_one_issue_without_debt() {
Issue issue = createIssue("rule1", "repo1").setDebt(null);
when(issuable.issues()).thenReturn(newArrayList(issue));
@@ -164,7 +164,7 @@ public class DebtDecoratorTest {
}
@Test
- public void add_technical_debt_from_one_issue_and_propagate_to_parents() throws Exception {
+ public void add_technical_debt_from_one_issue_and_propagate_to_parents() {
Issue issue = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES));
when(issuable.issues()).thenReturn(newArrayList(issue));
@@ -177,7 +177,7 @@ public class DebtDecoratorTest {
}
@Test
- public void add_technical_debt_from_issues() throws Exception {
+ public void add_technical_debt_from_issues() {
Long technicalDebt1 = ONE_DAY_IN_MINUTES;
Long technicalDebt2 = 2 * ONE_DAY_IN_MINUTES;
@@ -195,7 +195,7 @@ public class DebtDecoratorTest {
}
@Test
- public void add_technical_debt_from_current_and_children_measures() throws Exception {
+ public void add_technical_debt_from_current_and_children_measures() {
Issue issue1 = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES));
Issue issue2 = createIssue("rule1", "repo1").setDebt(Duration.create(ONE_DAY_IN_MINUTES));
when(issuable.issues()).thenReturn(newArrayList(issue1, issue2));
@@ -214,7 +214,7 @@ public class DebtDecoratorTest {
}
@Test
- public void add_technical_debt_only_from_children_measures() throws Exception {
+ public void add_technical_debt_only_from_children_measures() {
when(issuable.issues()).thenReturn(Collections.<Issue>emptyList());
when(context.getChildrenMeasures(any(MeasuresFilter.class))).thenReturn(Lists.<Measure>newArrayList(
@@ -238,7 +238,7 @@ public class DebtDecoratorTest {
}
@Test
- public void always_save_technical_debt_for_positive_values() throws Exception {
+ public void always_save_technical_debt_for_positive_values() {
// for a project
DecoratorContext context = mock(DecoratorContext.class);
when(context.getResource()).thenReturn(new Project("foo"));
@@ -253,7 +253,7 @@ public class DebtDecoratorTest {
}
@Test
- public void always_save_technical_debt_for_project_if_top_characteristic() throws Exception {
+ public void always_save_technical_debt_for_project_if_top_characteristic() {
DecoratorContext context = mock(DecoratorContext.class);
when(context.getResource()).thenReturn(new Project("foo"));
@@ -268,7 +268,7 @@ public class DebtDecoratorTest {
* SQALE-147
*/
@Test
- public void never_save_technical_debt_for_project_if_not_top_characteristic() throws Exception {
+ public void never_save_technical_debt_for_project_if_not_top_characteristic() {
DecoratorContext context = mock(DecoratorContext.class);
when(context.getResource()).thenReturn(new Project("foo"));
@@ -280,7 +280,7 @@ public class DebtDecoratorTest {
}
@Test
- public void not_save_technical_debt_for_file_if_zero() throws Exception {
+ public void not_save_technical_debt_for_file_if_zero() {
DecoratorContext context = mock(DecoratorContext.class);
when(context.getResource()).thenReturn(File.create("foo"));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java
index f233dc79bef..1d434d5d2e5 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/DebtModelProviderTest.java
@@ -48,7 +48,7 @@ public class DebtModelProviderTest {
}
@Test
- public void provide_model() throws Exception {
+ public void provide_model() {
CharacteristicDto rootCharacteristicDto = new CharacteristicDto()
.setId(1)
.setKey("MEMORY_EFFICIENCY")
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java
index ab0e14b93a9..952075dec78 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/IssueChangelogDebtCalculatorTest.java
@@ -55,12 +55,12 @@ public class IssueChangelogDebtCalculatorTest {
Duration fiveDaysDebt = Duration.create(fiveDays);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
issueChangelogDebtCalculator = new IssueChangelogDebtCalculator();
}
@Test
- public void calculate_new_technical_debt_with_one_diff_in_changelog() throws Exception {
+ public void calculate_new_technical_debt_with_one_diff_in_changelog() {
Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(twoDaysDebt).setChanges(
newArrayList(
// changelog created at is null because it has just been created on the current analysis
@@ -75,7 +75,7 @@ public class IssueChangelogDebtCalculatorTest {
}
@Test
- public void calculate_new_technical_debt_with_many_diffs_in_changelog() throws Exception {
+ public void calculate_new_technical_debt_with_many_diffs_in_changelog() {
Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(fiveDaysDebt).setChanges(
newArrayList(
new FieldDiffs().setDiff("technicalDebt", twoDays, fiveDays).setCreationDate(null),
@@ -106,7 +106,7 @@ public class IssueChangelogDebtCalculatorTest {
}
@Test
- public void calculate_new_technical_debt_with_null_date() throws Exception {
+ public void calculate_new_technical_debt_with_null_date() {
Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(twoDaysDebt).setChanges(
newArrayList(
new FieldDiffs().setDiff("technicalDebt", oneDay, twoDays).setCreationDate(null)
@@ -117,7 +117,7 @@ public class IssueChangelogDebtCalculatorTest {
}
@Test
- public void calculate_new_technical_debt_when_new_debt_is_null() throws Exception {
+ public void calculate_new_technical_debt_when_new_debt_is_null() {
Issue issue = new DefaultIssue().setKey("A").setCreationDate(tenDaysAgo).setDebt(null).setChanges(
newArrayList(
new FieldDiffs().setDiff("technicalDebt", oneDay, null).setCreationDate(null),
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java
index fa7b4f9c4cb..b5851c0884f 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/NewDebtDecoratorTest.java
@@ -106,12 +106,12 @@ public class NewDebtDecoratorTest {
}
@Test
- public void generates_metrics() throws Exception {
+ public void generates_metrics() {
assertThat(decorator.generatesMetrics()).hasSize(1);
}
@Test
- public void execute_on_project() throws Exception {
+ public void execute_on_project() {
assertThat(decorator.shouldExecuteOnProject(null)).isTrue();
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java
index 79ce075a097..ab599323349 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingDecoratorTest.java
@@ -81,7 +81,7 @@ public class SqaleRatingDecoratorTest {
}
@Test
- public void generates_metrics() throws Exception {
+ public void generates_metrics() {
SqaleRatingDecorator decorator = new SqaleRatingDecorator();
assertThat(decorator.generatesMetrics()).hasSize(3);
}
@@ -93,13 +93,13 @@ public class SqaleRatingDecoratorTest {
}
@Test
- public void execute_on_project() throws Exception {
+ public void execute_on_project() {
SqaleRatingDecorator decorator = new SqaleRatingDecorator();
assertThat(decorator.shouldExecuteOnProject(null)).isTrue();
}
@Test
- public void not_execute_on_unit_test() throws Exception {
+ public void not_execute_on_unit_test() {
File resource = mock(File.class);
when(resource.getQualifier()).thenReturn(Qualifiers.UNIT_TEST_FILE);
DecoratorContext context = mock(DecoratorContext.class);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java
index 830b6319e15..15ef8398d69 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingGridTest.java
@@ -41,7 +41,7 @@ public class SqaleRatingGridTest {
}
@Test
- public void return_grade_lower_bound() throws Exception {
+ public void return_grade_lower_bound() {
assertThat(ratingGrid.getGradeLowerBound(SqaleRatingGrid.SqaleRating.A)).isEqualTo(0);
assertThat(ratingGrid.getGradeLowerBound(SqaleRatingGrid.SqaleRating.B)).isEqualTo(0.1);
assertThat(ratingGrid.getGradeLowerBound(SqaleRatingGrid.SqaleRating.C)).isEqualTo(0.2);
@@ -50,7 +50,7 @@ public class SqaleRatingGridTest {
}
@Test
- public void return_rating_matching_density() throws Exception {
+ public void return_rating_matching_density() {
assertThat(ratingGrid.getRatingForDensity(0)).isEqualTo(1);
assertThat(ratingGrid.getRatingForDensity(0.05)).isEqualTo(1);
assertThat(ratingGrid.getRatingForDensity(0.1)).isEqualTo(2);
@@ -64,7 +64,7 @@ public class SqaleRatingGridTest {
}
@Test
- public void fail_on_invalid_density() throws Exception {
+ public void fail_on_invalid_density() {
throwable.expect(RuntimeException.class);
ratingGrid.getRatingForDensity(-1);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java
index 157808bde5d..68cbfee5f51 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/debt/SqaleRatingSettingsTest.java
@@ -47,7 +47,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void load_rating_grid() throws Exception {
+ public void load_rating_grid() {
settings.setProperty(CoreProperties.RATING_GRID, "1,3.4,8,50");
SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings);
@@ -60,7 +60,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void load_work_units_for_language() throws Exception {
+ public void load_work_units_for_language() {
settings.setProperty(CoreProperties.DEVELOPMENT_COST, "50");
SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings);
@@ -68,7 +68,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void load_size_metric_for_language() throws Exception {
+ public void load_size_metric_for_language() {
settings.setProperty(CoreProperties.SIZE_METRIC, "complexity");
SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings);
@@ -76,7 +76,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void load_overridden_values_for_language() throws Exception {
+ public void load_overridden_values_for_language() {
String aLanguage = "aLanguage";
String anotherLanguage = "anotherLanguage";
@@ -98,7 +98,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void fail_on_invalid_rating_grid_configuration() throws Exception {
+ public void fail_on_invalid_rating_grid_configuration() {
throwable.expect(IllegalArgumentException.class);
settings.setProperty(CoreProperties.RATING_GRID, "a b c");
@@ -108,7 +108,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void fail_on_invalid_work_unit_value() throws Exception {
+ public void fail_on_invalid_work_unit_value() {
throwable.expect(IllegalArgumentException.class);
settings.setProperty(CoreProperties.DEVELOPMENT_COST, "a");
SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings);
@@ -117,7 +117,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void fail_on_unknown_metric_key() throws Exception {
+ public void fail_on_unknown_metric_key() {
throwable.expect(IllegalArgumentException.class);
settings.setProperty(CoreProperties.SIZE_METRIC, "unknown");
SqaleRatingSettings configurationLoader = new SqaleRatingSettings(settings);
@@ -126,7 +126,7 @@ public class SqaleRatingSettingsTest {
}
@Test
- public void use_generic_value_when_specific_setting_is_missing() throws Exception {
+ public void use_generic_value_when_specific_setting_is_missing() {
String aLanguage = "aLanguage";
settings.setProperty(CoreProperties.SIZE_METRIC, "complexity");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java
index c93334474b2..0a4ad891ce7 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java
@@ -29,7 +29,7 @@ import static org.mockito.Mockito.verify;
public class ResourceFiltersTest {
@Test
- public void warn_on_resource_filters() throws Exception {
+ public void warn_on_resource_filters() {
Logger logger = mock(Logger.class);
ResourceFilter[] filters = {mock(ResourceFilter.class)};
new ResourceFilters(logger, filters);
@@ -40,7 +40,7 @@ public class ResourceFiltersTest {
}
@Test
- public void ok_if_no_resource_filters() throws Exception {
+ public void ok_if_no_resource_filters() {
// just for verify that it does not fail. Should check that no warning is logged.
new ResourceFilters();
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java b/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java
index 83c8b98a8b9..bd71b0b4351 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersionTest.java
@@ -33,7 +33,7 @@ public class PastSnapshotFinderByPreviousVersionTest extends AbstractDbUnitTestC
private PastSnapshotFinderByPreviousVersion finder;
@Before
- public void before() throws Exception {
+ public void before() {
finder = new PastSnapshotFinderByPreviousVersion(getSession(), getMyBatis());
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java
index 514860bc011..14254a9d9f6 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/duplication/DuplicationCacheTest.java
@@ -43,7 +43,7 @@ public class DuplicationCacheTest {
Caches caches;
@Before
- public void start() throws Exception {
+ public void start() {
caches = CachesTest.createCacheOnTemp(temp);
caches.start();
}
@@ -54,7 +54,7 @@ public class DuplicationCacheTest {
}
@Test
- public void should_add_clone_groups() throws Exception {
+ public void should_add_clone_groups() {
DuplicationCache cache = new DuplicationCache(caches);
DefaultDuplication group1 = new DefaultDuplication()
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java
index 0235af3dc89..9c85d02c0fd 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/CacheTest.java
@@ -37,7 +37,7 @@ public class CacheTest {
Caches caches;
@Before
- public void start() throws Exception {
+ public void start() {
caches = CachesTest.createCacheOnTemp(temp);
caches.start();
}
@@ -48,7 +48,7 @@ public class CacheTest {
}
@Test
- public void one_part_key() throws Exception {
+ public void one_part_key() {
Cache<String> cache = caches.createCache("capitals");
assertThat(cache.get("france")).isNull();
@@ -97,7 +97,7 @@ public class CacheTest {
}
@Test
- public void two_parts_key() throws Exception {
+ public void two_parts_key() {
Cache<String> cache = caches.createCache("capitals");
assertThat(cache.get("europe", "france")).isNull();
@@ -153,7 +153,7 @@ public class CacheTest {
}
@Test
- public void three_parts_key() throws Exception {
+ public void three_parts_key() {
Cache<String> cache = caches.createCache("places");
assertThat(cache.get("europe", "france", "paris")).isNull();
@@ -229,7 +229,7 @@ public class CacheTest {
}
@Test
- public void remove_versus_clear() throws Exception {
+ public void remove_versus_clear() {
Cache<String> cache = caches.createCache("capitals");
cache.put("europe", "france", "paris");
cache.put("europe", "italy", "rome");
@@ -244,7 +244,7 @@ public class CacheTest {
}
@Test
- public void empty_cache() throws Exception {
+ public void empty_cache() {
Cache<String> cache = caches.createCache("empty");
assertThat(cache.get("foo")).isNull();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java
index 35c8ec22309..83e2a99b948 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/CachesTest.java
@@ -53,7 +53,7 @@ public class CachesTest {
Caches caches;
@Before
- public void prepare() throws Exception {
+ public void prepare() {
caches = createCacheOnTemp(temp);
}
@@ -63,7 +63,7 @@ public class CachesTest {
}
@Test
- public void should_stop_and_clean_temp_dir() throws Exception {
+ public void should_stop_and_clean_temp_dir() {
File tempDir = caches.tempDir();
assertThat(tempDir).isDirectory().exists();
assertThat(caches.persistit()).isNotNull();
@@ -77,14 +77,14 @@ public class CachesTest {
}
@Test
- public void should_create_cache() throws Exception {
+ public void should_create_cache() {
caches.start();
Cache<Element> cache = caches.createCache("foo");
assertThat(cache).isNotNull();
}
@Test
- public void should_not_create_cache_twice() throws Exception {
+ public void should_not_create_cache_twice() {
caches.start();
caches.<Element>createCache("foo");
try {
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java
index bd250b544dd..461a9a4d7f1 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/ResourceCacheTest.java
@@ -28,7 +28,7 @@ import static org.junit.Assert.fail;
public class ResourceCacheTest {
@Test
- public void should_cache_resource() throws Exception {
+ public void should_cache_resource() {
ResourceCache cache = new ResourceCache();
String componentKey = "struts:src/org/struts/Action.java";
Resource resource = File.create("org/struts/Action.java").setEffectiveKey(componentKey);
@@ -39,7 +39,7 @@ public class ResourceCacheTest {
}
@Test
- public void should_fail_if_missing_component_key() throws Exception {
+ public void should_fail_if_missing_component_key() {
ResourceCache cache = new ResourceCache();
Resource resource = File.create("org/struts/Action.java").setEffectiveKey(null);
try {
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java
index e61cb09ffec..25dc340fe30 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultIssueFilterChainTest.java
@@ -33,7 +33,7 @@ public class DefaultIssueFilterChainTest {
private final Issue issue = mock(Issue.class);
@Test
- public void should_accept_when_no_filter() throws Exception {
+ public void should_accept_when_no_filter() {
assertThat(new DefaultIssueFilterChain().accept(issue)).isTrue();
}
@@ -68,7 +68,7 @@ public class DefaultIssueFilterChainTest {
}
@Test
- public void should_accept_if_all_filters_pass() throws Exception {
+ public void should_accept_if_all_filters_pass() {
assertThat(new DefaultIssueFilterChain(
new PassingFilter(),
new PassingFilter(),
@@ -77,7 +77,7 @@ public class DefaultIssueFilterChainTest {
}
@Test
- public void should_accept_and_not_go_further_if_filter_accepts() throws Exception {
+ public void should_accept_and_not_go_further_if_filter_accepts() {
assertThat(new DefaultIssueFilterChain(
new PassingFilter(),
new AcceptingFilter(),
@@ -86,7 +86,7 @@ public class DefaultIssueFilterChainTest {
}
@Test
- public void should_refuse_and_not_go_further_if_filter_refuses() throws Exception {
+ public void should_refuse_and_not_go_further_if_filter_refuses() {
assertThat(new DefaultIssueFilterChain(
new PassingFilter(),
new RefusingFilter(),
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java
index 2cc9d8b4498..b46e3551a6d 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/DefaultProjectIssuesTest.java
@@ -41,7 +41,7 @@ public class DefaultProjectIssuesTest {
DefaultProjectIssues projectIssues = new DefaultProjectIssues(cache);
@Test
- public void should_get_all_issues() throws Exception {
+ public void should_get_all_issues() {
DefaultIssue issueOnModule = new DefaultIssue().setKey("1").setRuleKey(SQUID_RULE_KEY).setComponentKey("org.apache:struts-core");
DefaultIssue issueInModule = new DefaultIssue().setKey("2").setRuleKey(SQUID_RULE_KEY).setComponentKey("org.apache:struts-core:Action");
DefaultIssue resolvedIssueInModule = new DefaultIssue().setKey("3").setRuleKey(SQUID_RULE_KEY).setComponentKey("org.apache:struts-core:Action")
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java
index 514a6d05a1b..9cac3995a5c 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssuableFactoryTest.java
@@ -38,7 +38,7 @@ public class IssuableFactoryTest {
ProjectTree projectTree = mock(ProjectTree.class);
@Test
- public void file_should_be_issuable() throws Exception {
+ public void file_should_be_issuable() {
IssuableFactory factory = new IssuableFactory(moduleIssues, cache, projectTree);
Component component = new ResourceComponent(File.create("foo/bar.c").setEffectiveKey("foo/bar.c"));
Issuable issuable = factory.loadPerspective(Issuable.class, component);
@@ -49,7 +49,7 @@ public class IssuableFactoryTest {
}
@Test
- public void project_should_be_issuable() throws Exception {
+ public void project_should_be_issuable() {
IssuableFactory factory = new IssuableFactory(moduleIssues, cache, projectTree);
Component component = new ResourceComponent(new Project("Foo").setEffectiveKey("foo"));
Issuable issuable = factory.loadPerspective(Issuable.class, component);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java
index 2119f1c3ed9..46e297f2e4e 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueCacheTest.java
@@ -49,7 +49,7 @@ public class IssueCacheTest {
Caches caches;
@Before
- public void start() throws Exception {
+ public void start() {
caches = CachesTest.createCacheOnTemp(temp);
caches.start();
}
@@ -60,7 +60,7 @@ public class IssueCacheTest {
}
@Test
- public void should_add_new_issue() throws Exception {
+ public void should_add_new_issue() {
IssueCache cache = new IssueCache(caches);
DefaultIssue issue1 = new DefaultIssue().setKey("111").setComponentKey("org.struts.Action");
DefaultIssue issue2 = new DefaultIssue().setKey("222").setComponentKey("org.struts.Action");
@@ -73,7 +73,7 @@ public class IssueCacheTest {
}
@Test
- public void should_update_existing_issue() throws Exception {
+ public void should_update_existing_issue() {
IssueCache cache = new IssueCache(caches);
DefaultIssue issue = new DefaultIssue().setKey("111").setComponentKey("org.struts.Action").setSeverity(Severity.BLOCKER);
cache.put(issue);
@@ -89,7 +89,7 @@ public class IssueCacheTest {
}
@Test
- public void should_get_all_issues() throws Exception {
+ public void should_get_all_issues() {
IssueCache cache = new IssueCache(caches);
DefaultIssue issue1 = new DefaultIssue().setKey("111").setComponentKey("org.struts.Action").setSeverity(Severity.BLOCKER);
DefaultIssue issue2 = new DefaultIssue().setKey("222").setComponentKey("org.struts.Filter").setSeverity(Severity.INFO);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java
index 4cc35d488ce..46aea62325c 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/IssueFiltersTest.java
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.when;
public class IssueFiltersTest {
@Test
- public void accept_when_filter_chain_is_empty() throws Exception {
+ public void accept_when_filter_chain_is_empty() {
org.sonar.api.issue.IssueFilter ok = mock(org.sonar.api.issue.IssueFilter.class);
when(ok.accept(any(Issue.class))).thenReturn(true);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java
index 7ffa9905721..2577ba98a41 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java
@@ -78,7 +78,7 @@ public class ModuleIssuesTest {
}
@Test
- public void fail_on_unknown_rule() throws Exception {
+ public void fail_on_unknown_rule() {
initModuleIssues();
DefaultIssue issue = new DefaultIssue().setRuleKey(SQUID_RULE_KEY);
@@ -93,7 +93,7 @@ public class ModuleIssuesTest {
}
@Test
- public void fail_if_rule_has_no_name_and_issue_has_no_message() throws Exception {
+ public void fail_if_rule_has_no_name_and_issue_has_no_message() {
ruleBuilder.add(RuleKey.of("squid", "AvoidCycle"));
initModuleIssues();
DefaultIssue issue = new DefaultIssue().setRuleKey(SQUID_RULE_KEY).setMessage("");
@@ -109,7 +109,7 @@ public class ModuleIssuesTest {
}
@Test
- public void ignore_null_active_rule() throws Exception {
+ public void ignore_null_active_rule() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
initModuleIssues();
@@ -121,7 +121,7 @@ public class ModuleIssuesTest {
}
@Test
- public void ignore_null_rule_of_active_rule() throws Exception {
+ public void ignore_null_rule_of_active_rule() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
activeRulesBuilder.create(SQUID_RULE_KEY).activate();
initModuleIssues();
@@ -134,7 +134,7 @@ public class ModuleIssuesTest {
}
@Test
- public void add_issue_to_cache() throws Exception {
+ public void add_issue_to_cache() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate();
initModuleIssues();
@@ -158,7 +158,7 @@ public class ModuleIssuesTest {
}
@Test
- public void use_severity_from_active_rule_if_no_severity_on_issue() throws Exception {
+ public void use_severity_from_active_rule_if_no_severity_on_issue() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate();
initModuleIssues();
@@ -177,7 +177,7 @@ public class ModuleIssuesTest {
}
@Test
- public void use_rule_name_if_no_message() throws Exception {
+ public void use_rule_name_if_no_message() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).setName(SQUID_RULE_NAME).activate();
initModuleIssues();
@@ -201,7 +201,7 @@ public class ModuleIssuesTest {
}
@Test
- public void add_deprecated_violation() throws Exception {
+ public void add_deprecated_violation() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate();
initModuleIssues();
@@ -231,7 +231,7 @@ public class ModuleIssuesTest {
}
@Test
- public void filter_issue() throws Exception {
+ public void filter_issue() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
activeRulesBuilder.create(SQUID_RULE_KEY).setSeverity(Severity.INFO).activate();
initModuleIssues();
@@ -250,7 +250,7 @@ public class ModuleIssuesTest {
}
@Test
- public void set_debt_with_linear_function() throws Exception {
+ public void set_debt_with_linear_function() {
ruleBuilder.add(SQUID_RULE_KEY)
.setName(SQUID_RULE_NAME)
.setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY")
@@ -276,7 +276,7 @@ public class ModuleIssuesTest {
}
@Test
- public void set_debt_with_linear_with_offset_function() throws Exception {
+ public void set_debt_with_linear_with_offset_function() {
ruleBuilder.add(SQUID_RULE_KEY)
.setName(SQUID_RULE_NAME)
.setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY")
@@ -302,7 +302,7 @@ public class ModuleIssuesTest {
}
@Test
- public void set_debt_with_constant_issue_function() throws Exception {
+ public void set_debt_with_constant_issue_function() {
ruleBuilder.add(SQUID_RULE_KEY)
.setName(SQUID_RULE_NAME)
.setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY")
@@ -328,7 +328,7 @@ public class ModuleIssuesTest {
}
@Test
- public void fail_to_set_debt_with_constant_issue_function_when_effort_to_fix_is_set() throws Exception {
+ public void fail_to_set_debt_with_constant_issue_function_when_effort_to_fix_is_set() {
ruleBuilder.add(SQUID_RULE_KEY)
.setName(SQUID_RULE_NAME)
.setDebtSubCharacteristic("COMPILER_RELATED_PORTABILITY")
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java
index 57cd8cfd17e..47a2e4e1907 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/pattern/PatternMatcherTest.java
@@ -78,28 +78,28 @@ public class PatternMatcherTest {
}
@Test
- public void shouldMatchWithStandardPatterns() throws IOException {
+ public void shouldMatchWithStandardPatterns() {
patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;checkstyle:MagicNumber;[15-200]"));
assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 150))).isNotNull();
}
@Test
- public void shouldNotMatchWithStandardPatterns() throws IOException {
+ public void shouldNotMatchWithStandardPatterns() {
patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;checkstyle:MagicNumber;[15-200]"));
assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 5))).isNull();
}
@Test
- public void shouldMatchWithExtraPattern() throws IOException {
+ public void shouldMatchWithExtraPattern() {
patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;*;[15-200]"));
assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 150))).isNotNull();
}
@Test
- public void shouldNotMatchWithExtraPattern() throws IOException {
+ public void shouldNotMatchWithExtraPattern() {
patternMatcher.addPatternForComponent(JAVA_FILE, createPattern("org.foo.Hello;*;[15-200]"));
assertThat(patternMatcher.getMatchingPattern(create(CHECKSTYLE_RULE, JAVA_FILE, 5))).isNull();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java
index 3cca58ac2b2..5bd352f2e62 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsLoaderTest.java
@@ -83,7 +83,7 @@ public class IssueExclusionsLoaderTest {
}
@Test
- public void shouldExecute() throws IOException {
+ public void shouldExecute() {
when(exclusionPatternInitializer.hasConfiguredPatterns()).thenReturn(true);
when(inclusionPatternInitializer.hasConfiguredPatterns()).thenReturn(true);
assertThat(scanner.shouldExecuteOnProject(null)).isTrue();
@@ -124,7 +124,7 @@ public class IssueExclusionsLoaderTest {
}
@Test
- public void shouldAnalyseFilesOnlyWhenRegexConfigured() throws IOException {
+ public void shouldAnalyseFilesOnlyWhenRegexConfigured() {
File javaFile1 = new File(baseDir, "src/main/java/Foo.java");
fs.add(new DeprecatedDefaultInputFile("polop", "src/main/java/Foo.java")
.setType(InputFile.Type.MAIN));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java
index a98952d5ec9..046f37840f9 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStackTest.java
@@ -57,7 +57,7 @@ public class InitialOpenIssuesStackTest {
Caches caches;
@Before
- public void before() throws Exception {
+ public void before() {
caches = createCacheOnTemp(temp);
caches.start();
stack = new InitialOpenIssuesStack(caches);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java
index 8b210bd731d..c3d84f77c98 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueHandlersTest.java
@@ -35,7 +35,7 @@ import static org.mockito.Mockito.*;
public class IssueHandlersTest {
@Test
- public void should_execute_handlers() throws Exception {
+ public void should_execute_handlers() {
IssueHandler h1 = mock(IssueHandler.class);
IssueHandler h2 = mock(IssueHandler.class);
IssueUpdater updater = mock(IssueUpdater.class);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java
index a0021e72025..dde4856d71c 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingDecoratorTest.java
@@ -104,14 +104,14 @@ public class IssueTrackingDecoratorTest {
}
@Test
- public void should_not_be_executed_on_classes_not_methods() throws Exception {
+ public void should_not_be_executed_on_classes_not_methods() {
DecoratorContext context = mock(DecoratorContext.class);
decorator.decorate(JavaClass.create("org.foo.Bar"), context);
verifyZeroInteractions(context, issueCache, tracking, handlers, workflow);
}
@Test
- public void should_process_open_issues() throws Exception {
+ public void should_process_open_issues() {
Resource file = File.create("Action.java").setEffectiveKey("struts:Action.java").setId(123);
final DefaultIssue issue = new DefaultIssue();
@@ -136,7 +136,7 @@ public class IssueTrackingDecoratorTest {
}
@Test
- public void should_register_unmatched_issues_as_end_of_life() throws Exception {
+ public void should_register_unmatched_issues_as_end_of_life() {
// "Unmatched" issues existed in previous scan but not in current one -> they have to be closed
Resource file = File.create("Action.java").setEffectiveKey("struts:Action.java").setId(123);
@@ -487,7 +487,7 @@ public class IssueTrackingDecoratorTest {
}
@Test
- public void should_register_issues_on_deleted_components() throws Exception {
+ public void should_register_issues_on_deleted_components() {
Project project = new Project("struts");
DefaultIssue openIssue = new DefaultIssue();
when(issueCache.byComponent("struts")).thenReturn(Arrays.asList(openIssue));
@@ -511,7 +511,7 @@ public class IssueTrackingDecoratorTest {
}
@Test
- public void merge_matched_issue() throws Exception {
+ public void merge_matched_issue() {
ServerIssue previousIssue = new ServerIssueFromDb(new IssueDto().setKee("ABCDE").setResolution(null).setStatus("OPEN").setRuleKey("squid", "AvoidCycle")
.setLine(10).setSeverity("MAJOR").setMessage("Message").setEffortToFix(1.5).setDebt(1L).setProjectKey("sample"));
DefaultIssue issue = new DefaultIssue();
@@ -530,7 +530,7 @@ public class IssueTrackingDecoratorTest {
}
@Test
- public void merge_matched_issue_on_manual_severity() throws Exception {
+ public void merge_matched_issue_on_manual_severity() {
ServerIssue previousIssue = new ServerIssueFromDb(new IssueDto().setKee("ABCDE").setResolution(null).setStatus("OPEN").setRuleKey("squid", "AvoidCycle")
.setLine(10).setManualSeverity(true).setSeverity("MAJOR").setMessage("Message").setEffortToFix(1.5).setDebt(1L));
DefaultIssue issue = new DefaultIssue();
@@ -546,7 +546,7 @@ public class IssueTrackingDecoratorTest {
}
@Test
- public void merge_issue_changelog_with_previous_changelog() throws Exception {
+ public void merge_issue_changelog_with_previous_changelog() {
when(initialOpenIssues.selectChangelog("ABCDE")).thenReturn(newArrayList(new IssueChangeDto().setIssueKey("ABCD").setCreatedAt(System2.INSTANCE.now())));
ServerIssue previousIssue = new ServerIssueFromDb(new IssueDto().setKee("ABCDE").setResolution(null).setStatus("OPEN").setRuleKey("squid", "AvoidCycle")
diff --git a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java
index d07d08a978c..b716ce907d5 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/issue/tracking/IssueTrackingTest.java
@@ -334,7 +334,7 @@ public class IssueTrackingTest {
}
@Test
- public void dont_load_checksum_if_no_new_issue() throws Exception {
+ public void dont_load_checksum_if_no_new_issue() {
sourceHashHolder = mock(SourceHashHolder.class);
ServerIssue referenceIssue = newReferenceIssue("2 branches need to be covered", null, "squid", "AvoidCycle", null);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java
index 155b9cd4910..aa351984b5a 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/language/LanguageDistributionDecoratorTest.java
@@ -60,7 +60,7 @@ public class LanguageDistributionDecoratorTest {
LanguageDistributionDecorator decorator;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
decorator = new LanguageDistributionDecorator();
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java b/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java
index 43635198209..a4d344bdece 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/maven/MavenProjectBootstrapperTest.java
@@ -41,7 +41,7 @@ public class MavenProjectBootstrapperTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void bootstrap() throws Exception {
+ public void bootstrap() {
ProjectDefinition def = mock(ProjectDefinition.class);
MavenSession session = mock(MavenSession.class);
MavenProject rootProject = new MavenProject();
@@ -60,7 +60,7 @@ public class MavenProjectBootstrapperTest {
}
@Test
- public void should_fail_if_no_top_level_project() throws Exception {
+ public void should_fail_if_no_top_level_project() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Maven session does not declare a top level project");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
index 72023e2e180..f20786a4679 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
@@ -226,7 +226,7 @@ public class FileSystemMediumTest {
// SONAR-5330
@Test
- public void scanProjectWithSourceSymlink() throws Exception {
+ public void scanProjectWithSourceSymlink() {
if (!System2.INSTANCE.isOsWindows()) {
File projectDir = new File("src/test/resources/mediumtest/xoo/sample-with-symlink");
TaskResult result = tester
diff --git a/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java b/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java
index acd9ea1fdb7..1a16a8868b9 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/postjob/PostJobOptimizerTest.java
@@ -45,21 +45,21 @@ public class PostJobOptimizerTest {
private AnalysisMode analysisMode;
@Before
- public void prepare() throws Exception {
+ public void prepare() {
settings = new Settings();
analysisMode = mock(AnalysisMode.class);
optimizer = new PostJobOptimizer(settings, analysisMode);
}
@Test
- public void should_run_analyzer_with_no_metadata() throws Exception {
+ public void should_run_analyzer_with_no_metadata() {
DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor();
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
@Test
- public void should_optimize_on_settings() throws Exception {
+ public void should_optimize_on_settings() {
DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor()
.requireProperty("sonar.foo.reportPath");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
@@ -69,7 +69,7 @@ public class PostJobOptimizerTest {
}
@Test
- public void should_disabled_in_preview() throws Exception {
+ public void should_disabled_in_preview() {
DefaultPostJobDescriptor descriptor = new DefaultPostJobDescriptor()
.disabledInPreview();
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java b/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java
index 704a27b04c1..0974ac53e11 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/profiling/PhasesSumUpTimeProfilerTest.java
@@ -145,7 +145,7 @@ public class PhasesSumUpTimeProfilerTest {
return project;
}
- private void fakeAnalysis(PhasesSumUpTimeProfiler profiler, final Project module) throws InterruptedException {
+ private void fakeAnalysis(PhasesSumUpTimeProfiler profiler, final Project module) {
// Start of moduleA
profiler.onProjectAnalysis(projectEvent(module, true));
initializerPhase(profiler);
@@ -158,7 +158,7 @@ public class PhasesSumUpTimeProfilerTest {
profiler.onProjectAnalysis(projectEvent(module, false));
}
- private void decoratorPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
+ private void decoratorPhase(PhasesSumUpTimeProfiler profiler) {
Decorator decorator1 = new FakeDecorator1();
Decorator decorator2 = new FakeDecorator2();
// Start of decorator phase
@@ -187,7 +187,7 @@ public class PhasesSumUpTimeProfilerTest {
profiler.onDecoratorsPhase(decoratorsEvent(false));
}
- private void batchStep(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
+ private void batchStep(PhasesSumUpTimeProfiler profiler) {
// Start of batch step
profiler.onBatchStep(new BatchStepEvent("Free memory", true));
clock.sleep(9);
@@ -195,7 +195,7 @@ public class PhasesSumUpTimeProfilerTest {
profiler.onBatchStep(new BatchStepEvent("Free memory", false));
}
- private void initializerPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
+ private void initializerPhase(PhasesSumUpTimeProfiler profiler) {
Initializer initializer = new FakeInitializer();
// Start of initializer phase
profiler.onInitializersPhase(initializersEvent(true));
@@ -208,7 +208,7 @@ public class PhasesSumUpTimeProfilerTest {
profiler.onInitializersPhase(initializersEvent(false));
}
- private void sensorPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
+ private void sensorPhase(PhasesSumUpTimeProfiler profiler) {
Sensor sensor = new FakeSensor();
// Start of sensor phase
profiler.onSensorsPhase(sensorsEvent(true));
@@ -221,7 +221,7 @@ public class PhasesSumUpTimeProfilerTest {
profiler.onSensorsPhase(sensorsEvent(false));
}
- private void persistersPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
+ private void persistersPhase(PhasesSumUpTimeProfiler profiler) {
ScanPersister persister = new FakeScanPersister();
// Start of persister phase
profiler.onPersistersPhase(persistersEvent(true));
@@ -234,7 +234,7 @@ public class PhasesSumUpTimeProfilerTest {
profiler.onPersistersPhase(persistersEvent(false));
}
- private void postJobPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
+ private void postJobPhase(PhasesSumUpTimeProfiler profiler) {
PostJob postJob = new FakePostJob();
// Start of sensor phase
profiler.onPostJobsPhase(postJobsEvent(true));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java
index ca89fe8ccae..759471b4677 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateVerifierTest.java
@@ -101,7 +101,7 @@ public class QualityGateVerifierTest {
}
@Test
- public void should_be_executed_if_quality_gate_is_enabled() throws Exception {
+ public void should_be_executed_if_quality_gate_is_enabled() {
assertThat(verifier.shouldExecuteOnProject((Project) project)).isTrue();
when(qualityGate.isEnabled()).thenReturn(false);
assertThat(verifier.shouldExecuteOnProject((Project) project)).isFalse();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
index 5b9221dc92c..4a6e27960d2 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/report/ReportPublisherTest.java
@@ -53,7 +53,7 @@ public class ReportPublisherTest extends AbstractDbUnitTestCase {
}
@Test
- public void should_log_successful_analysis() throws Exception {
+ public void should_log_successful_analysis() {
Settings settings = new Settings();
settings.setProperty(CoreProperties.SERVER_BASE_URL, "http://myserver/");
ReportPublisher job = new ReportPublisher(settings, mock(ServerClient.class), mock(Server.class), reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
@@ -66,7 +66,7 @@ public class ReportPublisherTest extends AbstractDbUnitTestCase {
}
@Test
- public void should_log_successful_preview_analysis() throws Exception {
+ public void should_log_successful_preview_analysis() {
Settings settings = new Settings();
when(mode.isPreview()).thenReturn(true);
ReportPublisher job = new ReportPublisher(settings, mock(ServerClient.class), mock(Server.class), reactor, mode, mock(TempFolder.class), new ReportPublisherStep[0]);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java
index c76eacef5be..c5f977c3e9c 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileDecoratorTest.java
@@ -47,7 +47,7 @@ public class QProfileDecoratorTest {
DecoratorContext decoratorContext = mock(DecoratorContext.class);
@Test
- public void don_t_run_on_leaf() throws Exception {
+ public void don_t_run_on_leaf() {
QProfileDecorator decorator = new QProfileDecorator();
when(project.getModules()).thenReturn(Collections.<Project>emptyList());
assertThat(decorator.shouldExecuteOnProject(project)).isFalse();
@@ -57,7 +57,7 @@ public class QProfileDecoratorTest {
}
@Test
- public void aggregate() throws Exception {
+ public void aggregate() {
Measure measureModuleA = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA_JSON + "]");
Measure measureModuleB = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA_JSON + "]");
Measure measureModuleC = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + PHP_JSON + "]");
@@ -73,7 +73,7 @@ public class QProfileDecoratorTest {
}
@Test
- public void aggregate_different_profiles_with_same_language() throws Exception {
+ public void aggregate_different_profiles_with_same_language() {
Measure measureModuleA = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA_JSON + "]");
Measure measureModuleB = new Measure(CoreMetrics.QUALITY_PROFILES, "[" + JAVA2_JSON + "]");
when(decoratorContext.getChildrenMeasures(CoreMetrics.QUALITY_PROFILES)).thenReturn(Arrays.asList(measureModuleA, measureModuleB));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java
index 7c83baad914..f362690979a 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/QProfileSensorTest.java
@@ -62,13 +62,13 @@ public class QProfileSensorTest {
}
@Test
- public void to_string() throws Exception {
+ public void to_string() {
QProfileSensor sensor = new QProfileSensor(moduleQProfiles, fs, mock(AnalysisMode.class));
assertThat(sensor.toString()).isEqualTo("QProfileSensor");
}
@Test
- public void no_execution_in_preview() throws Exception {
+ public void no_execution_in_preview() {
AnalysisMode analysisMode = mock(AnalysisMode.class);
when(analysisMode.isPreview()).thenReturn(true);
QProfileSensor sensor = new QProfileSensor(moduleQProfiles, fs, analysisMode);
@@ -77,7 +77,7 @@ public class QProfileSensorTest {
}
@Test
- public void no_qprofiles() throws Exception {
+ public void no_qprofiles() {
when(moduleQProfiles.findAll()).thenReturn(Collections.<QProfile>emptyList());
QProfileSensor sensor = new QProfileSensor(moduleQProfiles, fs, mock(AnalysisMode.class));
@@ -89,7 +89,7 @@ public class QProfileSensorTest {
}
@Test
- public void mark_profiles_as_used() throws Exception {
+ public void mark_profiles_as_used() {
when(moduleQProfiles.findByLanguage("java")).thenReturn(JAVA_PROFILE);
when(moduleQProfiles.findByLanguage("php")).thenReturn(PHP_PROFILE);
when(moduleQProfiles.findByLanguage("abap")).thenReturn(null);
@@ -101,7 +101,7 @@ public class QProfileSensorTest {
}
@Test
- public void store_measures_on_single_lang_module() throws Exception {
+ public void store_measures_on_single_lang_module() {
when(moduleQProfiles.findByLanguage("java")).thenReturn(JAVA_PROFILE);
when(moduleQProfiles.findByLanguage("php")).thenReturn(PHP_PROFILE);
when(moduleQProfiles.findByLanguage("abap")).thenReturn(null);
@@ -117,7 +117,7 @@ public class QProfileSensorTest {
}
@Test
- public void store_measures_on_multi_lang_module() throws Exception {
+ public void store_measures_on_multi_lang_module() {
when(moduleQProfiles.findByLanguage("java")).thenReturn(JAVA_PROFILE);
when(moduleQProfiles.findByLanguage("php")).thenReturn(PHP_PROFILE);
when(moduleQProfiles.findByLanguage("abap")).thenReturn(null);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java
index e1a52981d12..bfa14cf91bc 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProfileProviderTest.java
@@ -40,7 +40,7 @@ public class RulesProfileProviderTest {
RulesProfileProvider provider = new RulesProfileProvider();
@Test
- public void merge_profiles() throws Exception {
+ public void merge_profiles() {
QProfile qProfile = new QProfile().setKey("java-sw").setName("Sonar way").setLanguage("java");
when(qProfiles.findAll()).thenReturn(Arrays.asList(qProfile));
@@ -60,7 +60,7 @@ public class RulesProfileProviderTest {
}
@Test
- public void keep_compatibility_with_single_language_projects() throws Exception {
+ public void keep_compatibility_with_single_language_projects() {
settings.setProperty("sonar.language", "java");
QProfile qProfile = new QProfile().setKey("java-sw").setName("Sonar way").setLanguage("java");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
index e14e9fb7fda..79ba7df94bc 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
@@ -55,7 +55,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
RulesProvider provider;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
debtModel = new DefaultDebtModel()
.addCharacteristic(new DefaultDebtCharacteristic()
.setId(100)
@@ -86,7 +86,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules() throws Exception {
+ public void build_rules() {
setupData("shared");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -110,7 +110,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_default_debt_definitions() throws Exception {
+ public void build_rules_with_default_debt_definitions() {
setupData("build_rules_with_default_debt_definitions");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -121,7 +121,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_overridden_debt_definitions() throws Exception {
+ public void build_rules_with_overridden_debt_definitions() {
setupData("build_rules_with_overridden_debt_definitions");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -132,7 +132,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_default_and_overridden_debt_definitions() throws Exception {
+ public void build_rules_with_default_and_overridden_debt_definitions() {
setupData("build_rules_with_default_and_overridden_debt_definitions");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -144,7 +144,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_default_characteristic_and_overridden_function() throws Exception {
+ public void build_rules_with_default_characteristic_and_overridden_function() {
setupData("build_rules_with_default_characteristic_and_overridden_function");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -156,7 +156,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_overridden_characteristic_and_default_function() throws Exception {
+ public void build_rules_with_overridden_characteristic_and_default_function() {
setupData("build_rules_with_overridden_characteristic_and_default_function");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -168,7 +168,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_disable_characteristic() throws Exception {
+ public void build_rules_with_disable_characteristic() {
setupData("build_rules_with_disable_characteristic");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -179,7 +179,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void build_rules_with_default_characteristic_and_disable_characteristic() throws Exception {
+ public void build_rules_with_default_characteristic_and_disable_characteristic() {
setupData("build_rules_with_default_characteristic_and_disable_characteristic");
Rules rules = provider.provide(ruleDao, debtModel, durations);
@@ -190,7 +190,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void fail_if_characteristic_not_found() throws Exception {
+ public void fail_if_characteristic_not_found() {
setupData("fail_if_characteristic_not_found");
try {
@@ -202,7 +202,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
}
@Test
- public void fail_if_no_function() throws Exception {
+ public void fail_if_no_function() {
setupData("fail_if_no_function");
try {
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java
index 131f3a0b6e4..1a26aeba91d 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/UsedQProfilesTest.java
@@ -33,7 +33,7 @@ public class UsedQProfilesTest {
static final String PHP_JSON = "{\"key\":\"p2\",\"language\":\"php\",\"name\":\"Sonar Way\",\"rulesUpdatedAt\":\"2014-02-20T00:00:00+0000\"}";
@Test
- public void from_and_to_json() throws Exception {
+ public void from_and_to_json() {
QProfile java = new QProfile().setKey("p1").setName("Sonar Way").setLanguage("java")
.setRulesUpdatedAt(UtcDateUtils.parseDateTime("2014-01-15T00:00:00+0000"));
QProfile php = new QProfile().setKey("p2").setName("Sonar Way").setLanguage("php")
@@ -50,7 +50,7 @@ public class UsedQProfilesTest {
}
@Test
- public void do_not_duplicate_profiles() throws Exception {
+ public void do_not_duplicate_profiles() {
QProfile java = new QProfile().setKey("p1").setName("Sonar Way").setLanguage("java");
QProfile php = new QProfile().setKey("p2").setName("Sonar Way").setLanguage("php");
@@ -59,7 +59,7 @@ public class UsedQProfilesTest {
}
@Test
- public void group_profiles_by_key() throws Exception {
+ public void group_profiles_by_key() {
QProfile java = new QProfile().setKey("p1").setName("Sonar Way").setLanguage("java");
QProfile php = new QProfile().setKey("p2").setName("Sonar Way").setLanguage("php");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java
index 8aa7f9a1485..bda4e1613bc 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/DeprecatedProjectReactorBuilderTest.java
@@ -166,7 +166,7 @@ public class DeprecatedProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfUnexistingModuleFile() throws IOException {
+ public void shouldFailIfUnexistingModuleFile() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The properties file of the module 'module1' does not exist: "
+ TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-file").getAbsolutePath() + File.separator + "any-folder"
@@ -175,7 +175,7 @@ public class DeprecatedProjectReactorBuilderTest {
loadProjectDefinition("multi-module-with-unexisting-file");
}
- private ProjectDefinition loadProjectDefinition(String projectFolder) throws IOException {
+ private ProjectDefinition loadProjectDefinition(String projectFolder) {
Map<String, String> props = Maps.<String, String>newHashMap();
Properties runnerProps = ProjectReactorBuilder.toProperties(TestUtils.getResource(this.getClass(), projectFolder + "/sonar-project.properties"));
for (final String name : runnerProps.stringPropertyNames()) {
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java
index 420d0641c36..dc6e6f3afb6 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java
@@ -52,7 +52,7 @@ public class LanguageVerifierTest {
}
@Test
- public void language_is_not_set() throws Exception {
+ public void language_is_not_set() {
LanguageVerifier verifier = new LanguageVerifier(settings, languages, fs);
verifier.start();
@@ -63,7 +63,7 @@ public class LanguageVerifierTest {
}
@Test
- public void language_is_valid() throws Exception {
+ public void language_is_valid() {
settings.setProperty("sonar.language", "java");
LanguageVerifier verifier = new LanguageVerifier(settings, languages, fs);
@@ -76,7 +76,7 @@ public class LanguageVerifierTest {
}
@Test
- public void language_is_not_valid() throws Exception {
+ public void language_is_not_valid() {
thrown.expect(MessageException.class);
thrown.expectMessage("You must install a plugin that supports the language 'php'");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java
index efc81035a6d..617149c60ec 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java
@@ -44,7 +44,7 @@ public class ProjectReactorBuilderTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void shouldDefineSimpleProject() throws IOException {
+ public void shouldDefineSimpleProject() {
ProjectDefinition projectDefinition = loadProjectDefinition("simple-project");
assertThat(projectDefinition.getKey()).isEqualTo("com.foo.project");
@@ -57,7 +57,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfUnexistingSourceDirectory() throws IOException {
+ public void shouldFailIfUnexistingSourceDirectory() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The folder 'unexisting-source-dir' does not exist for 'com.foo.project' (base directory = "
+ TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-source-dir") + ")");
@@ -66,14 +66,14 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void fail_if_sources_not_set() throws IOException {
+ public void fail_if_sources_not_set() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("You must define the following mandatory properties for 'com.foo.project': sonar.sources");
loadProjectDefinition("simple-project-with-missing-source-dir");
}
@Test
- public void shouldNotFailIfBlankSourceDirectory() throws IOException {
+ public void shouldNotFailIfBlankSourceDirectory() {
loadProjectDefinition("simple-project-with-blank-source-dir");
}
@@ -145,7 +145,7 @@ public class ProjectReactorBuilderTest {
// SONAR-4876
@Test
- public void shouldDefineMultiModuleProjectWithModuleKey() throws IOException {
+ public void shouldDefineMultiModuleProjectWithModuleKey() {
ProjectDefinition rootProject = loadProjectDefinition("multi-module-definitions-moduleKey");
// CHECK ROOT
@@ -194,7 +194,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldDefineMultiModuleProjectWithBaseDir() throws IOException {
+ public void shouldDefineMultiModuleProjectWithBaseDir() {
ProjectDefinition rootProject = loadProjectDefinition("multi-module-with-basedir");
List<ProjectDefinition> modules = rootProject.getSubProjects();
assertThat(modules.size()).isEqualTo(1);
@@ -202,7 +202,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfUnexistingModuleBaseDir() throws IOException {
+ public void shouldFailIfUnexistingModuleBaseDir() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The base directory of the module 'module1' does not exist: "
+ TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-basedir").getAbsolutePath() + File.separator + "module1");
@@ -211,7 +211,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfUnexistingSourceFolderInheritedInMultimodule() throws IOException {
+ public void shouldFailIfUnexistingSourceFolderInheritedInMultimodule() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The folder 'unexisting-source-dir' does not exist for 'com.foo.project:module1' (base directory = "
+ TestUtils.getResource(this.getClass(), "multi-module-with-unexisting-source-dir").getAbsolutePath() + File.separator + "module1)");
@@ -220,12 +220,12 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldNotFailIfUnexistingTestBinLibFolderInheritedInMultimodule() throws IOException {
+ public void shouldNotFailIfUnexistingTestBinLibFolderInheritedInMultimodule() {
loadProjectDefinition("multi-module-with-unexisting-test-bin-lib-dir");
}
@Test
- public void shouldFailIfExplicitUnexistingTestFolder() throws IOException {
+ public void shouldFailIfExplicitUnexistingTestFolder() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The folder 'tests' does not exist for 'com.foo.project' (base directory = "
+ TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-test-dir").getAbsolutePath());
@@ -234,7 +234,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfExplicitUnexistingBinaryFolder() throws IOException {
+ public void shouldFailIfExplicitUnexistingBinaryFolder() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The folder 'bin' does not exist for 'com.foo.project' (base directory = "
+ TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-binary").getAbsolutePath());
@@ -243,7 +243,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfExplicitUnmatchingLibFolder() throws IOException {
+ public void shouldFailIfExplicitUnmatchingLibFolder() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("No files nor directories matching 'libs/*.txt' in directory "
+ TestUtils.getResource(this.getClass(), "simple-project-with-unexisting-lib").getAbsolutePath());
@@ -252,7 +252,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldGetLibDirectory() throws IOException {
+ public void shouldGetLibDirectory() {
ProjectDefinition def = loadProjectDefinition("simple-project-with-lib-dir");
assertThat(def.getLibraries()).hasSize(1);
File libDir = new File(def.getLibraries().get(0));
@@ -261,7 +261,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfExplicitUnexistingTestFolderOnModule() throws IOException {
+ public void shouldFailIfExplicitUnexistingTestFolderOnModule() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The folder 'tests' does not exist for 'module1' (base directory = "
+ TestUtils.getResource(this.getClass(), "multi-module-with-explicit-unexisting-test-dir").getAbsolutePath() + File.separator + "module1)");
@@ -270,7 +270,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfExplicitUnexistingBinaryFolderOnModule() throws IOException {
+ public void shouldFailIfExplicitUnexistingBinaryFolderOnModule() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The folder 'bin' does not exist for 'module1' (base directory = "
+ TestUtils.getResource(this.getClass(), "multi-module-with-explicit-unexisting-binary-dir").getAbsolutePath() + File.separator + "module1)");
@@ -279,7 +279,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailIfExplicitUnmatchingLibFolderOnModule() throws IOException {
+ public void shouldFailIfExplicitUnmatchingLibFolderOnModule() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("No files nor directories matching 'lib/*.jar' in directory "
+ TestUtils.getResource(this.getClass(), "multi-module-with-explicit-unexisting-lib").getAbsolutePath() + File.separator + "module1");
@@ -288,7 +288,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void multiModuleProperties() throws IOException {
+ public void multiModuleProperties() {
ProjectDefinition projectDefinition = loadProjectDefinition("big-multi-module-definitions-all-in-root");
assertThat(projectDefinition.getProperties().getProperty("module11.property")).isNull();
@@ -375,7 +375,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFilterFiles() throws Exception {
+ public void shouldFilterFiles() {
File baseDir = TestUtils.getResource(this.getClass(), "shouldFilterFiles");
assertThat(ProjectReactorBuilder.getLibraries(baseDir, "in*.txt")).hasSize(1);
assertThat(ProjectReactorBuilder.getLibraries(baseDir, "*.txt")).hasSize(2);
@@ -384,7 +384,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldWorkWithAbsolutePath() throws Exception {
+ public void shouldWorkWithAbsolutePath() {
File baseDir = new File("not-exists");
String absolutePattern = TestUtils.getResource(this.getClass(), "shouldFilterFiles").getAbsolutePath() + "/in*.txt";
assertThat(ProjectReactorBuilder.getLibraries(baseDir.getParentFile(), absolutePattern)).hasSize(1);
@@ -507,14 +507,14 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldFailToLoadPropertiesFile() throws Exception {
+ public void shouldFailToLoadPropertiesFile() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Impossible to read the property file");
ProjectReactorBuilder.toProperties(new File("foo.properties"));
}
- private ProjectDefinition loadProjectDefinition(String projectFolder) throws IOException {
+ private ProjectDefinition loadProjectDefinition(String projectFolder) {
Map<String, String> props = loadProps(projectFolder);
TaskProperties bootstrapProps = new TaskProperties(props, null);
ProjectReactor projectReactor = new ProjectReactorBuilder(bootstrapProps).execute();
@@ -556,7 +556,7 @@ public class ProjectReactorBuilderTest {
}
@Test
- public void shouldDefineProjectWithBuildDir() throws IOException {
+ public void shouldDefineProjectWithBuildDir() {
ProjectDefinition rootProject = loadProjectDefinition("simple-project-with-build-dir");
File buildDir = rootProject.getBuildDir();
assertThat(buildDir).isDirectory().exists();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java
index c32b7b5cf0c..504a734ff7f 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorValidatorTest.java
@@ -52,7 +52,7 @@ public class ProjectReactorValidatorTest {
}
@Test
- public void not_fail_if_provisioning_enforced_and_project_exists() throws Exception {
+ public void not_fail_if_provisioning_enforced_and_project_exists() {
String key = "project-key";
settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true);
when(resourceDao.findByKey(key)).thenReturn(mock(Component.class));
@@ -61,7 +61,7 @@ public class ProjectReactorValidatorTest {
}
@Test
- public void not_fail_if_provisioning_enforced_and_project_with_branch_exists() throws Exception {
+ public void not_fail_if_provisioning_enforced_and_project_with_branch_exists() {
String key = "project-key";
settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true);
when(resourceDao.findByKey(key + ":branch")).thenReturn(mock(Component.class));
@@ -70,7 +70,7 @@ public class ProjectReactorValidatorTest {
}
@Test(expected = SonarException.class)
- public void fail_if_provisioning_enforced_and_project_not_provisioned() throws Exception {
+ public void fail_if_provisioning_enforced_and_project_not_provisioned() {
String key = "project-key";
settings.setProperty(CoreProperties.CORE_PREVENT_AUTOMATIC_PROJECT_CREATION, true);
when(resourceDao.findByKey(key)).thenReturn(null);
@@ -80,7 +80,7 @@ public class ProjectReactorValidatorTest {
// SONAR-4692
@Test(expected = SonarException.class)
- public void fail_if_module_part_of_another_project() throws Exception {
+ public void fail_if_module_part_of_another_project() {
String rootProjectKey = "project-key";
String moduleKey = "module-key";
ResourceDto rootResource = mock(ResourceDto.class);
@@ -95,7 +95,7 @@ public class ProjectReactorValidatorTest {
// SONAR-4692
@Test
- public void not_fail_if_module_part_of_same_project() throws Exception {
+ public void not_fail_if_module_part_of_same_project() {
String rootProjectKey = "project-key";
String moduleKey = "module-key";
ResourceDto rootResource = mock(ResourceDto.class);
@@ -110,7 +110,7 @@ public class ProjectReactorValidatorTest {
// SONAR-4692
@Test
- public void not_fail_if_new_module() throws Exception {
+ public void not_fail_if_new_module() {
String rootProjectKey = "project-key";
String moduleKey = "module-key";
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java
index ad3dfffc491..a2ce7e460b3 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/AdditionalFilePredicatesTest.java
@@ -34,7 +34,7 @@ public class AdditionalFilePredicatesTest {
public TemporaryFolder temp = new TemporaryFolder();
@Test
- public void key() throws Exception {
+ public void key() {
FilePredicate predicate = new AdditionalFilePredicates.KeyPredicate("struts:Action.java");
DefaultInputFile inputFile = new DeprecatedDefaultInputFile("struts", "Action.java");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java
index 7f954c405a2..c33afe1f59f 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystemTest.java
@@ -149,7 +149,7 @@ public class DefaultModuleFileSystemTest {
}
@Test
- public void should_index() throws Exception {
+ public void should_index() {
DefaultModuleFileSystem fs = new DefaultModuleFileSystem(moduleInputFileCache,
new Project("foo"), settings, fileIndexer, initializer, componentIndexer);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java
index 3235301f031..2797d65ea20 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/DeprecatedFileFiltersTest.java
@@ -46,7 +46,7 @@ public class DeprecatedFileFiltersTest {
FileSystemFilter filter = mock(FileSystemFilter.class);
@Test
- public void no_filters() throws Exception {
+ public void no_filters() {
DeprecatedFileFilters filters = new DeprecatedFileFilters();
InputFile inputFile = new DeprecatedDefaultInputFile("foo", "src/main/java/Foo.java");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java
index c5bd36cddf5..e638bd42efb 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ExclusionFiltersTest.java
@@ -123,7 +123,7 @@ public class ExclusionFiltersTest {
}
@Test
- public void trim_pattern() throws IOException {
+ public void trim_pattern() {
Settings settings = new Settings();
settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, " **/*Dao.java ");
ExclusionFilters filter = new ExclusionFilters(new FileExclusions(settings));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java
index 0c83abfa01e..60f85a52e17 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock;
public class InputFileBuilderFactoryTest {
@Test
- public void create_builder() throws Exception {
+ public void create_builder() {
PathResolver pathResolver = new PathResolver();
LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS);
StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java
index f14e2a9b957..84b24fa9355 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputPathCacheTest.java
@@ -39,7 +39,7 @@ public class InputPathCacheTest {
public TemporaryFolder temp = new TemporaryFolder();
@Before
- public void start() throws Exception {
+ public void start() {
}
@After
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java
index 95d3631eaa5..65ae7125c60 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionTest.java
@@ -122,7 +122,7 @@ public class LanguageDetectionTest {
}
@Test
- public void fail_if_invalid_language() throws Exception {
+ public void fail_if_invalid_language() {
thrown.expect(MessageException.class);
thrown.expectMessage("No language is installed with key 'unknown'. Please update property 'sonar.language'");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java
index cc5feed7883..c8db34b4542 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/StatusDetectionTest.java
@@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class StatusDetectionTest {
@Test
- public void detect_status() throws Exception {
+ public void detect_status() {
ProjectRepositories ref = new ProjectRepositories();
ref.addFileData("foo", "src/Foo.java", new FileData("ABCDE", true));
ref.addFileData("foo", "src/Bar.java", new FileData("FGHIJ", true));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java
index fce979b23c4..598f2a5ce2e 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/measure/MeasureCacheTest.java
@@ -69,7 +69,7 @@ public class MeasureCacheTest {
private MeasureCache cache;
@Before
- public void start() throws Exception {
+ public void start() {
caches = CachesTest.createCacheOnTemp(temp);
caches.start();
metricFinder = mock(MetricFinder.class);
@@ -84,7 +84,7 @@ public class MeasureCacheTest {
}
@Test
- public void should_add_measure() throws Exception {
+ public void should_add_measure() {
Project p = new Project("struts");
assertThat(cache.entries()).hasSize(0);
@@ -114,7 +114,7 @@ public class MeasureCacheTest {
}
@Test
- public void should_add_measure_with_big_data() throws Exception {
+ public void should_add_measure_with_big_data() {
Project p = new Project("struts");
assertThat(cache.entries()).hasSize(0);
@@ -153,7 +153,7 @@ public class MeasureCacheTest {
* This test fails with stock PersisitIt.
*/
@Test
- public void should_add_measure_with_too_big_data_for_persistit_pre_patch() throws Exception {
+ public void should_add_measure_with_too_big_data_for_persistit_pre_patch() {
Project p = new Project("struts");
assertThat(cache.entries()).hasSize(0);
@@ -188,7 +188,7 @@ public class MeasureCacheTest {
}
@Test
- public void should_add_measure_with_too_big_data_for_persistit() throws Exception {
+ public void should_add_measure_with_too_big_data_for_persistit() {
Project p = new Project("struts");
assertThat(cache.entries()).hasSize(0);
@@ -210,7 +210,7 @@ public class MeasureCacheTest {
}
@Test
- public void should_add_measure_with_same_metric() throws Exception {
+ public void should_add_measure_with_same_metric() {
Project p = new Project("struts");
assertThat(cache.entries()).hasSize(0);
@@ -231,7 +231,7 @@ public class MeasureCacheTest {
}
@Test
- public void should_get_measures() throws Exception {
+ public void should_get_measures() {
Project p = new Project("struts");
Resource dir = Directory.create("foo/bar").setEffectiveKey("struts:foo/bar");
Resource file1 = Directory.create("foo/bar/File1.txt").setEffectiveKey("struts:foo/bar/File1.txt");
diff --git a/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java b/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java
index 12d5e00dc0c..968544e84fa 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/sensor/SensorOptimizerTest.java
@@ -60,14 +60,14 @@ public class SensorOptimizerTest {
}
@Test
- public void should_run_analyzer_with_no_metadata() throws Exception {
+ public void should_run_analyzer_with_no_metadata() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
@Test
- public void should_optimize_on_language() throws Exception {
+ public void should_optimize_on_language() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
.onlyOnLanguages("java", "php");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
@@ -77,7 +77,7 @@ public class SensorOptimizerTest {
}
@Test
- public void should_optimize_on_type() throws Exception {
+ public void should_optimize_on_type() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
.onlyOnFileType(InputFile.Type.MAIN);
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
@@ -90,7 +90,7 @@ public class SensorOptimizerTest {
}
@Test
- public void should_optimize_on_both_type_and_language() throws Exception {
+ public void should_optimize_on_both_type_and_language() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
.onlyOnLanguages("java", "php")
.onlyOnFileType(InputFile.Type.MAIN);
@@ -105,7 +105,7 @@ public class SensorOptimizerTest {
}
@Test
- public void should_optimize_on_repository() throws Exception {
+ public void should_optimize_on_repository() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
.createIssuesForRuleRepositories("squid");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
@@ -129,7 +129,7 @@ public class SensorOptimizerTest {
}
@Test
- public void should_optimize_on_settings() throws Exception {
+ public void should_optimize_on_settings() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
.requireProperty("sonar.foo.reportPath");
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
@@ -139,7 +139,7 @@ public class SensorOptimizerTest {
}
@Test
- public void should_disabled_in_preview() throws Exception {
+ public void should_disabled_in_preview() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor()
.disabledInPreview();
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java
index 7b3d3987bf3..4ef06e4a0e5 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java
@@ -40,7 +40,7 @@ public class DefaultHighlightableTest {
public ExpectedException throwable = ExpectedException.none();
@Test
- public void should_store_highlighting_rules() throws Exception {
+ public void should_store_highlighting_rules() {
SensorStorage sensorStorage = mock(SensorStorage.class);
DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php")
.initMetadata(new FileMetadata().readMetadata(new StringReader("azerty\nbla bla")));
diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java
index a0489a7c209..385ce1bbd6a 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java
@@ -47,7 +47,7 @@ public class DefaultSymbolTableTest {
}
@Test
- public void should_order_symbol_and_references() throws Exception {
+ public void should_order_symbol_and_references() {
Symbolizable.SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTable.Builder(inputFile);
Symbol firstSymbol = symbolTableBuilder.newSymbol(10, 20);
@@ -62,7 +62,7 @@ public class DefaultSymbolTableTest {
}
@Test
- public void should_reject_reference_conflicting_with_declaration() throws Exception {
+ public void should_reject_reference_conflicting_with_declaration() {
throwable.expect(UnsupportedOperationException.class);
Symbolizable.SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTable.Builder(inputFile);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java
index d3b1018ace5..21803da6c85 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.verify;
public class DefaultSymbolizableTest {
@Test
- public void should_update_cache_when_done() throws Exception {
+ public void should_update_cache_when_done() {
DefaultSensorStorage sensorStorage = mock(DefaultSensorStorage.class);
DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php")
diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java
index 893957a80a5..e98f3bad906 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.when;
public class HighlightableBuilderTest {
@Test
- public void should_load_default_perspective() throws Exception {
+ public void should_load_default_perspective() {
Resource file = File.create("foo.c").setEffectiveKey("myproject:path/to/foo.c");
Component component = new ResourceComponent(file);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java
index 16c4fe669a7..8a1d3cbe580 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.when;
public class SymbolizableBuilderTest {
@Test
- public void should_load_perspective() throws Exception {
+ public void should_load_perspective() {
Resource file = File.create("foo.c").setEffectiveKey("myproject:path/to/foo.c");
Component component = new ResourceComponent(file);