DraftChangeIT: Simplify throws clauses
Declare methods in tests as throwing Exception rather than specific exception types. This also removes a couple of declarations of exception types that are not actually thrown and cause warnings in Eclipse. Change-Id: Ib62470d5df90f15b8743e73e191a00d18f6f5d51
This commit is contained in:
@@ -37,14 +37,11 @@ import com.google.gerrit.extensions.restapi.AuthException;
|
|||||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gerrit.server.git.BatchUpdate;
|
import com.google.gerrit.server.git.BatchUpdate;
|
||||||
import com.google.gerrit.server.git.UpdateException;
|
|
||||||
import com.google.gerrit.server.notedb.PatchSetState;
|
import com.google.gerrit.server.notedb.PatchSetState;
|
||||||
import com.google.gerrit.testutil.ConfigSuite;
|
import com.google.gerrit.testutil.ConfigSuite;
|
||||||
import com.google.gwtorm.server.OrmException;
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.Config;
|
import org.eclipse.jgit.lib.Config;
|
||||||
@@ -265,8 +262,7 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
|||||||
+ "/publish");
|
+ "/publish");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markChangeAsDraft(Change.Id id) throws OrmException,
|
private void markChangeAsDraft(Change.Id id) throws Exception {
|
||||||
RestApiException, UpdateException {
|
|
||||||
try (BatchUpdate batchUpdate = updateFactory
|
try (BatchUpdate batchUpdate = updateFactory
|
||||||
.create(db, project, atrScope.get().getUser(), TimeUtil.nowTs())) {
|
.create(db, project, atrScope.get().getUser(), TimeUtil.nowTs())) {
|
||||||
batchUpdate.addOp(id, new MarkChangeAsDraftUpdateOp());
|
batchUpdate.addOp(id, new MarkChangeAsDraftUpdateOp());
|
||||||
@@ -281,8 +277,7 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDraftStatusOfPatchSetsOfChange(Change.Id id,
|
private void setDraftStatusOfPatchSetsOfChange(Change.Id id,
|
||||||
boolean draftStatus) throws OrmException, RestApiException,
|
boolean draftStatus) throws Exception {
|
||||||
UpdateException {
|
|
||||||
try (BatchUpdate batchUpdate = updateFactory
|
try (BatchUpdate batchUpdate = updateFactory
|
||||||
.create(db, project, atrScope.get().getUser(), TimeUtil.nowTs())) {
|
.create(db, project, atrScope.get().getUser(), TimeUtil.nowTs())) {
|
||||||
batchUpdate.addOp(id, new DraftStatusOfPatchSetsUpdateOp(draftStatus));
|
batchUpdate.addOp(id, new DraftStatusOfPatchSetsUpdateOp(draftStatus));
|
||||||
@@ -296,7 +291,7 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<Boolean> getPatchSetDraftStatuses(Change.Id id)
|
private List<Boolean> getPatchSetDraftStatuses(Change.Id id)
|
||||||
throws RestApiException {
|
throws Exception {
|
||||||
Collection<RevisionInfo> revisionInfos = gApi.changes()
|
Collection<RevisionInfo> revisionInfos = gApi.changes()
|
||||||
.id(id.get())
|
.id(id.get())
|
||||||
.get(EnumSet.of(ListChangesOption.ALL_REVISIONS))
|
.get(EnumSet.of(ListChangesOption.ALL_REVISIONS))
|
||||||
|
|||||||
Reference in New Issue
Block a user