Skip to content

Commit

Permalink
FIX Redundant throws clause
Browse files Browse the repository at this point in the history
  • Loading branch information
dgageot committed Jul 7, 2015
1 parent 0159164 commit f0390ff
Show file tree
Hide file tree
Showing 97 changed files with 307 additions and 307 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class QualityGateNotificationTest {
.build();

@Before
public void cleanUp() throws Exception {
public void cleanUp() {
orchestrator.resetData();
}

Expand Down
2 changes: 1 addition & 1 deletion it/it-tests/src/test/java/qualitygate/QualityGateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class QualityGateTest {
.build();

@Before
public void cleanUp() throws Exception {
public void cleanUp() {
orchestrator.resetData();
provisionnedProjectId = Long.parseLong(orchestrator.getServer().adminWsClient().projectClient().create(NewProject.create().key(PROJECT_KEY).name("Sample")).id());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void benchmark() throws Exception {
scrollRows();
}

private void scrollRows() throws Exception {
private void scrollRows() {
LOGGER.info("Scroll table FILE_SOURCES");
AtomicLong counter = new AtomicLong();
ProgressTask progress = new ProgressTask(LOGGER, "source file", counter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ActivityResultSetIteratorTest {
public DbTester dbTester = DbTester.create(System2.INSTANCE);

@Before
public void setUp() throws Exception {
public void setUp() {
dbTester.truncateTables();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class BatchWsModuleTest {
@Test
public void verify_count_of_added_components() throws Exception {
public void verify_count_of_added_components() {
ComponentContainer container = new ComponentContainer();
new BatchWsModule().configure(container);
assertThat(container.size()).isEqualTo(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ public void count_provisioned_projects() {
}

@Test
public void select_ghost_projects() throws Exception {
public void select_ghost_projects() {
db.prepareDbUnit(getClass(), "select_ghost_projects.xml");

List<ComponentDto> result = sut.selectGhostProjects(session, null, new SearchOptions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public class ComputationServiceTest {
ComputationService sut;

@Before
public void setUp() throws IOException {
public void setUp() {
sut = new ComputationService(new ReportQueue.Item(dto, new File("Do_not_care")), steps, activityManager, system);
}

@Test
public void process_new_project() throws Exception {
public void process_new_project() {
logTester.setLevel(LoggerLevel.INFO);

when(steps.instances()).thenReturn(Arrays.asList(projectStep1, projectStep2));
Expand All @@ -85,7 +85,7 @@ public void process_new_project() throws Exception {
}

@Test
public void debug_logs() throws Exception {
public void debug_logs() {
when(steps.instances()).thenReturn(Collections.<ComputationStep>emptyList());
logTester.setLevel(LoggerLevel.DEBUG);

Expand All @@ -95,7 +95,7 @@ public void debug_logs() throws Exception {
}

@Test
public void fail_if_step_throws_error() throws Exception {
public void fail_if_step_throws_error() {
String errorMessage = "Failed to unzip";
when(steps.instances()).thenReturn(ImmutableList.of(projectStep1));
doThrow(new IllegalStateException(errorMessage)).when(projectStep1).execute();
Expand All @@ -111,7 +111,7 @@ public void fail_if_step_throws_error() throws Exception {
}

@Test
public void step_error() throws Exception {
public void step_error() {
when(steps.instances()).thenReturn(Arrays.asList(projectStep1));
doThrow(new IllegalStateException("pb")).when(projectStep1).execute();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void setUp() throws Exception {
}

@After
public void tearDown() throws Exception {
public void tearDown() {
session.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public class ActivityManagerTest {
ActivityManager underTest;

@Before
public void setup() throws Exception {
public void setup() {
dbTester.truncateTables();
DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao());

underTest = new ActivityManager(activityService, dbClient);
}

@Test
public void process_existing_project() throws Exception {
public void process_existing_project() {
dbTester.prepareDbUnit(getClass(), "shared.xml");

underTest.saveActivity(reportDto);
Expand All @@ -72,7 +72,7 @@ public void process_existing_project() throws Exception {
}

@Test
public void process_new_project() throws Exception {
public void process_new_project() {
underTest.saveActivity(reportDto);

// execute only the steps supporting the project qualifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class BatchReportReaderImplTest {
private FileStructure fileStructure;

@Before
public void setUp() throws Exception {
public void setUp() {
BatchReportDirectoryHolder holder = new ImmutableBatchReportDirectoryHolder(tempFolder.newDir());
underTest = new BatchReportReaderImpl(holder);
writer = new BatchReportWriter(holder.getDirectory());
Expand Down Expand Up @@ -257,7 +257,7 @@ public void readTests_returns_empty_CloseableIterator_when_file_does_not_exist()
}

@Test
public void verify_readTests() throws IOException {
public void verify_readTests() {
writer.writeTests(COMPONENT_REF, of(TEST_1, TEST_2));

CloseableIterator<BatchReport.Test> res = underTest.readTests(COMPONENT_REF);
Expand All @@ -271,7 +271,7 @@ public void readCoverageDetails_returns_empty_CloseableIterator_when_file_does_n
}

@Test
public void verify_readCoverageDetails() throws IOException {
public void verify_readCoverageDetails() {
writer.writeCoverageDetails(COMPONENT_REF, of(COVERAGE_DETAIL_1, COVERAGE_DETAIL_2));

CloseableIterator<BatchReport.CoverageDetail> res = underTest.readCoverageDetails(COMPONENT_REF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ public void verify_setKey() {
}

@Test
public void get_name_from_batch_component() throws Exception {
public void get_name_from_batch_component() {
String name = "project";
ComponentImpl component = new ComponentImpl(BatchReport.Component.newBuilder().setName(name).build(), EMPTY_CHILD_LIST);
assertThat(component.getName()).isEqualTo(name);
}

@Test
public void get_version_from_batch_component() throws Exception {
public void get_version_from_batch_component() {
String version = "1.0";
ComponentImpl component = new ComponentImpl(BatchReport.Component.newBuilder().setVersion(version).build(), EMPTY_CHILD_LIST);
assertThat(component.getVersion()).isEqualTo(version);
}

@Test
public void getFileAttributes_throws_ISE_if_BatchComponent_does_not_have_type_FILE() throws Exception {
public void getFileAttributes_throws_ISE_if_BatchComponent_does_not_have_type_FILE() {
for (ComponentType componentType : from(asList(ComponentType.values())).filter(not(equalTo(ComponentType.FILE)))) {
ComponentImpl component = new ComponentImpl(BatchReport.Component.newBuilder().setType(componentType).build(), EMPTY_CHILD_LIST);
try {
Expand All @@ -95,14 +95,14 @@ public void getFileAttributes_throws_ISE_if_BatchComponent_does_not_have_type_FI
}

@Test
public void isUnitTest_returns_true_if_IsTest_is_set_in_BatchComponent() throws Exception {
public void isUnitTest_returns_true_if_IsTest_is_set_in_BatchComponent() {
ComponentImpl component = new ComponentImpl(BatchReport.Component.newBuilder().setType(ComponentType.FILE).setIsTest(true).build(), EMPTY_CHILD_LIST);

assertThat(component.getFileAttributes().isUnitTest()).isTrue();
}

@Test
public void isUnitTest_returns_value_of_language_of_BatchComponent() throws Exception {
public void isUnitTest_returns_value_of_language_of_BatchComponent() {
String languageKey = "some language key";
ComponentImpl component = new ComponentImpl(BatchReport.Component.newBuilder().setType(ComponentType.FILE).setLanguage(languageKey).build(), EMPTY_CHILD_LIST);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,57 +29,57 @@

public class ComponentTest {
@Test
public void verify_type_is_deeper_than_when_comparing_to_itself() throws Exception {
public void verify_type_is_deeper_than_when_comparing_to_itself() {
for (Component.Type type : Component.Type.values()) {
assertThat(type.isDeeperThan(type)).isFalse();
}
}

@Test
public void FILE_type_is_deeper_than_all_other_types() throws Exception {
public void FILE_type_is_deeper_than_all_other_types() {
assertThat(Component.Type.FILE.isDeeperThan(DIRECTORY)).isTrue();
assertThat(Component.Type.FILE.isDeeperThan(MODULE)).isTrue();
assertThat(Component.Type.FILE.isDeeperThan(PROJECT)).isTrue();
}

@Test
public void DIRECTORY_type_is_deeper_than_MODULE_and_PROJECT() throws Exception {
public void DIRECTORY_type_is_deeper_than_MODULE_and_PROJECT() {
assertThat(Component.Type.DIRECTORY.isDeeperThan(MODULE)).isTrue();
assertThat(Component.Type.DIRECTORY.isDeeperThan(PROJECT)).isTrue();
}

@Test
public void MODULE_type_is_deeper_than_PROJECT() throws Exception {
public void MODULE_type_is_deeper_than_PROJECT() {
assertThat(Component.Type.MODULE.isDeeperThan(PROJECT)).isTrue();
}

@Test
public void FILE_type_is_higher_than_no_other_types() throws Exception {
public void FILE_type_is_higher_than_no_other_types() {
assertThat(Component.Type.FILE.isHigherThan(DIRECTORY)).isFalse();
assertThat(Component.Type.FILE.isHigherThan(MODULE)).isFalse();
assertThat(Component.Type.FILE.isHigherThan(PROJECT)).isFalse();
}

@Test
public void DIRECTORY_type_is_higher_than_FILE() throws Exception {
public void DIRECTORY_type_is_higher_than_FILE() {
assertThat(Component.Type.DIRECTORY.isHigherThan(FILE)).isTrue();
}

@Test
public void MODULE_type_is_higher_than_FILE_AND_DIRECTORY() throws Exception {
public void MODULE_type_is_higher_than_FILE_AND_DIRECTORY() {
assertThat(Component.Type.MODULE.isHigherThan(FILE)).isTrue();
assertThat(Component.Type.MODULE.isHigherThan(DIRECTORY)).isTrue();
}

@Test
public void PROJECT_type_is_higher_than_all_other_types() throws Exception {
public void PROJECT_type_is_higher_than_all_other_types() {
assertThat(Component.Type.PROJECT.isHigherThan(FILE)).isTrue();
assertThat(Component.Type.PROJECT.isHigherThan(DIRECTORY)).isTrue();
assertThat(Component.Type.PROJECT.isHigherThan(MODULE)).isTrue();
}

@Test
public void any_type_is_not_higher_than_itself() throws Exception {
public void any_type_is_not_higher_than_itself() {
assertThat(Component.Type.FILE.isHigherThan(FILE)).isFalse();
assertThat(Component.Type.DIRECTORY.isHigherThan(DIRECTORY)).isFalse();
assertThat(Component.Type.MODULE.isHigherThan(MODULE)).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ public class DbIdsRepositoryTest {
Component component = DumbComponent.DUMB_PROJECT;

@Test
public void add_and_get_component_id() throws Exception {
public void add_and_get_component_id() {
DbIdsRepository cache = new DbIdsRepository();
cache.setComponentId(component, 10L);

assertThat(cache.getComponentId(component)).isEqualTo(10L);
}

@Test
public void fail_to_get_component_id_on_unknown_ref() throws Exception {
public void fail_to_get_component_id_on_unknown_ref() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Component ref '" + component.getRef() + "' has no component id");

new DbIdsRepository().getComponentId(DumbComponent.DUMB_PROJECT);
}

@Test
public void fail_if_component_id_already_set() throws Exception {
public void fail_if_component_id_already_set() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Component ref '" + component.getRef() + "' has already a component id");

Expand All @@ -60,23 +60,23 @@ public void fail_if_component_id_already_set() throws Exception {
}

@Test
public void add_and_get_snapshot_id() throws Exception {
public void add_and_get_snapshot_id() {
DbIdsRepository cache = new DbIdsRepository();
cache.setSnapshotId(component, 100L);

assertThat(cache.getSnapshotId(component)).isEqualTo(100L);
}

@Test
public void fail_to_get_snapshot_id_on_unknown_ref() throws Exception {
public void fail_to_get_snapshot_id_on_unknown_ref() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Component ref '" + component.getRef() + "' has no snapshot id");

new DbIdsRepository().getSnapshotId(DumbComponent.DUMB_PROJECT);
}

@Test
public void fail_if_snapshot_id_already_set() throws Exception {
public void fail_if_snapshot_id_already_set() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Component ref '" + component.getRef() + "' has already a snapshot id");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public void createDao() {
}

@After
public void tearDown() throws Exception {
public void tearDown() {
session.close();
}

@Test
public void get_project_settings_from_global_settings() throws Exception {
public void get_project_settings_from_global_settings() {
globalSettings.setProperty("key", "value");

Settings settings = sut.getProjectSettings(PROJECT_KEY);
Expand All @@ -80,7 +80,7 @@ public void get_project_settings_from_global_settings() throws Exception {
}

@Test
public void get_project_settings_from_db() throws Exception {
public void get_project_settings_from_db() {
ComponentDto project = ComponentTesting.newProjectDto().setKey(PROJECT_KEY);
dbClient.componentDao().insert(session, project);
dbClient.propertiesDao().setProperty(new PropertyDto().setResourceId(project.getId()).setKey("key").setValue("value"), session);
Expand All @@ -92,7 +92,7 @@ public void get_project_settings_from_db() throws Exception {
}

@Test
public void call_twice_get_project_settings() throws Exception {
public void call_twice_get_project_settings() {
globalSettings.setProperty("key", "value");

Settings settings = sut.getProjectSettings(PROJECT_KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void verify_setRoot_getRoot() {
}

@Test
public void get_by_ref() throws Exception {
public void get_by_ref() {
Component file = DumbComponent.builder(Component.Type.FILE, 4).build();
Component directory = DumbComponent.builder(Component.Type.DIRECTORY, 3).addChildren(file).build();
Component module = DumbComponent.builder(Component.Type.MODULE, 2).addChildren(directory).build();
Expand All @@ -66,13 +66,13 @@ public void get_by_ref() throws Exception {
}

@Test
public void fail_to_get_by_ref_if_root_not_set() throws Exception {
public void fail_to_get_by_ref_if_root_not_set() {
thrown.expect(IllegalStateException.class);
treeRootHolder.getComponentByRef(project.getRef());
}

@Test
public void fail_to_get_by_ref_if_ref_not_found() throws Exception {
public void fail_to_get_by_ref_if_ref_not_found() {
thrown.expect(IllegalArgumentException.class);
treeRootHolder.setRoot(project);
treeRootHolder.getComponentByRef(123);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void test_equals_and_hashcode() throws Exception {
}

@Test
public void creating_a_new_characteristic_with_null_key_throws_a_NPE() throws Exception {
public void creating_a_new_characteristic_with_null_key_throws_a_NPE() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("key cannot be null");

Expand Down
Loading

0 comments on commit f0390ff

Please sign in to comment.