diff options
Diffstat (limited to 'sonar-core')
84 files changed, 323 insertions, 323 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java index 40c9df1e3f9..ce1dc931ff6 100644 --- a/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/UtcDateUtilsTest.java @@ -29,13 +29,13 @@ import static org.junit.Assert.fail; public class UtcDateUtilsTest { @Test - public void parse_then_format() throws Exception { + public void parse_then_format() { Date date = UtcDateUtils.parseDateTime("2014-01-14T14:00:00+0200"); assertThat(UtcDateUtils.formatDateTime(date)).isEqualTo("2014-01-14T12:00:00+0000"); } @Test - public void fail_if_bad_format() throws Exception { + public void fail_if_bad_format() { try { UtcDateUtils.parseDateTime("2014-01-14"); fail(); diff --git a/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java b/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java index ddc26aaa064..5383b6472d1 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/ComponentDtoTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ComponentDtoTest { @Test - public void setters_and_getters() throws Exception { + public void setters_and_getters() { ComponentDto componentDto = new ComponentDto() .setId(1L) .setKey("org.struts:struts-core:src/org/struts/RequestContext.java") @@ -59,7 +59,7 @@ public class ComponentDtoTest { } @Test - public void equals_and_hashcode() throws Exception { + public void equals_and_hashcode() { ComponentDto dto = new ComponentDto().setId(1L); ComponentDto dtoWithSameId = new ComponentDto().setId(1L); ComponentDto dtoWithDifferentId = new ComponentDto().setId(2L); @@ -74,13 +74,13 @@ public class ComponentDtoTest { } @Test - public void toString_does_not_fail_if_empty() throws Exception { + public void toString_does_not_fail_if_empty() { ComponentDto dto = new ComponentDto(); assertThat(dto.toString()).isNotEmpty(); } @Test - public void is_root_project() throws Exception { + public void is_root_project() { assertThat(new ComponentDto().setModuleUuid("ABCD").isRootProject()).isFalse(); assertThat(new ComponentDto().setModuleUuid("ABCD").setScope(Scopes.DIRECTORY).isRootProject()).isFalse(); assertThat(new ComponentDto().setModuleUuid(null).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT).isRootProject()).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java b/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java index 2de2110104f..d699dc6a30e 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/GraphPerspectiveBuilderTest.java @@ -34,7 +34,7 @@ import static org.mockito.Mockito.when; public class GraphPerspectiveBuilderTest { @Test - public void should_return_null_on_null_component() throws Exception { + public void should_return_null_on_null_component() { String componentKey = "org.foo.Bar"; @@ -55,7 +55,7 @@ public class GraphPerspectiveBuilderTest { } @Test - public void should_load_perspective() throws Exception { + public void should_load_perspective() { ScanGraph graph = ScanGraph.create(); MutablePerspective expectedPerspective = mock(MutablePerspective.class); @@ -73,7 +73,7 @@ public class GraphPerspectiveBuilderTest { } @Test - public void should_create_perspective_when_loaded_one_is_null() throws Exception { + public void should_create_perspective_when_loaded_one_is_null() { String perspectiveKey = "perspectiveKey"; diff --git a/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java b/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java index 35d53aba1bf..bdd39ad8b61 100644 --- a/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java +++ b/sonar-core/src/test/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTaskTest.java @@ -54,7 +54,7 @@ public class DefaultPurgeTaskTest { private PurgeProfiler profiler; @Before - public void before() throws Exception { + public void before() { this.purgeDao = mock(PurgeDao.class); this.resourceDao = mock(ResourceDao.class); when(resourceDao.getResource(anyLong())).thenReturn(new ResourceDto().setQualifier(Qualifiers.PROJECT).setUuid("1").setId(1L)); @@ -140,7 +140,7 @@ public class DefaultPurgeTaskTest { } @Test - public void call_dao_delete_when_deleting() throws Exception { + public void call_dao_delete_when_deleting() { when(resourceDao.getResource(123L)).thenReturn(new ResourceDto().setId(123L).setUuid("A")); sut.delete(123L); diff --git a/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java b/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java index 4f3ec24bae7..1d03f781ffb 100644 --- a/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/dashboard/ActiveDashboardDaoTest.java @@ -37,13 +37,13 @@ public class ActiveDashboardDaoTest { private ActiveDashboardDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dbTester.truncateTables(); dao = new ActiveDashboardDao(dbTester.myBatis()); } @Test - public void shouldInsert() throws Exception { + public void shouldInsert() { dbTester.prepareDbUnit(getClass(), "shouldInsert.xml"); ActiveDashboardDto dashboard = new ActiveDashboardDto(); @@ -56,7 +56,7 @@ public class ActiveDashboardDaoTest { } @Test - public void shouldInsertWithNoUser() throws Exception { + public void shouldInsertWithNoUser() { dbTester.prepareDbUnit(getClass(), "shouldInsert.xml"); ActiveDashboardDto dashboard = new ActiveDashboardDto(); @@ -68,7 +68,7 @@ public class ActiveDashboardDaoTest { } @Test - public void shouldGetMaxOrderIndexForNullUser() throws Exception { + public void shouldGetMaxOrderIndexForNullUser() { dbTester.prepareDbUnit(getClass(), "shouldGetMaxOrderIndexForNullUser.xml"); int index = dao.selectMaxOrderIndexForNullUser(); @@ -77,7 +77,7 @@ public class ActiveDashboardDaoTest { } @Test - public void shouldGetZeroMaxOrderIndex() throws Exception { + public void shouldGetZeroMaxOrderIndex() { dbTester.prepareDbUnit(getClass(), "empty.xml"); int index = dao.selectMaxOrderIndexForNullUser(); @@ -86,28 +86,28 @@ public class ActiveDashboardDaoTest { } @Test - public void should_get_dashboards_for_anonymous() throws Exception { + public void should_get_dashboards_for_anonymous() { dbTester.prepareDbUnit(getClass(), "shouldSelectDashboardsForAnonymous.xml"); assertThat(dao.selectGlobalDashboardsForUserLogin(null)).hasSize(2).extracting("id").containsExactly(2L, 1L); } @Test - public void should_get_dashboards_for_user() throws Exception { + public void should_get_dashboards_for_user() { dbTester.prepareDbUnit(getClass(), "shouldSelectDashboardsForUser.xml"); assertThat(dao.selectGlobalDashboardsForUserLogin("obiwan")).hasSize(2).extracting("id").containsExactly(2L, 1L); } @Test - public void should_get_project_dashboards_for_anonymous() throws Exception { + public void should_get_project_dashboards_for_anonymous() { dbTester.prepareDbUnit(getClass(), "shouldSelectProjectDashboardsForAnonymous.xml"); assertThat(dao.selectProjectDashboardsForUserLogin(null)).hasSize(2).extracting("id").containsExactly(2L, 1L); } @Test - public void should_get_project_dashboards_for_user() throws Exception { + public void should_get_project_dashboards_for_user() { dbTester.prepareDbUnit(getClass(), "shouldSelectProjectDashboardsForUser.xml"); assertThat(dao.selectProjectDashboardsForUserLogin("obiwan")).hasSize(2).extracting("id").containsExactly(2L, 1L); diff --git a/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java b/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java index f4a76577d5d..f7ddd44cbf2 100644 --- a/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/dashboard/DashboardDaoTest.java @@ -94,7 +94,7 @@ public class DashboardDaoTest { } @Test - public void shouldInsertWithNullableColumns() throws Exception { + public void shouldInsertWithNullableColumns() { dbTester.prepareDbUnit(getClass(), "shouldInsert.xml"); DashboardDto dashboardDto = new DashboardDto(); diff --git a/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java b/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java index 90bb71c54dd..ba7a89ce431 100644 --- a/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/duplication/DuplicationDaoTest.java @@ -34,12 +34,12 @@ public class DuplicationDaoTest extends AbstractDaoTestCase { private DuplicationDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new DuplicationDao(getMyBatis()); } @Test - public void shouldGetByHash() throws Exception { + public void shouldGetByHash() { setupData("shouldGetByHash"); List<DuplicationUnitDto> blocks = dao.selectCandidates(10, 7, "java"); @@ -58,7 +58,7 @@ public class DuplicationDaoTest extends AbstractDaoTestCase { } @Test - public void shouldInsert() throws Exception { + public void shouldInsert() { setupData("shouldInsert"); dao.insert(Arrays.asList(new DuplicationUnitDto(1, 2, "bb", 0, 1, 2))); diff --git a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java index 233f086e976..c877a1493bc 100644 --- a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonReaderTest.java @@ -39,7 +39,7 @@ import java.util.Set; public class GraphsonReaderTest { @Test - public void inputGraphModeExtended() throws Exception { + public void inputGraphModeExtended() { TinkerGraph graph = new TinkerGraph(); String json = "{ \"mode\":\"EXTENDED\", \"vertices\": [ {\"_id\":1, \"_type\":\"vertex\", \"test\": { \"type\":\"string\", \"value\":\"please work\"}, \"testlist\":{\"type\":\"list\", \"value\":[{\"type\":\"int\", \"value\":1}, {\"type\":\"int\",\"value\":2}, {\"type\":\"int\",\"value\":3}, {\"type\":\"unknown\",\"value\":null}]}, \"testmap\":{\"type\":\"map\", \"value\":{\"big\":{\"type\":\"long\", \"value\":10000000000}, \"small\":{\"type\":\"double\", \"value\":0.4954959595959}, \"nullKey\":{\"type\":\"unknown\", \"value\":null}}}}, {\"_id\":2, \"_type\":\"vertex\", \"testagain\":{\"type\":\"string\", \"value\":\"please work again\"}}], \"edges\":[{\"_id\":100, \"_type\":\"edge\", \"_outV\":1, \"_inV\":2, \"_label\":\"works\", \"teste\": {\"type\":\"string\", \"value\":\"please worke\"}, \"keyNull\":{\"type\":\"unknown\", \"value\":null}}]}"; @@ -88,7 +88,7 @@ public class GraphsonReaderTest { } @Test - public void inputGraphModeNormal() throws Exception { + public void inputGraphModeNormal() { TinkerGraph graph = new TinkerGraph(); String json = "{ \"mode\":\"NORMAL\",\"vertices\": [ {\"_id\":1, \"_type\":\"vertex\", \"test\": \"please work\", \"testlist\":[1, 2, 3, null], \"testmap\":{\"big\":10000000000, \"small\":0.4954959595959, \"nullKey\":null}}, {\"_id\":2, \"_type\":\"vertex\", \"testagain\":\"please work again\"}], \"edges\":[{\"_id\":100, \"_type\":\"edge\", \"_outV\":1, \"_inV\":2, \"_label\":\"works\", \"teste\": \"please worke\", \"keyNull\":null}]}"; @@ -137,7 +137,7 @@ public class GraphsonReaderTest { } @Test - public void inputGraphModeCompact() throws Exception { + public void inputGraphModeCompact() { TinkerGraph graph = new TinkerGraph(); String json = "{ \"mode\":\"COMPACT\",\"vertices\": [ {\"_id\":1, \"test\": \"please work\", \"testlist\":[1, 2, 3, null], \"testmap\":{\"big\":10000000000, \"small\":0.4954959595959, \"nullKey\":null}}, {\"_id\":2, \"testagain\":\"please work again\"}], \"edges\":[{\"_id\":100, \"_outV\":1, \"_inV\":2, \"_label\":\"works\", \"teste\": \"please worke\", \"keyNull\":null}]}"; diff --git a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java index 607ffc3d0a0..6fb3611a9ef 100644 --- a/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java +++ b/sonar-core/src/test/java/org/sonar/core/graph/graphson/GraphsonUtilTest.java @@ -994,7 +994,7 @@ public class GraphsonUtilTest { } @Test - public void vertexFromJsonIgnoreKeyValid() throws Exception { + public void vertexFromJsonIgnoreKeyValid() { Graph g = new TinkerGraph(); ElementFactory factory = new ElementFactory(g); diff --git a/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java b/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java index 57db8e33aef..971a7573965 100644 --- a/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/i18n/I18nClassloaderTest.java @@ -69,7 +69,7 @@ public class I18nClassloaderTest { } @Test - public void override_toString() throws ClassNotFoundException { + public void override_toString() { assertThat(i18nClassloader.toString()).isEqualTo("i18n-classloader"); } diff --git a/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java b/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java index 2132f0b32fe..9950e249cb6 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/ActionPlanDeadlineComparatorTest.java @@ -36,7 +36,7 @@ public class ActionPlanDeadlineComparatorTest { ActionPlan noDeadline = new DefaultActionPlan().setDeadLine(null); @Test - public void compare_plans_with_deadlines() throws Exception { + public void compare_plans_with_deadlines() { List<ActionPlan> plans = Arrays.asList(shortTerm, longTerm); Collections.sort(plans, new ActionPlanDeadlineComparator()); assertThat(plans).containsSequence(shortTerm, longTerm); @@ -47,7 +47,7 @@ public class ActionPlanDeadlineComparatorTest { } @Test - public void end_with_plans_without_deadline() throws Exception { + public void end_with_plans_without_deadline() { List<ActionPlan> plans = Arrays.asList(noDeadline, longTerm, shortTerm); Collections.sort(plans, new ActionPlanDeadlineComparator()); assertThat(plans).containsSequence(shortTerm, longTerm, noDeadline); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java index d3475234280..a84e1111836 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueBuilderTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DefaultIssueBuilderTest { @Test - public void build_new_issue() throws Exception { + public void build_new_issue() { String componentKey = "org.apache.struts:struts-core:Action.java"; String projectKey = "org.apache.struts"; DefaultIssue issue = (DefaultIssue) new DefaultIssueBuilder() diff --git a/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java b/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java index 0ff082750e3..8a4181f47b5 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/IssueUpdaterTest.java @@ -42,12 +42,12 @@ public class IssueUpdaterTest { IssueUpdater updater; @Before - public void setUp() throws Exception { + public void setUp() { updater = new IssueUpdater(); } @Test - public void assign() throws Exception { + public void assign() { User user = new DefaultUser().setLogin("emmerik").setName("Emmerik"); boolean updated = updater.assign(issue, user, context); @@ -60,7 +60,7 @@ public class IssueUpdaterTest { } @Test - public void unassign() throws Exception { + public void unassign() { issue.setAssignee("morgan"); boolean updated = updater.assign(issue, null, context); assertThat(updated).isTrue(); @@ -72,7 +72,7 @@ public class IssueUpdaterTest { } @Test - public void change_assignee() throws Exception { + public void change_assignee() { User user = new DefaultUser().setLogin("emmerik").setName("Emmerik"); issue.setAssignee("morgan"); @@ -86,7 +86,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_assignee() throws Exception { + public void not_change_assignee() { User user = new DefaultUser().setLogin("morgan").setName("Morgan"); issue.setAssignee("morgan"); @@ -97,7 +97,7 @@ public class IssueUpdaterTest { } @Test - public void set_severity() throws Exception { + public void set_severity() { boolean updated = updater.setSeverity(issue, "BLOCKER", context); assertThat(updated).isTrue(); assertThat(issue.severity()).isEqualTo("BLOCKER"); @@ -110,7 +110,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_severity() throws Exception { + public void set_past_severity() { issue.setSeverity("BLOCKER"); boolean updated = updater.setPastSeverity(issue, "INFO", context); assertThat(updated).isTrue(); @@ -123,7 +123,7 @@ public class IssueUpdaterTest { } @Test - public void update_severity() throws Exception { + public void update_severity() { issue.setSeverity("BLOCKER"); boolean updated = updater.setSeverity(issue, "MINOR", context); @@ -136,7 +136,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_severity() throws Exception { + public void not_change_severity() { issue.setSeverity("MINOR"); boolean updated = updater.setSeverity(issue, "MINOR", context); assertThat(updated).isFalse(); @@ -145,7 +145,7 @@ public class IssueUpdaterTest { } @Test - public void not_revert_manual_severity() throws Exception { + public void not_revert_manual_severity() { issue.setSeverity("MINOR").setManualSeverity(true); try { updater.setSeverity(issue, "MAJOR", context); @@ -155,7 +155,7 @@ public class IssueUpdaterTest { } @Test - public void set_manual_severity() throws Exception { + public void set_manual_severity() { issue.setSeverity("BLOCKER"); boolean updated = updater.setManualSeverity(issue, "MINOR", context); @@ -169,7 +169,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_manual_severity() throws Exception { + public void not_change_manual_severity() { issue.setSeverity("MINOR").setManualSeverity(true); boolean updated = updater.setManualSeverity(issue, "MINOR", context); assertThat(updated).isFalse(); @@ -178,7 +178,7 @@ public class IssueUpdaterTest { } @Test - public void set_line() throws Exception { + public void set_line() { boolean updated = updater.setLine(issue, 123); assertThat(updated).isTrue(); assertThat(issue.line()).isEqualTo(123); @@ -188,7 +188,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_line() throws Exception { + public void set_past_line() { issue.setLine(42); boolean updated = updater.setPastLine(issue, 123); assertThat(updated).isTrue(); @@ -200,7 +200,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_line() throws Exception { + public void not_change_line() { issue.setLine(123); boolean updated = updater.setLine(issue, 123); assertThat(updated).isFalse(); @@ -210,7 +210,7 @@ public class IssueUpdaterTest { } @Test - public void set_resolution() throws Exception { + public void set_resolution() { boolean updated = updater.setResolution(issue, "OPEN", context); assertThat(updated).isTrue(); assertThat(issue.resolution()).isEqualTo("OPEN"); @@ -222,7 +222,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_resolution() throws Exception { + public void not_change_resolution() { issue.setResolution("FIXED"); boolean updated = updater.setResolution(issue, "FIXED", context); assertThat(updated).isFalse(); @@ -232,7 +232,7 @@ public class IssueUpdaterTest { } @Test - public void set_status() throws Exception { + public void set_status() { boolean updated = updater.setStatus(issue, "OPEN", context); assertThat(updated).isTrue(); assertThat(issue.status()).isEqualTo("OPEN"); @@ -244,7 +244,7 @@ public class IssueUpdaterTest { } @Test - public void not_change_status() throws Exception { + public void not_change_status() { issue.setStatus("CLOSED"); boolean updated = updater.setStatus(issue, "CLOSED", context); assertThat(updated).isFalse(); @@ -254,7 +254,7 @@ public class IssueUpdaterTest { } @Test - public void set_new_attribute_value() throws Exception { + public void set_new_attribute_value() { boolean updated = updater.setAttribute(issue, "JIRA", "FOO-123", context); assertThat(updated).isTrue(); assertThat(issue.attribute("JIRA")).isEqualTo("FOO-123"); @@ -265,7 +265,7 @@ public class IssueUpdaterTest { } @Test - public void unset_attribute() throws Exception { + public void unset_attribute() { issue.setAttribute("JIRA", "FOO-123"); boolean updated = updater.setAttribute(issue, "JIRA", null, context); assertThat(updated).isTrue(); @@ -277,7 +277,7 @@ public class IssueUpdaterTest { } @Test - public void not_update_attribute() throws Exception { + public void not_update_attribute() { issue.setAttribute("JIRA", "FOO-123"); boolean updated = updater.setAttribute(issue, "JIRA", "FOO-123", context); assertThat(updated).isFalse(); @@ -285,7 +285,7 @@ public class IssueUpdaterTest { } @Test - public void plan_with_no_existing_plan() throws Exception { + public void plan_with_no_existing_plan() { ActionPlan newActionPlan = DefaultActionPlan.create("newName"); boolean updated = updater.plan(issue, newActionPlan, context); @@ -299,7 +299,7 @@ public class IssueUpdaterTest { } @Test - public void plan_with_existing_plan() throws Exception { + public void plan_with_existing_plan() { issue.setActionPlanKey("formerActionPlan"); ActionPlan newActionPlan = DefaultActionPlan.create("newName").setKey("newKey"); @@ -315,7 +315,7 @@ public class IssueUpdaterTest { } @Test - public void unplan() throws Exception { + public void unplan() { issue.setActionPlanKey("formerActionPlan"); boolean updated = updater.plan(issue, null, context); @@ -329,7 +329,7 @@ public class IssueUpdaterTest { } @Test - public void not_plan_again() throws Exception { + public void not_plan_again() { issue.setActionPlanKey("existingActionPlan"); ActionPlan newActionPlan = DefaultActionPlan.create("existingActionPlan").setKey("existingActionPlan"); @@ -341,7 +341,7 @@ public class IssueUpdaterTest { } @Test - public void set_effort_to_fix() throws Exception { + public void set_effort_to_fix() { boolean updated = updater.setEffortToFix(issue, 3.14, context); assertThat(updated).isTrue(); assertThat(issue.isChanged()).isTrue(); @@ -350,7 +350,7 @@ public class IssueUpdaterTest { } @Test - public void not_set_effort_to_fix_if_unchanged() throws Exception { + public void not_set_effort_to_fix_if_unchanged() { issue.setEffortToFix(3.14); boolean updated = updater.setEffortToFix(issue, 3.14, context); assertThat(updated).isFalse(); @@ -360,7 +360,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_effort() throws Exception { + public void set_past_effort() { issue.setEffortToFix(3.14); boolean updated = updater.setPastEffortToFix(issue, 1.0, context); assertThat(updated).isTrue(); @@ -372,7 +372,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_technical_debt() throws Exception { + public void set_past_technical_debt() { Duration newDebt = Duration.create(15 * 8 * 60); Duration previousDebt = Duration.create(10 * 8 * 60); issue.setDebt(newDebt); @@ -387,7 +387,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_technical_debt_without_previous_value() throws Exception { + public void set_past_technical_debt_without_previous_value() { Duration newDebt = Duration.create(15 * 8 * 60); issue.setDebt(newDebt); boolean updated = updater.setPastTechnicalDebt(issue, null, context); @@ -401,7 +401,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_technical_debt_with_null_new_value() throws Exception { + public void set_past_technical_debt_with_null_new_value() { issue.setDebt(null); Duration previousDebt = Duration.create(10 * 8 * 60); boolean updated = updater.setPastTechnicalDebt(issue, previousDebt, context); @@ -415,7 +415,7 @@ public class IssueUpdaterTest { } @Test - public void set_message() throws Exception { + public void set_message() { boolean updated = updater.setMessage(issue, "the message", context); assertThat(updated).isTrue(); assertThat(issue.isChanged()).isTrue(); @@ -424,7 +424,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_message() throws Exception { + public void set_past_message() { issue.setMessage("new message"); boolean updated = updater.setPastMessage(issue, "past message", context); assertThat(updated).isTrue(); @@ -436,7 +436,7 @@ public class IssueUpdaterTest { } @Test - public void set_author() throws Exception { + public void set_author() { boolean updated = updater.setAuthorLogin(issue, "eric", context); assertThat(updated).isTrue(); assertThat(issue.authorLogin()).isEqualTo("eric"); @@ -448,7 +448,7 @@ public class IssueUpdaterTest { } @Test - public void set_project() throws Exception { + public void set_project() { boolean updated = updater.setProject(issue, "sample", context); assertThat(updated).isTrue(); assertThat(issue.projectKey()).isEqualTo("sample"); @@ -459,7 +459,7 @@ public class IssueUpdaterTest { } @Test - public void set_past_project() throws Exception { + public void set_past_project() { issue.setProjectKey("new project key"); boolean updated = updater.setPastProject(issue, "past project key", context); assertThat(updated).isTrue(); @@ -471,7 +471,7 @@ public class IssueUpdaterTest { } @Test - public void not_set_past_project_if_no_change() throws Exception { + public void not_set_past_project_if_no_change() { issue.setProjectKey("key"); boolean updated = updater.setPastProject(issue, "key", context); assertThat(updated).isFalse(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java index c6d5d6219bf..d9de4aa528f 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDaoTest.java @@ -51,7 +51,7 @@ public class IssueChangeDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java index 3ae8f107ba0..3b383c1c974 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeDtoTest.java @@ -30,7 +30,7 @@ import static org.sonar.api.utils.DateUtils.parseDate; public class IssueChangeDtoTest { @Test - public void create_from_comment() throws Exception { + public void create_from_comment() { DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); IssueChangeDto dto = IssueChangeDto.of(comment); @@ -45,7 +45,7 @@ public class IssueChangeDtoTest { } @Test - public void create_from_comment_with_created_at() throws Exception { + public void create_from_comment_with_created_at() { DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); comment.setCreatedAt(parseDate("2015-01-13")); @@ -55,7 +55,7 @@ public class IssueChangeDtoTest { } @Test - public void create_from_diff() throws Exception { + public void create_from_diff() { FieldDiffs diffs = new FieldDiffs(); diffs.setDiff("severity", "INFO", "BLOCKER"); diffs.setUserLogin("emmerik"); @@ -72,7 +72,7 @@ public class IssueChangeDtoTest { } @Test - public void create_from_diff_with_created_at() throws Exception { + public void create_from_diff_with_created_at() { FieldDiffs diffs = new FieldDiffs(); diffs.setDiff("severity", "INFO", "BLOCKER"); diffs.setUserLogin("emmerik"); @@ -84,7 +84,7 @@ public class IssueChangeDtoTest { } @Test - public void to_comment() throws Exception { + public void to_comment() { IssueChangeDto changeDto = new IssueChangeDto() .setKey("EFGH") .setUserLogin("emmerik") @@ -103,7 +103,7 @@ public class IssueChangeDtoTest { } @Test - public void to_field_diffs_with_issue_creation_date() throws Exception { + public void to_field_diffs_with_issue_creation_date() { IssueChangeDto changeDto = new IssueChangeDto() .setKey("EFGH") .setUserLogin("emmerik") @@ -118,7 +118,7 @@ public class IssueChangeDtoTest { } @Test - public void to_field_diffs_with_create_at() throws Exception { + public void to_field_diffs_with_create_at() { IssueChangeDto changeDto = new IssueChangeDto() .setKey("EFGH") .setUserLogin("emmerik") @@ -133,7 +133,7 @@ public class IssueChangeDtoTest { } @Test - public void to_string() throws Exception { + public void to_string() { DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); IssueChangeDto dto = IssueChangeDto.of(comment); assertThat(dto.toString()).contains("ABCDE"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java index 070cd2641d8..f9d51c39c37 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueChangeMapperTest.java @@ -42,7 +42,7 @@ public class IssueChangeMapperTest extends AbstractDaoTestCase { } @Test - public void insert_diff() throws Exception { + public void insert_diff() { IssueChangeDto dto = new IssueChangeDto(); dto.setKey(null /* no key on field changes */); dto.setUserLogin("emmerik"); @@ -59,7 +59,7 @@ public class IssueChangeMapperTest extends AbstractDaoTestCase { } @Test - public void insert_comment() throws Exception { + public void insert_comment() { IssueChangeDto dto = new IssueChangeDto(); dto.setKey("COMMENT-1234"); dto.setUserLogin("emmerik"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java index d8495ccb6d2..7958aa26674 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java @@ -42,7 +42,7 @@ public class IssueDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java index d9561829aa7..9e81671a899 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueMapperTest.java @@ -46,7 +46,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void insert() throws Exception { + public void insert() { IssueDto dto = new IssueDto(); dto.setComponentUuid("uuid-123"); dto.setProjectUuid("uuid-100"); @@ -79,7 +79,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void update() throws Exception { + public void update() { setupData("testUpdate"); IssueDto dto = new IssueDto(); @@ -114,7 +114,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void updateBeforeSelectedDate_without_conflict() throws Exception { + public void updateBeforeSelectedDate_without_conflict() { setupData("testUpdate"); IssueDto dto = new IssueDto(); @@ -152,7 +152,7 @@ public class IssueMapperTest extends AbstractDaoTestCase { } @Test - public void updateBeforeSelectedDate_with_conflict() throws Exception { + public void updateBeforeSelectedDate_with_conflict() { setupData("updateBeforeSelectedDate_with_conflict"); IssueDto dto = new IssueDto(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java index bdda38311e9..62e10059629 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/IssueStorageTest.java @@ -51,12 +51,12 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @After - public void after() throws Exception { + public void after() { session.close(); } @Test - public void batch_insert_new_issues() throws Exception { + public void batch_insert_new_issues() { FakeBatchSaver saver = new FakeBatchSaver(getMyBatis(), new FakeRuleFinder()); DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); @@ -91,7 +91,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void batch_insert_new_issues_with_session() throws Exception { + public void batch_insert_new_issues_with_session() { FakeBatchSaver saver = new FakeBatchSaver(getMyBatis(), new FakeRuleFinder()); DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment"); @@ -127,7 +127,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void server_insert_new_issues_with_session() throws Exception { + public void server_insert_new_issues_with_session() { ComponentDto project = new ComponentDto().setId(10L).setUuid("uuid-10"); ComponentDto component = new ComponentDto().setId(100L).setUuid("uuid-100"); FakeServerSaver saver = new FakeServerSaver(getMyBatis(), new FakeRuleFinder(), component, project); @@ -165,7 +165,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void batch_update_issues() throws Exception { + public void batch_update_issues() { setupData("should_update_issues"); FakeBatchSaver saver = new FakeBatchSaver(getMyBatis(), new FakeRuleFinder()); @@ -209,7 +209,7 @@ public class IssueStorageTest extends AbstractDaoTestCase { } @Test - public void server_update_issues() throws Exception { + public void server_update_issues() { setupData("should_update_issues"); ComponentDto project = new ComponentDto().setId(10L).setUuid("whatever-uuid"); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java b/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java index ba6599d789d..2dc79d30b8d 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/db/UpdateConflictResolverTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.*; public class UpdateConflictResolverTest { @Test - public void should_reload_issue_and_resolve_conflict() throws Exception { + public void should_reload_issue_and_resolve_conflict() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setRuleKey(RuleKey.of("squid", "AvoidCycles")) @@ -66,7 +66,7 @@ public class UpdateConflictResolverTest { } @Test - public void should_keep_changes_made_by_user() throws Exception { + public void should_keep_changes_made_by_user() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setRuleKey(RuleKey.of("squid", "AvoidCycles")) @@ -121,7 +121,7 @@ public class UpdateConflictResolverTest { } @Test - public void severity_changed_by_user_should_be_kept() throws Exception { + public void severity_changed_by_user_should_be_kept() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setRuleKey(RuleKey.of("squid", "AvoidCycles")) diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java index 57823a87d7b..47ca6b3d526 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsEndOfLifeTest.java @@ -28,14 +28,14 @@ public class IsEndOfLifeTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_be_end_of_life() throws Exception { + public void should_be_end_of_life() { IsEndOfLife condition = new IsEndOfLife(true); assertThat(condition.matches(issue.setEndOfLife(true))).isTrue(); assertThat(condition.matches(issue.setEndOfLife(false))).isFalse(); } @Test - public void should_not_be_end_of_life() throws Exception { + public void should_not_be_end_of_life() { IsEndOfLife condition = new IsEndOfLife(false); assertThat(condition.matches(issue.setEndOfLife(true))).isFalse(); assertThat(condition.matches(issue.setEndOfLife(false))).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java index 7deaf627aa6..16a82274f04 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IsManualTest.java @@ -28,14 +28,14 @@ public class IsManualTest { DefaultIssue issue = new DefaultIssue(); @Test - public void should_match() throws Exception { + public void should_match() { IsManual condition = new IsManual(true); assertThat(condition.matches(issue.setReporter("you"))).isTrue(); assertThat(condition.matches(issue.setReporter(null))).isFalse(); } @Test - public void should_match_dead() throws Exception { + public void should_match_dead() { IsManual condition = new IsManual(false); assertThat(condition.matches(issue.setReporter("you"))).isFalse(); assertThat(condition.matches(issue.setReporter(null))).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java index 1eb2430420a..8cc01a72189 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/IssueWorkflowTest.java @@ -47,7 +47,7 @@ public class IssueWorkflowTest { IssueWorkflow workflow = new IssueWorkflow(new FunctionExecutor(updater), updater); @Test - public void init_state_machine() throws Exception { + public void init_state_machine() { assertThat(workflow.machine()).isNull(); workflow.start(); assertThat(workflow.machine()).isNotNull(); @@ -60,14 +60,14 @@ public class IssueWorkflowTest { } @Test - public void list_statuses() throws Exception { + public void list_statuses() { workflow.start(); // order is important for UI assertThat(workflow.statusKeys()).containsSequence(Issue.STATUS_OPEN, Issue.STATUS_CONFIRMED, Issue.STATUS_REOPENED, Issue.STATUS_RESOLVED, Issue.STATUS_CLOSED); } @Test - public void list_out_transitions_from_status_open() throws Exception { + public void list_out_transitions_from_status_open() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_OPEN); @@ -76,7 +76,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_confirmed() throws Exception { + public void list_out_transitions_from_status_confirmed() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_CONFIRMED); @@ -85,7 +85,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_resolved() throws Exception { + public void list_out_transitions_from_status_resolved() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_RESOLVED); @@ -94,7 +94,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_reopen() throws Exception { + public void list_out_transitions_from_status_reopen() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_REOPENED); @@ -103,7 +103,7 @@ public class IssueWorkflowTest { } @Test - public void list_no_out_transition_from_status_closed() throws Exception { + public void list_no_out_transition_from_status_closed() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus(Issue.STATUS_CLOSED); @@ -112,7 +112,7 @@ public class IssueWorkflowTest { } @Test - public void list_out_transitions_from_status_closed_on_manual_issue() throws Exception { + public void list_out_transitions_from_status_closed_on_manual_issue() { workflow.start(); // Manual issue because of reporter @@ -127,7 +127,7 @@ public class IssueWorkflowTest { } @Test - public void fail_if_unknown_status_when_listing_transitions() throws Exception { + public void fail_if_unknown_status_when_listing_transitions() { workflow.start(); DefaultIssue issue = new DefaultIssue().setStatus("xxx"); @@ -141,7 +141,7 @@ public class IssueWorkflowTest { @Test - public void do_automatic_transition() throws Exception { + public void do_automatic_transition() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -159,7 +159,7 @@ public class IssueWorkflowTest { } @Test - public void close_open_dead_issue() throws Exception { + public void close_open_dead_issue() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -177,7 +177,7 @@ public class IssueWorkflowTest { } @Test - public void close_reopened_dead_issue() throws Exception { + public void close_reopened_dead_issue() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -195,7 +195,7 @@ public class IssueWorkflowTest { } @Test - public void close_confirmed_dead_issue() throws Exception { + public void close_confirmed_dead_issue() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -214,7 +214,7 @@ public class IssueWorkflowTest { @Test - public void fail_if_unknown_status_on_automatic_trans() throws Exception { + public void fail_if_unknown_status_on_automatic_trans() { workflow.start(); DefaultIssue issue = new DefaultIssue() @@ -232,7 +232,7 @@ public class IssueWorkflowTest { } @Test - public void flag_as_false_positive() throws Exception { + public void flag_as_false_positive() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(Issue.STATUS_OPEN) @@ -250,7 +250,7 @@ public class IssueWorkflowTest { } @Test - public void wont_fix() throws Exception { + public void wont_fix() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(Issue.STATUS_OPEN) @@ -268,7 +268,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issues_be_resolved_then_closed() throws Exception { + public void manual_issues_be_resolved_then_closed() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") @@ -299,7 +299,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issues_be_confirmed_then_kept_open() throws Exception { + public void manual_issues_be_confirmed_then_kept_open() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") @@ -339,7 +339,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issue_on_removed_rule_be_closed() throws Exception { + public void manual_issue_on_removed_rule_be_closed() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") @@ -357,7 +357,7 @@ public class IssueWorkflowTest { } @Test - public void manual_issue_on_removed_component_be_closed() throws Exception { + public void manual_issue_on_removed_component_be_closed() { // Manual issue because of reporter DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java index 1e12908b4c4..ebadb4bccd9 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetAssigneeTest.java @@ -28,7 +28,7 @@ import static org.mockito.Mockito.*; public class SetAssigneeTest { @Test - public void assign() throws Exception { + public void assign() { User user = new DefaultUser().setLogin("eric").setName("eric"); SetAssignee function = new SetAssignee(user); Function.Context context = mock(Function.Context.class); @@ -37,7 +37,7 @@ public class SetAssigneeTest { } @Test - public void unassign() throws Exception { + public void unassign() { Function.Context context = mock(Function.Context.class); SetAssignee.UNASSIGN.execute(context); verify(context, times(1)).setAssignee(null); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java index 21e8a2c72a1..e4cb9f59783 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetCloseDateTest.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.verify; public class SetCloseDateTest { @Test - public void should_set_close_date() throws Exception { + public void should_set_close_date() { SetCloseDate function = new SetCloseDate(true); Function.Context context = mock(Function.Context.class); function.execute(context); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java index a05e9d0e056..014a8c2d087 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetEndOfLifeTest.java @@ -33,7 +33,7 @@ public class SetEndOfLifeTest { SetEndOfLife function = new SetEndOfLife(); @Test - public void should_resolve_as_fixed() throws Exception { + public void should_resolve_as_fixed() { Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(false); when(context.issue()).thenReturn(issue); function.execute(context); @@ -41,7 +41,7 @@ public class SetEndOfLifeTest { } @Test - public void should_resolve_as_removed_when_rule_is_disabled() throws Exception { + public void should_resolve_as_removed_when_rule_is_disabled() { Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(true); when(context.issue()).thenReturn(issue); function.execute(context); @@ -49,7 +49,7 @@ public class SetEndOfLifeTest { } @Test - public void should_fail_if_issue_is_not_resolved() throws Exception { + public void should_fail_if_issue_is_not_resolved() { Issue issue = new DefaultIssue().setEndOfLife(false); when(context.issue()).thenReturn(issue); try { @@ -62,7 +62,7 @@ public class SetEndOfLifeTest { } @Test - public void line_number_must_be_unset() throws Exception { + public void line_number_must_be_unset() { Issue issue = new DefaultIssue().setEndOfLife(true).setLine(10); when(context.issue()).thenReturn(issue); function.execute(context); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java index db88e155ff4..0ef18d3ab5d 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/SetResolutionTest.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.verify; public class SetResolutionTest { @Test - public void execute() throws Exception { + public void execute() { SetResolution function = new SetResolution("FIXED"); Function.Context context = mock(Function.Context.class); function.execute(context); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java index 0f4640fc583..db598bc805a 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateMachineTest.java @@ -25,14 +25,14 @@ import static org.assertj.core.api.Assertions.assertThat; public class StateMachineTest { @Test - public void keep_order_of_state_keys() throws Exception { + public void keep_order_of_state_keys() { StateMachine machine = StateMachine.builder().states("OPEN", "RESOLVED", "CLOSED").build(); assertThat(machine.stateKeys()).containsSequence("OPEN", "RESOLVED", "CLOSED"); } @Test - public void stateKey() throws Exception { + public void stateKey() { StateMachine machine = StateMachine.builder() .states("OPEN", "RESOLVED", "CLOSED") .transition(Transition.builder("resolve").from("OPEN").to("RESOLVED").build()) diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java index 4845435612c..c9ad378df48 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/StateTest.java @@ -29,7 +29,7 @@ public class StateTest { Transition t1 = Transition.builder("close").from("OPEN").to("CLOSED").build(); @Test - public void key_should_be_set() throws Exception { + public void key_should_be_set() { try { new State("", new Transition[0]); fail(); @@ -39,7 +39,7 @@ public class StateTest { } @Test - public void key_should_be_upper_case() throws Exception { + public void key_should_be_upper_case() { try { new State("close", new Transition[0]); fail(); @@ -49,7 +49,7 @@ public class StateTest { } @Test - public void no_duplicated_out_transitions() throws Exception { + public void no_duplicated_out_transitions() { try { new State("CLOSE", new Transition[]{t1, t1}); fail(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java b/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java index 0ac9809fdec..4c680c54ec1 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/workflow/TransitionTest.java @@ -63,7 +63,7 @@ public class TransitionTest { } @Test - public void key_should_be_set() throws Exception { + public void key_should_be_set() { try { Transition.builder("").from("OPEN").to("CLOSED").build(); fail(); @@ -73,7 +73,7 @@ public class TransitionTest { } @Test - public void key_should_be_lower_case() throws Exception { + public void key_should_be_lower_case() { try { Transition.builder("CLOSE").from("OPEN").to("CLOSED").build(); fail(); @@ -83,7 +83,7 @@ public class TransitionTest { } @Test - public void originating_status_should_be_set() throws Exception { + public void originating_status_should_be_set() { try { Transition.builder("close").from("").to("CLOSED").build(); fail(); @@ -93,7 +93,7 @@ public class TransitionTest { } @Test - public void destination_status_should_be_set() throws Exception { + public void destination_status_should_be_set() { try { Transition.builder("close").from("OPEN").to("").build(); fail(); @@ -103,7 +103,7 @@ public class TransitionTest { } @Test - public void should_verify_conditions() throws Exception { + public void should_verify_conditions() { DefaultIssue issue = new DefaultIssue(); Transition transition = Transition.builder("close") .from("OPEN").to("CLOSED") diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java index e75676287e8..c3f3dd852f3 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java @@ -55,32 +55,32 @@ public class MeasureDtoTest { } @Test - public void value_with_text_over_4000_characters() throws Exception { + public void value_with_text_over_4000_characters() { assertThat(sut.setData(Strings.repeat("1", 4001)).getData()).isNotNull(); } @Test - public void text_value_under_4000_characters() throws Exception { + public void text_value_under_4000_characters() { assertThat(sut.setData("text value").getData()).isEqualTo("text value"); } @Test(expected = IndexOutOfBoundsException.class) - public void fail_to_set_out_of_bounds_variation() throws Exception { + public void fail_to_set_out_of_bounds_variation() { sut.setVariation(6, 1d); } @Test(expected = IndexOutOfBoundsException.class) - public void fail_to_get_out_of_bounds_variation() throws Exception { + public void fail_to_get_out_of_bounds_variation() { sut.getVariation(6); } @Test(expected = IllegalArgumentException.class) - public void fail_if_non_existent_severity() throws Exception { + public void fail_if_non_existent_severity() { sut.setSeverity("MAYOR"); } @Test - public void severity_values_are_retrieved() throws Exception { + public void severity_values_are_retrieved() { assertThat(sut.getSeverity()).isNull(); for (String severity : Severity.ALL) { diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java index 19641d6c94a..93ce3e37163 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/db/MetricDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MetricDtoTest { @Test - public void getters_and_setters() throws Exception { + public void getters_and_setters() { MetricDto metricDto = new MetricDto() .setId(1) .setKey("coverage") diff --git a/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java b/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java index 015b2e72e46..9e1dae9de30 100644 --- a/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/notification/DefaultNotificationManagerTest.java @@ -88,7 +88,7 @@ public class DefaultNotificationManagerTest extends AbstractDbUnitTestCase { } @Test - public void shouldPersist() throws Exception { + public void shouldPersist() { Notification notification = new Notification("test"); manager.scheduleForSending(notification); @@ -96,7 +96,7 @@ public class DefaultNotificationManagerTest extends AbstractDbUnitTestCase { } @Test - public void shouldGetFromQueueAndDelete() throws Exception { + public void shouldGetFromQueueAndDelete() { Notification notification = new Notification("test"); NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification); List<NotificationQueueDto> dtos = Arrays.asList(dto); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java index 7a054560f48..7b79f0f1600 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDaoTest.java @@ -40,7 +40,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_groups_for_project_permission() throws Exception { + public void select_groups_for_project_permission() { setupData("groups_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -69,7 +69,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void anyone_group_is_not_returned_when_it_has_no_permission() throws Exception { + public void anyone_group_is_not_returned_when_it_has_no_permission() { setupData("groups_with_permissions"); // Anyone group has not the permission 'admin', so it's not returned @@ -91,7 +91,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_groups_for_global_permission() throws Exception { + public void select_groups_for_global_permission() { setupData("groups_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("admin").build(); @@ -112,7 +112,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_groups_name() throws Exception { + public void search_by_groups_name() { setupData("groups_with_permissions"); List<GroupWithPermissionDto> result = dao.selectGroups(PermissionQuery.builder().permission("user").search("aDMini").build(), COMPONENT_ID); @@ -124,7 +124,7 @@ public class GroupWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void search_groups_should_be_sorted_by_group_name() throws Exception { + public void search_groups_should_be_sorted_by_group_name() { setupData("groups_with_permissions_should_be_sorted_by_group_name"); List<GroupWithPermissionDto> result = dao.selectGroups(PermissionQuery.builder().permission("user").build(), COMPONENT_ID); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java index bbff4ba4c58..ef4a30aef47 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GroupWithPermissionDtoTest { @Test - public void to_group_with_permission_having_permission() throws Exception { + public void to_group_with_permission_having_permission() { GroupWithPermission group = new GroupWithPermissionDto() .setName("users") .setDescription("desc") @@ -40,7 +40,7 @@ public class GroupWithPermissionDtoTest { } @Test - public void to_group_with_permission_not_having_permission() throws Exception { + public void to_group_with_permission_not_having_permission() { GroupWithPermission group = new GroupWithPermissionDto() .setName("users") .setPermission(null) diff --git a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java index 6ab511947d3..28ff2c3ed32 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java @@ -41,7 +41,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_groups() throws Exception { + public void select_groups() { setupData("groups_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -71,7 +71,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void anyone_group_is_not_returned_when_it_has_no_permission() throws Exception { + public void anyone_group_is_not_returned_when_it_has_no_permission() { setupData("groups_with_permissions"); // Anyone group has not the permission 'admin', so it's not returned @@ -93,7 +93,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_groups_name() throws Exception { + public void search_by_groups_name() { setupData("groups_with_permissions"); List<GroupWithPermissionDto> result = dao.selectGroups(PermissionQuery.builder().permission("user").search("aDMini").build(), TEMPLATE_ID); @@ -105,7 +105,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void search_groups_should_be_sorted_by_group_name() throws Exception { + public void search_groups_should_be_sorted_by_group_name() { setupData("groups_with_permissions_should_be_sorted_by_group_name"); List<GroupWithPermissionDto> result = dao.selectGroups(PermissionQuery.builder().permission("user").build(), TEMPLATE_ID); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java b/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java index 324bcb61995..8eafb61e80c 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java @@ -64,12 +64,12 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void should_apply_permission_template() throws Exception { + public void should_apply_permission_template() { setupData("should_apply_permission_template"); assertThat(permissionFacade.selectGroupPermissions(session, "sonar-administrators", 123L)).isEmpty(); @@ -89,14 +89,14 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_count_component_permissions() throws Exception { + public void should_count_component_permissions() { setupData("should_count_component_permissions"); assertThat(permissionFacade.countComponentPermissions(session, 123L)).isEqualTo(2); } @Test - public void should_add_user_permission() throws Exception { + public void should_add_user_permission() { setupData("should_add_user_permission"); permissionFacade.insertUserPermission(123L, 200L, UserRole.ADMIN, session); @@ -107,7 +107,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_delete_user_permission() throws Exception { + public void should_delete_user_permission() { setupData("should_delete_user_permission"); permissionFacade.deleteUserPermission(123L, 200L, UserRole.ADMIN, session); @@ -118,7 +118,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_insert_group_permission() throws Exception { + public void should_insert_group_permission() { setupData("should_insert_group_permission"); permissionFacade.insertGroupPermission(123L, 100L, UserRole.USER, session); @@ -129,7 +129,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_insert_group_name_permission() throws Exception { + public void should_insert_group_name_permission() { setupData("should_insert_group_permission"); permissionFacade.insertGroupPermission(123L, "devs", UserRole.USER, session); @@ -140,7 +140,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_insert_anyone_group_permission() throws Exception { + public void should_insert_anyone_group_permission() { setupData("should_insert_anyone_group_permission"); permissionFacade.insertGroupPermission(123L, "Anyone", UserRole.USER, session); @@ -151,7 +151,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_delete_group_permission() throws Exception { + public void should_delete_group_permission() { setupData("should_delete_group_permission"); permissionFacade.deleteGroupPermission(123L, 100L, UserRole.USER, session); @@ -162,7 +162,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_delete_group_name_permission() throws Exception { + public void should_delete_group_name_permission() { setupData("should_delete_group_permission"); permissionFacade.deleteGroupPermission(123L, "devs", UserRole.USER, session); @@ -173,7 +173,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_retrieve_permission_template() throws Exception { + public void should_retrieve_permission_template() { PermissionTemplateDto permissionTemplateDto = new PermissionTemplateDto().setName("Test template").setKee("test_template"); PermissionTemplateDto templateWithPermissions = new PermissionTemplateDto().setKee("test_template"); permissionTemplateDao = mock(PermissionTemplateDao.class); @@ -188,7 +188,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_fail_on_unmatched_template() throws Exception { + public void should_fail_on_unmatched_template() { throwable.expect(IllegalArgumentException.class); permissionTemplateDao = mock(PermissionTemplateDao.class); @@ -198,7 +198,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase { } @Test - public void should_remove_all_permissions() throws Exception { + public void should_remove_all_permissions() { setupData("should_remove_all_permissions"); assertThat(permissionFacade.selectGroupPermissions(session, "devs", 123L)).hasSize(1); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java index e4c5b8de4ec..c3bfc1fa000 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/PermissionTemplateDaoTest.java @@ -57,7 +57,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_create_permission_template() throws Exception { + public void should_create_permission_template() { setupData("createPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.createPermissionTemplate("my template", "my description", "myregexp"); assertThat(permissionTemplate).isNotNull(); @@ -66,7 +66,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_normalize_kee_on_template_creation() throws Exception { + public void should_normalize_kee_on_template_creation() { setupData("createNonAsciiPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.createPermissionTemplate("Môü Gnô Gnèçà ß", "my description", null); assertThat(permissionTemplate).isNotNull(); @@ -75,7 +75,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_skip_key_normalization_on_default_template() throws Exception { + public void should_skip_key_normalization_on_default_template() { PermissionTemplateMapper mapper = mock(PermissionTemplateMapper.class); @@ -95,7 +95,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_permission_template() throws Exception { + public void should_select_permission_template() { setupData("selectPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.selectPermissionTemplate("my_template_20130102_030405"); @@ -115,7 +115,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_empty_permission_template() throws Exception { + public void should_select_empty_permission_template() { setupData("selectEmptyPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.selectPermissionTemplate("my_template_20130102_030405"); @@ -127,7 +127,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_permission_template_by_key() throws Exception { + public void should_select_permission_template_by_key() { setupData("selectPermissionTemplate"); PermissionTemplateDto permissionTemplate = permissionTemplateDao.selectTemplateByKey("my_template_20130102_030405"); @@ -140,7 +140,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_all_permission_templates() throws Exception { + public void should_select_all_permission_templates() { setupData("selectAllPermissionTemplates"); List<PermissionTemplateDto> permissionTemplates = permissionTemplateDao.selectAllPermissionTemplates(); @@ -153,7 +153,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_update_permission_template() throws Exception { + public void should_update_permission_template() { setupData("updatePermissionTemplate"); permissionTemplateDao.updatePermissionTemplate(1L, "new_name", "new_description", "new_regexp"); @@ -162,7 +162,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_delete_permission_template() throws Exception { + public void should_delete_permission_template() { setupData("deletePermissionTemplate"); permissionTemplateDao.deletePermissionTemplate(1L); @@ -173,7 +173,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_add_user_permission_to_template() throws Exception { + public void should_add_user_permission_to_template() { setupData("addUserPermissionToTemplate"); permissionTemplateDao.addUserPermission(1L, 1L, "new_permission"); @@ -183,7 +183,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_remove_user_permission_from_template() throws Exception { + public void should_remove_user_permission_from_template() { setupData("removeUserPermissionFromTemplate"); permissionTemplateDao.removeUserPermission(1L, 2L, "permission_to_remove"); @@ -193,7 +193,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_add_group_permission_to_template() throws Exception { + public void should_add_group_permission_to_template() { setupData("addGroupPermissionToTemplate"); permissionTemplateDao.addGroupPermission(1L, 1L, "new_permission"); @@ -203,7 +203,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_remove_group_permission_from_template() throws Exception { + public void should_remove_group_permission_from_template() { setupData("removeGroupPermissionFromTemplate"); permissionTemplateDao.removeGroupPermission(1L, 2L, "permission_to_remove"); @@ -213,7 +213,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void remove_by_group() throws Exception { + public void remove_by_group() { setupData("remove_by_group"); permissionTemplateDao.removeByGroup(2L, session); session.commit(); @@ -222,7 +222,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_add_group_permission_with_null_name() throws Exception { + public void should_add_group_permission_with_null_name() { setupData("addNullGroupPermissionToTemplate"); permissionTemplateDao.addGroupPermission(1L, null, "new_permission"); @@ -232,7 +232,7 @@ public class PermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_remove_group_permission_with_null_name() throws Exception { + public void should_remove_group_permission_with_null_name() { setupData("removeNullGroupPermissionFromTemplate"); permissionTemplateDao.removeGroupPermission(1L, null, "permission_to_remove"); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java index 44d365c61df..852915106cd 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDaoTest.java @@ -44,7 +44,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_users_for_project_permission() throws Exception { + public void select_all_users_for_project_permission() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -68,7 +68,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_users_for_global_permission() throws Exception { + public void select_all_users_for_global_permission() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("admin").build(); @@ -89,7 +89,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_with_permission() throws Exception { + public void select_only_user_with_permission() { setupData("users_with_permissions"); // user1 and user2 have permission user @@ -97,7 +97,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_without_permission() throws Exception { + public void select_only_user_without_permission() { setupData("users_with_permissions"); // Only user3 has not the user permission @@ -105,7 +105,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_user_name() throws Exception { + public void search_by_user_name() { setupData("users_with_permissions"); List<UserWithPermissionDto> result = dao.selectUsers(PermissionQuery.builder().permission("user").search("SEr1").build(), COMPONENT_ID); @@ -117,7 +117,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_enable_users() throws Exception { + public void select_only_enable_users() { setupData("select_only_enable_users"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -134,7 +134,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_sorted_by_user_name() throws Exception { + public void should_be_sorted_by_user_name() { setupData("users_with_permissions_should_be_sorted_by_user_name"); List<UserWithPermissionDto> result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), COMPONENT_ID); @@ -145,7 +145,7 @@ public class UserWithPermissionDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_paginated() throws Exception { + public void should_be_paginated() { setupData("users_with_permissions"); List<UserWithPermissionDto> result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), COMPONENT_ID, 0, 2); diff --git a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java index 665d6e6401a..ab1f38990f7 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class UserWithPermissionDtoTest { @Test - public void to_user_with_permission_having_permission() throws Exception { + public void to_user_with_permission_having_permission() { UserWithPermission user = new UserWithPermissionDto() .setName("Arthur") .setLogin("arthur") @@ -40,7 +40,7 @@ public class UserWithPermissionDtoTest { } @Test - public void to_user_with_permission_not_having_permission() throws Exception { + public void to_user_with_permission_not_having_permission() { UserWithPermission user = new UserWithPermissionDto() .setName("Arthur") .setLogin("arthur") diff --git a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java index 5cfa6fd43c1..61d1f4f9479 100644 --- a/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java @@ -45,7 +45,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_users() throws Exception { + public void select_all_users() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -69,7 +69,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void return_nothing_on_unknown_template_key() throws Exception { + public void return_nothing_on_unknown_template_key() { setupData("users_with_permissions"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -87,7 +87,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_with_permission() throws Exception { + public void select_only_user_with_permission() { setupData("users_with_permissions"); // user1 and user2 have permission user @@ -95,7 +95,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_user_without_permission() throws Exception { + public void select_only_user_without_permission() { setupData("users_with_permissions"); // Only user3 has not the user permission @@ -103,7 +103,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void select_only_enable_users() throws Exception { + public void select_only_enable_users() { setupData("select_only_enable_users"); PermissionQuery query = PermissionQuery.builder().permission("user").build(); @@ -120,7 +120,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_user_name() throws Exception { + public void search_by_user_name() { setupData("users_with_permissions"); List<UserWithPermissionDto> result = dao.selectUsers(PermissionQuery.builder().permission("user").search("SEr1").build(), TEMPLATE_ID); @@ -132,7 +132,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_sorted_by_user_name() throws Exception { + public void should_be_sorted_by_user_name() { setupData("users_with_permissions_should_be_sorted_by_user_name"); List<UserWithPermissionDto> result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), TEMPLATE_ID); @@ -143,7 +143,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_paginated() throws Exception { + public void should_be_paginated() { setupData("users_with_permissions"); List<UserWithPermissionDto> result = dao.selectUsers(PermissionQuery.builder().permission("user").build(), TEMPLATE_ID, 0, 2); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java index 03e1d41d380..4715e7f4a2c 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/DaoUtilsTest.java @@ -40,13 +40,13 @@ public class DaoUtilsTest { } @Test - public void repeatCondition() throws Exception { + public void repeatCondition() { assertThat(DaoUtils.repeatCondition("uuid=?", 1, "or")).isEqualTo("uuid=?"); assertThat(DaoUtils.repeatCondition("uuid=?", 3, "or")).isEqualTo("uuid=? or uuid=? or uuid=?"); } @Test - public void execute_large_inputs() throws Exception { + public void execute_large_inputs() { List<Integer> inputs = newArrayList(); List<String> expectedOutputs = newArrayList(); for (int i = 0; i < 2010; i++) { @@ -72,7 +72,7 @@ public class DaoUtilsTest { } @Test - public void execute_large_inputs_on_empty_list() throws Exception { + public void execute_large_inputs_on_empty_list() { List<String> outputs = DaoUtils.executeLargeInputs(Collections.<Integer>emptyList(), new Function<List<Integer>, List<String>>() { @Override public List<String> apply(List<Integer> input) { diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java index 6d9c6d74eb1..b12abc5da36 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreDaoTest.java @@ -83,7 +83,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void create_and_acquire_semaphore() throws Exception { + public void create_and_acquire_semaphore() { Semaphores.Semaphore lock = dao.acquire("foo", 60); assertThat(lock.isLocked()).isTrue(); assertThat(lock.getDurationSinceLocked()).isNull(); @@ -120,7 +120,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void fail_to_update_null_semaphore() throws Exception { + public void fail_to_update_null_semaphore() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Semaphore must not be null"); @@ -128,7 +128,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void create_and_acquire_semaphore_when_maxage_is_zeo() throws Exception { + public void create_and_acquire_semaphore_when_maxage_is_zeo() { Semaphores.Semaphore lock = dao.acquire("foo", 0); assertThat(lock.isLocked()).isTrue(); assertThat(lock.getDurationSinceLocked()).isNull(); @@ -145,7 +145,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void create_and_acquire_semaphore_when_no_timeout() throws Exception { + public void create_and_acquire_semaphore_when_no_timeout() { Semaphores.Semaphore lock = dao.acquire("foo"); assertThat(lock.isLocked()).isTrue(); assertThat(lock.getDurationSinceLocked()).isNull(); @@ -162,7 +162,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void fail_to_acquire_locked_semaphore() throws Exception { + public void fail_to_acquire_locked_semaphore() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo", Integer.MAX_VALUE); assertThat(lock.isLocked()).isFalse(); @@ -177,7 +177,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void acquire_long_locked_semaphore() throws Exception { + public void acquire_long_locked_semaphore() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo", 60); assertThat(lock.isLocked()).isTrue(); @@ -192,7 +192,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void acquire_locked_semaphore_when_timeout_is_zero() throws Exception { + public void acquire_locked_semaphore_when_timeout_is_zero() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo", 0); assertThat(lock.isLocked()).isTrue(); @@ -210,7 +210,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void fail_to_acquire_locked_semaphore_when_no_timeout() throws Exception { + public void fail_to_acquire_locked_semaphore_when_no_timeout() { setupData("old_semaphore"); Semaphores.Semaphore lock = dao.acquire("foo"); assertThat(lock.isLocked()).isFalse(); @@ -225,7 +225,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } @Test - public void should_select_semaphore_return_current_semaphore_when_acquiring() throws Exception { + public void should_select_semaphore_return_current_semaphore_when_acquiring() { dao.acquire("foo"); SemaphoreDto semaphore = selectSemaphore("foo"); @@ -255,7 +255,7 @@ public class SemaphoreDaoTest extends AbstractDaoTestCase { } } - private SemaphoreDto selectSemaphore(String name) throws Exception { + private SemaphoreDto selectSemaphore(String name) { SqlSession session = getMyBatis().openSession(); try { return dao.selectSemaphore(name, session); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java index d6f36fcc77c..170d5d59c2e 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/SemaphoreUpdaterTest.java @@ -66,7 +66,7 @@ public class SemaphoreUpdaterTest extends AbstractDaoTestCase { } @Test - public void shouldNotFailWhenCancelNotExistingSemaphore() throws Exception { + public void shouldNotFailWhenCancelNotExistingSemaphore() { updater.stopUpdate("foo"); } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java index ae6f853a60b..e187c55b4b8 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/H2Test.java @@ -53,7 +53,7 @@ public class H2Test { } @Test - public void h2_does_not_supportMigration() throws Exception { + public void h2_does_not_supportMigration() { assertThat(dialect.supportsMigration()).isFalse(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java index 33c92f224eb..8719be31490 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MsSqlTest.java @@ -51,7 +51,7 @@ public class MsSqlTest { } @Test - public void msSql_does_supportMigration() throws Exception { + public void msSql_does_supportMigration() { assertThat(msSql.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java index 6694d035f68..b9d9990f8e8 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/MySqlTest.java @@ -57,7 +57,7 @@ public class MySqlTest { } @Test - public void mysql_does_supportMigration() throws Exception { + public void mysql_does_supportMigration() { assertThat(mySql.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java index b3710e9f27e..4b91a15a040 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/OracleTest.java @@ -54,7 +54,7 @@ public class OracleTest { } @Test - public void oracle_does_supportMigration() throws Exception { + public void oracle_does_supportMigration() { assertThat(dialect.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java index 61a71212ac1..c6b437dc3bf 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSqlTest.java @@ -59,7 +59,7 @@ public class PostgreSqlTest { } @Test - public void postgres_does_supportMigration() throws Exception { + public void postgres_does_supportMigration() { assertThat(dialect.supportsMigration()).isTrue(); } } diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java index 9fbdfbd7845..16f58339d03 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/profiling/InvocationUtilsTest.java @@ -70,7 +70,7 @@ public class InvocationUtilsTest { } @Test - public void only_static_methods() throws Exception { + public void only_static_methods() { assertThat(TestUtils.hasOnlyPrivateConstructors(InvocationUtils.class)).isTrue(); } diff --git a/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java b/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java index bbf91377797..d9b3ada4254 100644 --- a/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java +++ b/sonar-core/src/test/java/org/sonar/core/plugins/PluginClassloadersTest.java @@ -61,7 +61,7 @@ public class PluginClassloadersTest { } @Test - public void shouldImport() throws Exception { + public void shouldImport() { classloaders.add(DefaultPluginMetadata.create("foo").addDeployedFile(getFile("PluginClassloadersTest/foo.jar"))); classloaders.add(DefaultPluginMetadata.create("bar").addDeployedFile(getFile("PluginClassloadersTest/bar.jar"))); classloaders.done(); diff --git a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java index 3b20680b2dc..908003b855e 100644 --- a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java @@ -51,7 +51,7 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -106,7 +106,7 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @Test - public void hasNotificationSubscribers() throws Exception { + public void hasNotificationSubscribers() { setupData("findNotificationSubscribers"); // Nobody is subscribed @@ -175,7 +175,7 @@ public class PropertiesDaoTest extends AbstractDaoTestCase { } @Test - public void select_module_properties_tree() throws Exception { + public void select_module_properties_tree() { setupData("select_module_properties_tree"); List<PropertyDto> properties = dao.selectEnabledDescendantModuleProperties("ABCD", session); diff --git a/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java index c4ce1c89af7..9a0605a2ee9 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/IdUuidPairsTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class IdUuidPairsTest { @Test - public void extract_ids() throws Exception { + public void extract_ids() { List<IdUuidPair> idUuidPairList = Lists.newArrayList(new IdUuidPair(1L, "ABCD"), new IdUuidPair(2L, "EFGH")); List<Long> ids = IdUuidPairs.ids(idUuidPairList); @@ -39,7 +39,7 @@ public class IdUuidPairsTest { } @Test - public void is_non_instantiable() throws Exception { + public void is_non_instantiable() { assertThat(TestUtils.hasOnlyPrivateConstructors(IdUuidPairs.class)).isTrue(); } diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java index 71dc8567ba1..b78687ff1d0 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeConfigurationTest.java @@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class PurgeConfigurationTest { @Test - public void should_delete_all_closed_issues() throws Exception { + public void should_delete_all_closed_issues() { PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 0); assertThat(conf.maxLiveDateOfClosedIssues()).isNull(); @@ -37,7 +37,7 @@ public class PurgeConfigurationTest { } @Test - public void should_delete_only_old_closed_issues() throws Exception { + public void should_delete_only_old_closed_issues() { Date now = DateUtils.parseDate("2013-05-18"); PurgeConfiguration conf = new PurgeConfiguration(new IdUuidPair(1L, "1"), new String[0], 30); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java index 2ca41dc05c5..1be6ad63dd3 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDaoTest.java @@ -38,7 +38,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void select_all_projects_by_query() throws Exception { + public void select_all_projects_by_query() { setupData("shared"); ProjectQgateAssociationQuery query = ProjectQgateAssociationQuery.builder().gateId("42").build(); @@ -47,7 +47,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void select_projects_by_query() throws Exception { + public void select_projects_by_query() { setupData("shared"); assertThat(dao.selectProjects(ProjectQgateAssociationQuery.builder().gateId("42").membership(ProjectQgateAssociationQuery.IN).build(), 42L)).hasSize(3); @@ -55,7 +55,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void search_by_project_name() throws Exception { + public void search_by_project_name() { setupData("shared"); List<ProjectQgateAssociationDto> result = dao.selectProjects(ProjectQgateAssociationQuery.builder().gateId("42").projectSearch("one").build(), 42L); @@ -70,7 +70,7 @@ public class ProjectQgateAssociationDaoTest extends AbstractDaoTestCase { } @Test - public void should_be_sorted_by_project_name() throws Exception { + public void should_be_sorted_by_project_name() { setupData("shared"); List<ProjectQgateAssociationDto> result = dao.selectProjects(ProjectQgateAssociationQuery.builder().gateId("42").build(), 42L); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java index 98cd26c1874..e5213a74319 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ProjectQgateAssociationDtoTest { @Test - public void to_assoc_with_project_having_assoc() throws Exception { + public void to_assoc_with_project_having_assoc() { ProjectQgateAssociation project = new ProjectQgateAssociationDto() .setId(1L) .setName("polop") @@ -40,7 +40,7 @@ public class ProjectQgateAssociationDtoTest { } @Test - public void to_assoc_with_project_not_having_assoc() throws Exception { + public void to_assoc_with_project_not_having_assoc() { ProjectQgateAssociation project = new ProjectQgateAssociationDto() .setId(1L) .setName("polop") diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java index 6269c92139c..0a08efecac9 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/ProjectQgateAssociationQueryTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class ProjectQgateAssociationQueryTest { @Test - public void fail_on_null_login() throws Exception { + public void fail_on_null_login() { ProjectQgateAssociationQuery.Builder builder = ProjectQgateAssociationQuery.builder(); builder.gateId(null); @@ -41,7 +41,7 @@ public class ProjectQgateAssociationQueryTest { } @Test - public void fail_on_invalid_membership() throws Exception { + public void fail_on_invalid_membership() { ProjectQgateAssociationQuery.Builder builder = ProjectQgateAssociationQuery.builder(); builder.gateId("nelson"); builder.membership("unknwown"); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java index 6ca42061c5b..7402e5c3456 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateConditionDaoTest.java @@ -34,7 +34,7 @@ public class QualityGateConditionDaoTest extends AbstractDaoTestCase { private static QualityGateConditionDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new QualityGateConditionDao(getMyBatis()); } @@ -84,7 +84,7 @@ public class QualityGateConditionDaoTest extends AbstractDaoTestCase { checkTable("update", "quality_gate_conditions", COLUMNS_WITHOUT_TIMESTAMPS); } - public void shouldCleanConditions() throws Exception { + public void shouldCleanConditions() { setupData("shouldCleanConditions"); dao.deleteConditionsWithInvalidMetrics(); checkTables("shouldCleanConditions", "quality_gate_conditions"); diff --git a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java index e5dd4364e58..a7ac27d5286 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualitygate/db/QualityGateDaoTest.java @@ -33,7 +33,7 @@ public class QualityGateDaoTest extends AbstractDaoTestCase { private static QualityGateDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new QualityGateDao(getMyBatis()); } diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java index 89c2970dba1..f2c1ddbf51b 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleKeyTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class ActiveRuleKeyTest { @Test - public void of() throws Exception { + public void of() { RuleKey ruleKey = RuleKey.of("xoo", "R1"); ActiveRuleKey key = ActiveRuleKey.of("P1", ruleKey); assertThat(key.qProfile()).isEqualTo("P1"); @@ -37,7 +37,7 @@ public class ActiveRuleKeyTest { } @Test - public void rule_key_can_contain_colons() throws Exception { + public void rule_key_can_contain_colons() { RuleKey ruleKey = RuleKey.of("squid", "Key:With:Some::Colons"); ActiveRuleKey key = ActiveRuleKey.of("P1", ruleKey); assertThat(key.qProfile()).isEqualTo("P1"); @@ -46,7 +46,7 @@ public class ActiveRuleKeyTest { } @Test - public void profile_must_not_be_null() throws Exception { + public void profile_must_not_be_null() { try { ActiveRuleKey.of(null, RuleKey.of("xoo", "R1")); fail(); @@ -56,7 +56,7 @@ public class ActiveRuleKeyTest { } @Test - public void rule_key_must_not_be_null() throws Exception { + public void rule_key_must_not_be_null() { try { ActiveRuleKey.of("P1", null); fail(); @@ -66,7 +66,7 @@ public class ActiveRuleKeyTest { } @Test - public void parse() throws Exception { + public void parse() { ActiveRuleKey key = ActiveRuleKey.parse("P1:xoo:R1"); assertThat(key.qProfile()).isEqualTo("P1"); assertThat(key.ruleKey().repository()).isEqualTo("xoo"); @@ -74,7 +74,7 @@ public class ActiveRuleKeyTest { } @Test - public void parse_fail_when_less_than_three_colons() throws Exception { + public void parse_fail_when_less_than_three_colons() { try { ActiveRuleKey.parse("P1:xoo"); fail(); @@ -84,7 +84,7 @@ public class ActiveRuleKeyTest { } @Test - public void equals_and_hashcode() throws Exception { + public void equals_and_hashcode() { ActiveRuleKey key1 = ActiveRuleKey.parse("P1:xoo:R1"); ActiveRuleKey key1b = ActiveRuleKey.parse("P1:xoo:R1"); ActiveRuleKey key2 = ActiveRuleKey.parse("P1:xoo:R2"); diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java index c8238bb7740..d930967fd12 100644 --- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/ActiveRuleParamDtoTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ActiveRuleParamDtoTest { @Test - public void groupByKey() throws Exception { + public void groupByKey() { assertThat(ActiveRuleParamDto.groupByKey(Collections.<ActiveRuleParamDto>emptyList())).isEmpty(); Collection<ActiveRuleParamDto> dtos = Arrays.asList( diff --git a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java index 2a8c5bcbccc..a3f75efac0b 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java @@ -62,7 +62,7 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -224,7 +224,7 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase { } @Test - public void should_fail_when_no_default_template_is_defined() throws Exception { + public void should_fail_when_no_default_template_is_defined() { throwable.expect(IllegalStateException.class); permissions.grantDefaultRoles(project); diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java index cb3f32dff32..c154a7c0e80 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java @@ -59,7 +59,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -291,7 +291,7 @@ public class ResourceDaoTest extends AbstractDaoTestCase { } @Test - public void should_insert_using_existing_session() throws Exception { + public void should_insert_using_existing_session() { setupData("insert"); ResourceDto file1 = new ResourceDto().setUuid("ABCD") diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java index fe0d55bd040..227d0925cbb 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceKeyUpdaterDaoTest.java @@ -89,7 +89,7 @@ public class ResourceKeyUpdaterDaoTest extends AbstractDaoTestCase { } @Test - public void shouldNotUpdateAllSubmodules() throws Exception { + public void shouldNotUpdateAllSubmodules() { setupData("shouldNotUpdateAllSubmodules"); dao.bulkUpdateKey(1, "org.struts", "org.apache.struts"); diff --git a/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java index 6794e0e47f1..b6e59773e8c 100644 --- a/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java @@ -33,12 +33,12 @@ public class RuleDaoTest extends AbstractDaoTestCase { private static RuleDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new RuleDao(getMyBatis()); } @Test - public void select_enables_and_non_manual() throws Exception { + public void select_enables_and_non_manual() { setupData("select_enables_and_non_manual"); List<RuleDto> ruleDtos = dao.selectEnablesAndNonManual(); @@ -63,7 +63,7 @@ public class RuleDaoTest extends AbstractDaoTestCase { } @Test - public void select_parameters() throws Exception { + public void select_parameters() { setupData("selectParameters"); List<RuleParamDto> ruleDtos = dao.selectParameters(); diff --git a/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java b/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java index 4c35513a294..a9c08b44a17 100644 --- a/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/source/db/FileSourceDtoTest.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class FileSourceDtoTest { @Test - public void encode_and_decode_test_data() throws Exception { + public void encode_and_decode_test_data() { List<FileSourceDb.Test> tests = Arrays.asList( FileSourceDb.Test.newBuilder() .setName("name#1") diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java index f0a97767e0e..3ea3a311fda 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModelTest.java @@ -34,7 +34,7 @@ public class DefaultTechnicalDebtModelTest { private DefaultTechnicalDebtModel sqaleModel; @Before - public void setUp() throws Exception { + public void setUp() { DefaultDebtModel debtModel = new DefaultDebtModel(); debtModel.addCharacteristic( new DefaultDebtCharacteristic().setId(1) @@ -53,7 +53,7 @@ public class DefaultTechnicalDebtModelTest { } @Test - public void get_characteristics() throws Exception { + public void get_characteristics() { assertThat(sqaleModel.rootCharacteristics()).hasSize(1); DefaultCharacteristic resultRootCharacteristic = sqaleModel.rootCharacteristics().get(0); @@ -67,7 +67,7 @@ public class DefaultTechnicalDebtModelTest { } @Test - public void get_characteristic_by_key() throws Exception { + public void get_characteristic_by_key() { assertThat(sqaleModel.characteristicByKey("MEMORY_EFFICIENCY")).isNotNull(); assertThat(sqaleModel.characteristicByKey("EFFICIENCY")).isNotNull(); assertThat(sqaleModel.characteristicByKey("EFFICIENCY").parent()).isNotNull(); @@ -76,24 +76,24 @@ public class DefaultTechnicalDebtModelTest { } @Test - public void characteristic_by_id() throws Exception { + public void characteristic_by_id() { assertThat(sqaleModel.characteristicById(1)).isNotNull(); assertThat(sqaleModel.characteristicById(2)).isNotNull(); assertThat(sqaleModel.characteristicById(123)).isNull(); } @Test - public void get_requirement_by_rule_key_always_return_null() throws Exception { + public void get_requirement_by_rule_key_always_return_null() { assertThat(sqaleModel.requirementsByRule(RuleKey.of("checkstyle", "Regexp"))).isNull(); } @Test - public void get_requirement_by_id_always_return_null() throws Exception { + public void get_requirement_by_id_always_return_null() { assertThat(sqaleModel.requirementsById(1)).isNull(); } @Test - public void get_requirements_always_return_empty_list() throws Exception { + public void get_requirements_always_return_empty_list() { assertThat(sqaleModel.requirements()).isEmpty(); } diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java index fa86283adf7..1289e38132c 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDaoTest.java @@ -172,7 +172,7 @@ public class CharacteristicDaoTest extends AbstractDaoTestCase { } @Test - public void insert_characteristic() throws Exception { + public void insert_characteristic() { CharacteristicDto dto = new CharacteristicDto() .setKey("COMPILER_RELATED_PORTABILITY") .setName("Compiler related portability") @@ -186,7 +186,7 @@ public class CharacteristicDaoTest extends AbstractDaoTestCase { } @Test - public void update_characteristic() throws Exception { + public void update_characteristic() { setupData("update_characteristic"); CharacteristicDto dto = new CharacteristicDto() diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java index 28b278d2e0b..8d66dd657bc 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/db/CharacteristicDtoTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class CharacteristicDtoTest { @Test - public void to_dto_from_characteristic() throws Exception { + public void to_dto_from_characteristic() { DefaultCharacteristic rootCharacteristic = new DefaultCharacteristic() .setId(1) .setKey("MEMORY_EFFICIENCY") @@ -57,7 +57,7 @@ public class CharacteristicDtoTest { } @Test - public void to_characteristic() throws Exception { + public void to_characteristic() { DefaultCharacteristic rootCharacteristic = new DefaultCharacteristic() .setId(1) .setKey("MEMORY_EFFICIENCY") diff --git a/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java b/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java index 63050f1e1a2..c4ecf345a32 100644 --- a/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/template/LoadedTemplateDaoTest.java @@ -31,12 +31,12 @@ public class LoadedTemplateDaoTest extends AbstractDaoTestCase { private LoadedTemplateDao dao; @Before - public void createDao() throws Exception { + public void createDao() { dao = new LoadedTemplateDao(getMyBatis()); } @Test - public void shouldCountByTypeAndKey() throws Exception { + public void shouldCountByTypeAndKey() { setupData("shouldCountByTypeAndKey"); assertThat(dao.countByTypeAndKey("DASHBOARD", "HOTSPOTS"), is(1)); assertThat(dao.countByTypeAndKey("DASHBOARD", "UNKNOWN"), is(0)); @@ -44,7 +44,7 @@ public class LoadedTemplateDaoTest extends AbstractDaoTestCase { } @Test - public void shouldInsert() throws Exception { + public void shouldInsert() { setupData("shouldInsert"); LoadedTemplateDto template = new LoadedTemplateDto("SQALE", "DASHBOARD"); diff --git a/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java index 8b547471fe2..3d9fe278bb3 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/AuthorDaoTest.java @@ -68,7 +68,7 @@ public class AuthorDaoTest extends AbstractDaoTestCase { } @Test - public void shouldInsertAuthorAndDeveloper() throws Exception { + public void shouldInsertAuthorAndDeveloper() { setupData("shouldInsertAuthorAndDeveloper"); String login = "developer@company.net"; @@ -82,7 +82,7 @@ public class AuthorDaoTest extends AbstractDaoTestCase { } @Test - public void add_missing_module_uuid_path() throws Exception { + public void add_missing_module_uuid_path() { setupData("add_missing_module_uuid_path"); dao.insertAuthorAndDeveloper("developer@company.net", new ResourceDto().setName("developer@company.net").setQualifier("DEV").setUuid("ABCD").setProjectUuid("ABCD") @@ -109,7 +109,7 @@ public class AuthorDaoTest extends AbstractDaoTestCase { } @Test - public void shouldPreventAuthorsAndDevelopersDuplication() throws Exception { + public void shouldPreventAuthorsAndDevelopersDuplication() { setupData("shouldPreventAuthorsAndDevelopersDuplication"); String login = "developer@company.net"; diff --git a/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java index 3389d1f6204..1390d638c0b 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/AuthorizationDaoTest.java @@ -43,13 +43,13 @@ public class AuthorizationDaoTest extends AbstractDaoTestCase { AuthorizationDao authorization; @Before - public void setUp() throws Exception { + public void setUp() { session = getMyBatis().openSession(false); authorization = new AuthorizationDao(getMyBatis()); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -286,7 +286,7 @@ public class AuthorizationDaoTest extends AbstractDaoTestCase { } @Test - public void should_return_global_permissions_for_group_anyone() throws Exception { + public void should_return_global_permissions_for_group_anyone() { setupData("should_return_global_permissions_for_group_anyone"); assertThat(authorization.selectGlobalPermissions("anyone_user")).containsOnly("user", "profileadmin"); diff --git a/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java b/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java index 55da48e5823..125f6e2d7e1 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/DefaultUserFinderTest.java @@ -34,7 +34,7 @@ public class DefaultUserFinderTest { DefaultUserFinder finder = new DefaultUserFinder(dao); @Test - public void findByLogin() throws Exception { + public void findByLogin() { UserDto dto = new UserDto().setLogin("david").setName("David").setEmail("dav@id.com"); when(dao.selectActiveUserByLogin("david")).thenReturn(dto); @@ -42,7 +42,7 @@ public class DefaultUserFinderTest { } @Test - public void findByLogins() throws Exception { + public void findByLogins() { UserDto david = new UserDto().setLogin("david").setName("David").setEmail("dav@id.com"); UserDto john = new UserDto().setLogin("john").setName("John").setEmail("jo@hn.com"); when(dao.selectUsersByLogins(Arrays.asList("david", "john"))).thenReturn(Arrays.asList(david, john)); @@ -55,7 +55,7 @@ public class DefaultUserFinderTest { } @Test - public void findByQuery() throws Exception { + public void findByQuery() { UserQuery query = UserQuery.builder().logins("simon").build(); finder.find(query); verify(dao).selectUsers(query); diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java index 47f9fbd71aa..41434d92e6c 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GroupDtoTest { @Test - public void getter_and_setter() throws Exception { + public void getter_and_setter() { GroupDto dto = new GroupDto() .setId(1L) .setName("sonar-users") diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java index ea1fd3bdd5a..d6cb76d9dcf 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDaoTest.java @@ -47,7 +47,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_all_groups_by_query() throws Exception { + public void select_all_groups_by_query() { dbTester.prepareDbUnit(getClass(), "shared.xml"); GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").build(); @@ -56,7 +56,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_user_group() throws Exception { + public void select_user_group() { dbTester.prepareDbUnit(getClass(), "select_user_group.xml"); GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").build(); @@ -71,7 +71,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_user_groups_by_query() throws Exception { + public void select_user_groups_by_query() { dbTester.prepareDbUnit(getClass(), "shared.xml"); // 200 is member of 3 groups @@ -83,7 +83,7 @@ public class GroupMembershipDaoTest { } @Test - public void select_groups_not_affected_to_a_user_by_query() throws Exception { + public void select_groups_not_affected_to_a_user_by_query() { dbTester.prepareDbUnit(getClass(), "shared.xml"); // 200 is member of 3 groups @@ -95,7 +95,7 @@ public class GroupMembershipDaoTest { } @Test - public void search_by_group_name() throws Exception { + public void search_by_group_name() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List<GroupMembershipDto> result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").groupSearch("user").build(), 200L); @@ -108,7 +108,7 @@ public class GroupMembershipDaoTest { } @Test - public void search_by_group_name_with_capitalization() throws Exception { + public void search_by_group_name_with_capitalization() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List<GroupMembershipDto> result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").groupSearch("UsER").build(), 200L); @@ -121,7 +121,7 @@ public class GroupMembershipDaoTest { } @Test - public void should_be_sorted_by_group_name() throws Exception { + public void should_be_sorted_by_group_name() { dbTester.prepareDbUnit(getClass(), "should_be_sorted_by_group_name.xml"); List<GroupMembershipDto> result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").build(), 200L); @@ -132,7 +132,7 @@ public class GroupMembershipDaoTest { } @Test - public void should_be_paginated() throws Exception { + public void should_be_paginated() { dbTester.prepareDbUnit(getClass(), "shared.xml"); List<GroupMembershipDto> result = dao.selectGroups(GroupMembershipQuery.builder().login("arthur").build(), 200L, 0, 2); @@ -151,7 +151,7 @@ public class GroupMembershipDaoTest { } @Test - public void count_groups() throws Exception { + public void count_groups() { dbTester.prepareDbUnit(getClass(), "shared.xml"); DbSession session = dbTester.myBatis().openSession(false); diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java index f4825d7441e..a5148779db0 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipDtoTest.java @@ -27,7 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class GroupMembershipDtoTest { @Test - public void to_group_with_permission_having_permission() throws Exception { + public void to_group_with_permission_having_permission() { GroupMembership group = new GroupMembershipDto() .setId(1L) .setName("users") @@ -42,7 +42,7 @@ public class GroupMembershipDtoTest { } @Test - public void to_group_with_permission_not_having_permission() throws Exception { + public void to_group_with_permission_not_having_permission() { GroupMembership group = new GroupMembershipDto() .setId(1L) .setName("users") diff --git a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java index 393e9288fb5..8478c83c10b 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/GroupMembershipQueryTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; public class GroupMembershipQueryTest { @Test - public void fail_on_null_login() throws Exception { + public void fail_on_null_login() { GroupMembershipQuery.Builder builder = GroupMembershipQuery.builder(); builder.login(null); @@ -41,7 +41,7 @@ public class GroupMembershipQueryTest { } @Test - public void fail_on_invalid_membership() throws Exception { + public void fail_on_invalid_membership() { GroupMembershipQuery.Builder builder = GroupMembershipQuery.builder(); builder.login("nelson"); builder.membership("unknwown"); diff --git a/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java index d3f0051d8ee..932f25c874a 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java @@ -38,18 +38,18 @@ public class RoleDaoTest extends AbstractDaoTestCase { RoleDao dao; @Before - public void setUp() throws Exception { + public void setUp() { session = getMyBatis().openSession(false); dao = new RoleDao(); } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @Test - public void retrieve_global_user_permissions() throws Exception { + public void retrieve_global_user_permissions() { setupData("globalUserPermissions"); assertThat(dao.selectUserPermissions(session, "admin_user", null)).containsOnly(GlobalPermissions.SYSTEM_ADMIN, GlobalPermissions.QUALITY_PROFILE_ADMIN); @@ -57,7 +57,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void retrieve_resource_user_permissions() throws Exception { + public void retrieve_resource_user_permissions() { setupData("resourceUserPermissions"); assertThat(dao.selectUserPermissions(session, "admin_user", 1L)).containsOnly(UserRole.ADMIN, UserRole.USER); @@ -65,7 +65,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void retrieve_global_group_permissions() throws Exception { + public void retrieve_global_group_permissions() { setupData("globalGroupPermissions"); assertThat(dao.selectGroupPermissions(session, "sonar-administrators", null)).containsOnly(GlobalPermissions.SYSTEM_ADMIN, GlobalPermissions.QUALITY_PROFILE_ADMIN, @@ -77,7 +77,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void retrieve_resource_group_permissions() throws Exception { + public void retrieve_resource_group_permissions() { setupData("resourceGroupPermissions"); assertThat(dao.selectGroupPermissions(session, "sonar-administrators", 1L)).containsOnly(UserRole.ADMIN, UserRole.CODEVIEWER); @@ -85,7 +85,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_global_user_permission() throws Exception { + public void delete_global_user_permission() { setupData("globalUserPermissions"); UserRoleDto userRoleToDelete = new UserRoleDto().setUserId(200L).setRole(GlobalPermissions.QUALITY_PROFILE_ADMIN); @@ -97,7 +97,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_resource_user_permission() throws Exception { + public void delete_resource_user_permission() { setupData("resourceUserPermissions"); UserRoleDto userRoleToDelete = new UserRoleDto().setUserId(200L).setRole(UserRole.USER).setResourceId(1L); @@ -109,7 +109,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_global_group_permission() throws Exception { + public void delete_global_group_permission() { setupData("globalGroupPermissions"); GroupRoleDto groupRoleToDelete = new GroupRoleDto().setGroupId(100L).setRole(GlobalPermissions.QUALITY_PROFILE_ADMIN); @@ -121,7 +121,7 @@ public class RoleDaoTest extends AbstractDaoTestCase { } @Test - public void delete_resource_group_permission() throws Exception { + public void delete_resource_group_permission() { setupData("resourceGroupPermissions"); GroupRoleDto groupRoleToDelete = new GroupRoleDto().setGroupId(100L).setRole(UserRole.CODEVIEWER).setResourceId(1L); diff --git a/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java index 92150278869..c1d92ffd452 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/UserDaoTest.java @@ -53,7 +53,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @After - public void tearDown() throws Exception { + public void tearDown() { session.close(); } @@ -77,7 +77,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByLogins() throws Exception { + public void selectUsersByLogins() { setupData("selectUsersByLogins"); Collection<UserDto> users = dao.selectUsersByLogins(Arrays.asList("marius", "inactive_user", "other")); @@ -86,14 +86,14 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByLogins_empty_logins() throws Exception { + public void selectUsersByLogins_empty_logins() { // no need to access db Collection<UserDto> users = dao.selectUsersByLogins(Collections.<String>emptyList()); assertThat(users).isEmpty(); } @Test - public void selectUsersByQuery_all() throws Exception { + public void selectUsersByQuery_all() { setupData("selectUsersByQuery"); UserQuery query = UserQuery.builder().includeDeactivated().build(); @@ -102,7 +102,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_only_actives() throws Exception { + public void selectUsersByQuery_only_actives() { setupData("selectUsersByQuery"); UserQuery query = UserQuery.ALL_ACTIVES; @@ -112,7 +112,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_filter_by_login() throws Exception { + public void selectUsersByQuery_filter_by_login() { setupData("selectUsersByQuery"); UserQuery query = UserQuery.builder().logins("marius", "john").build(); @@ -122,7 +122,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_search_by_login_text() throws Exception { + public void selectUsersByQuery_search_by_login_text() { setupData("selectUsersByText"); UserQuery query = UserQuery.builder().searchText("sbr").build(); @@ -132,7 +132,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_search_by_name_text() throws Exception { + public void selectUsersByQuery_search_by_name_text() { setupData("selectUsersByText"); UserQuery query = UserQuery.builder().searchText("Simon").build(); @@ -142,7 +142,7 @@ public class UserDaoTest extends AbstractDaoTestCase { } @Test - public void selectUsersByQuery_escape_special_characters_in_like() throws Exception { + public void selectUsersByQuery_escape_special_characters_in_like() { setupData("selectUsersByText"); UserQuery query = UserQuery.builder().searchText("%s%").build(); diff --git a/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java b/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java index 23150850e60..ca2ce0601bd 100644 --- a/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/user/UserDtoTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class UserDtoTest { @Test - public void encode_scm_accounts() throws Exception { + public void encode_scm_accounts() { assertThat(UserDto.encodeScmAccounts(null)).isNull(); assertThat(UserDto.encodeScmAccounts(Collections.<String>emptyList())).isNull(); assertThat(UserDto.encodeScmAccounts(Arrays.asList("foo"))).isEqualTo("\nfoo\n"); @@ -37,7 +37,7 @@ public class UserDtoTest { } @Test - public void decode_scm_accounts() throws Exception { + public void decode_scm_accounts() { assertThat(UserDto.decodeScmAccounts(null)).isEmpty(); assertThat(UserDto.decodeScmAccounts("\nfoo\n")).containsOnly("foo"); assertThat(UserDto.decodeScmAccounts("\nfoo\nbar\n")).containsOnly("foo", "bar"); diff --git a/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java b/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java index c7f40b0c83b..9f5109a36b3 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/MultiSetsTest.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class MultiSetsTest { @Test - public void order_with_highest_count_first() throws Exception { + public void order_with_highest_count_first() { Multiset<String> multiset = HashMultiset.create(); add(multiset, "seneca", 10); add(multiset, "plato", 5); diff --git a/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java b/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java index 45f4ae03548..100ab15cce3 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/NonNullInputFunctionTest.java @@ -29,7 +29,7 @@ public class NonNullInputFunctionTest { NonNullInputFunction<String, Integer> sut = new TestFunction(); @Test - public void fail_if_null_input() throws Exception { + public void fail_if_null_input() { try { sut.apply(null); fail(); @@ -39,7 +39,7 @@ public class NonNullInputFunctionTest { } @Test - public void apply() throws Exception { + public void apply() { assertThat(sut.apply("foo")).isEqualTo(3); } diff --git a/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java b/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java index b9a58a2605b..d525fe3c7c6 100644 --- a/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/jpa/dao/MeasuresDaoTest.java @@ -38,7 +38,7 @@ public class MeasuresDaoTest extends AbstractDbUnitTestCase { private ResourceModel project; @Before - public void before() throws Exception { + public void before() { service = new MeasuresDao(getSession()); project = new ResourceModel(ResourceModel.SCOPE_PROJECT, "foo:bar", ResourceModel.QUALIFIER_PROJECT_TRUNK, null, "Foo"); project.setName("project name"); diff --git a/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java b/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java index af7ba9655af..b3d0c14da46 100644 --- a/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java +++ b/sonar-core/src/test/java/org/sonar/jpa/session/DatabaseSessionTest.java @@ -50,7 +50,7 @@ public class DatabaseSessionTest extends AbstractDbUnitTestCase { } @Test - public void performanceTestOnBatchInserts() throws Exception { + public void performanceTestOnBatchInserts() { getSession().save(project1); Snapshot snapshot = new Snapshot(project1, true, "", new Date(1)); getSession().save(snapshot); |