Throw Exception from tests

The tests should generically throw Exception because they are not invoked by
any client and simply need to declare their checked exception.

Make all existing tests throw a generic Exception so that future changes would
have to deal with less conflicts in the merge-ups.

Change-Id: Ia7c124ab2dc0d826a6dd2825e3a2936def830952
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchGitUpdateProcessingTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchGitUpdateProcessingTest.java
index 77dc947..8ddbd89 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchGitUpdateProcessingTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchGitUpdateProcessingTest.java
@@ -20,11 +20,9 @@
 import static org.mockito.Mockito.verify;
 
 import com.google.gerrit.server.events.EventDispatcher;
-import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.googlesource.gerrit.plugins.replication.pull.FetchResultProcessing.CommandProcessing;
 import com.googlesource.gerrit.plugins.replication.pull.FetchResultProcessing.GitUpdateProcessing;
 import com.googlesource.gerrit.plugins.replication.pull.ReplicationState.RefFetchResult;
-import java.net.URISyntaxException;
 import org.eclipse.jgit.lib.RefUpdate;
 import org.eclipse.jgit.transport.URIish;
 import org.junit.Before;
@@ -45,8 +43,7 @@
   }
 
   @Test
-  public void headRefReplicatedInGitUpdateProcessing()
-      throws URISyntaxException, PermissionBackendException {
+  public void headRefReplicatedInGitUpdateProcessing() throws Exception {
     FetchRefReplicatedEvent expectedEvent =
         new FetchRefReplicatedEvent(
             "someProject",
@@ -65,8 +62,7 @@
   }
 
   @Test
-  public void headRefReplicatedInCommandProcessing()
-      throws URISyntaxException, PermissionBackendException {
+  public void headRefReplicatedInCommandProcessing() throws Exception {
     FetchRefReplicatedEvent expectedEvent =
         new FetchRefReplicatedEvent(
             "someProject",
@@ -85,7 +81,7 @@
   }
 
   @Test
-  public void changeRefReplicated() throws URISyntaxException, PermissionBackendException {
+  public void changeRefReplicated() throws Exception {
     FetchRefReplicatedEvent expectedEvent =
         new FetchRefReplicatedEvent(
             "someProject",
@@ -104,7 +100,7 @@
   }
 
   @Test
-  public void onAllNodesReplicated() throws PermissionBackendException {
+  public void onAllNodesReplicated() throws Exception {
     FetchRefReplicationDoneEvent expectedDoneEvent =
         new FetchRefReplicationDoneEvent("someProject", "refs/heads/master", 5);
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchITBase.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchITBase.java
index 2a11717..0c33df4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchITBase.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchITBase.java
@@ -21,7 +21,6 @@
 import com.google.gerrit.server.config.SitePaths;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.replication.pull.fetch.FetchFactory;
-import java.io.IOException;
 import java.nio.file.Path;
 import java.time.Duration;
 import java.util.function.Supplier;
@@ -50,11 +49,11 @@
     fetchFactory = plugin.getSysInjector().getInstance(FetchFactory.class);
   }
 
-  void waitUntil(Supplier<Boolean> waitCondition) throws InterruptedException {
+  void waitUntil(Supplier<Boolean> waitCondition) throws Exception {
     WaitUtil.waitUntil(waitCondition, TEST_TIMEOUT);
   }
 
-  Ref getRef(Repository repo, String branchName) throws IOException {
+  Ref getRef(Repository repo, String branchName) throws Exception {
     return repo.getRefDatabase().exactRef(branchName);
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchOneTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchOneTest.java
index 817876d..ee286bb 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchOneTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchOneTest.java
@@ -29,7 +29,6 @@
 import com.googlesource.gerrit.plugins.replication.pull.fetch.FetchFactory;
 import com.googlesource.gerrit.plugins.replication.pull.fetch.InexistentRefTransportException;
 import com.googlesource.gerrit.plugins.replication.pull.fetch.RefUpdateState;
-import java.io.IOException;
 import java.util.*;
 import java.util.concurrent.Callable;
 import java.util.stream.Collectors;
@@ -729,7 +728,7 @@
     when(source.requestRunway(any())).thenReturn(allowed);
   }
 
-  private void setupGitRepoManagerMock() throws IOException {
+  private void setupGitRepoManagerMock() throws Exception {
     when(grm.openRepository(PROJECT_NAME)).thenReturn(repository);
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchReplicationTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchReplicationTest.java
index 3257fda..dd1aed8 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchReplicationTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/FetchReplicationTest.java
@@ -19,7 +19,6 @@
 import static com.googlesource.gerrit.plugins.replication.pull.Source.encode;
 import static com.googlesource.gerrit.plugins.replication.pull.Source.needsUrlEncoding;
 
-import java.net.URISyntaxException;
 import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.transport.RemoteConfig;
 import org.eclipse.jgit.transport.URIish;
@@ -28,7 +27,7 @@
 public class FetchReplicationTest {
 
   @Test
-  public void testNeedsUrlEncoding() throws URISyntaxException {
+  public void testNeedsUrlEncoding() throws Exception {
     assertThat(needsUrlEncoding(new URIish("http://host/path"))).isTrue();
     assertThat(needsUrlEncoding(new URIish("https://host/path"))).isTrue();
     assertThat(needsUrlEncoding(new URIish("amazon-s3://config/bucket/path"))).isTrue();
@@ -48,7 +47,7 @@
   }
 
   @Test
-  public void testRefsBatchSizeMustBeGreaterThanZero() throws URISyntaxException {
+  public void testRefsBatchSizeMustBeGreaterThanZero() throws Exception {
     Config cf = new Config();
     cf.setInt("remote", "test_config", "timeout", 0);
     cf.setInt("replication", null, "refsBatchSize", 0);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationFanoutConfigIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationFanoutConfigIT.java
index b9ea0c8..5cf01b1 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationFanoutConfigIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationFanoutConfigIT.java
@@ -30,7 +30,6 @@
 import com.google.gerrit.server.config.SitePaths;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.replication.AutoReloadConfigDecorator;
-import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.time.Duration;
@@ -250,7 +249,7 @@
     waitUntil(() -> sources.getAll().size() == 1);
   }
 
-  private Ref getRef(Repository repo, String branchName) throws IOException {
+  private Ref getRef(Repository repo, String branchName) throws Exception {
     return repo.getRefDatabase().exactRef(branchName);
   }
 
@@ -263,24 +262,24 @@
     }
   }
 
-  private void setReplicationSource(String remoteName) throws IOException {
+  private void setReplicationSource(String remoteName) throws Exception {
     config.setBoolean("gerrit", null, "autoReload", true);
     config.save();
   }
 
-  private void setRemoteConfig(String replicaSuffix, Optional<String> project) throws IOException {
+  private void setRemoteConfig(String replicaSuffix, Optional<String> project) throws Exception {
     setRemoteConfig(remoteConfig, replicaSuffix, project);
   }
 
   private void setRemoteConfig(
       FileBasedConfig remoteConfig, String replicaSuffix, Optional<String> project)
-      throws IOException {
+      throws Exception {
     setRemoteConfig(remoteConfig, Arrays.asList(replicaSuffix), project);
   }
 
   private void setRemoteConfig(
       FileBasedConfig remoteConfig, List<String> replicaSuffixes, Optional<String> project)
-      throws IOException {
+      throws Exception {
     List<String> replicaUrls =
         replicaSuffixes.stream()
             .map(suffix -> gitPath.resolve("${name}" + suffix + ".git").toString())
@@ -295,13 +294,13 @@
   }
 
   private void setReplicationCredentials(String remoteName, String username, String password)
-      throws IOException {
+      throws Exception {
     secureConfig.setString("remote", remoteName, "username", username);
     secureConfig.setString("remote", remoteName, "password", password);
     secureConfig.save();
   }
 
-  private void waitUntil(Supplier<Boolean> waitCondition) throws InterruptedException {
+  private void waitUntil(Supplier<Boolean> waitCondition) throws Exception {
     WaitUtil.waitUntil(waitCondition, TEST_TIMEOUT);
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationITAbstract.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationITAbstract.java
index 58693bc..8e04d5b 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationITAbstract.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationITAbstract.java
@@ -413,7 +413,7 @@
     }
   }
 
-  private void waitUntilReplicationCompleted(int expected) throws InterruptedException {
+  private void waitUntilReplicationCompleted(int expected) throws Exception {
     waitUntil(
         () ->
             inMemoryMetrics()
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationSetupBase.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationSetupBase.java
index e07d481..fea576a 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationSetupBase.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationSetupBase.java
@@ -33,7 +33,6 @@
 import java.util.Optional;
 import java.util.function.Function;
 import java.util.function.Supplier;
-import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.lib.Ref;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.storage.file.FileBasedConfig;
@@ -76,7 +75,7 @@
     super.setUpTestPlugin();
   }
 
-  protected Ref getRef(Repository repo, String branchName) throws IOException {
+  protected Ref getRef(Repository repo, String branchName) throws Exception {
     return repo.getRefDatabase().exactRef(branchName);
   }
 
@@ -90,8 +89,7 @@
   }
 
   protected void setReplicationSource(
-      String remoteName, String replicaSuffix, Optional<String> project)
-      throws IOException, ConfigInvalidException {
+      String remoteName, String replicaSuffix, Optional<String> project) throws Exception {
     setReplicationSource(remoteName, Arrays.asList(replicaSuffix), project);
   }
 
@@ -99,13 +97,13 @@
       String remoteName, List<String> replicaSuffixes, Optional<String> project) throws IOException;
 
   protected void setReplicationCredentials(String remoteName, String username, String password)
-      throws IOException {
+      throws Exception {
     secureConfig.setString("remote", remoteName, "username", username);
     secureConfig.setString("remote", remoteName, "password", password);
     secureConfig.save();
   }
 
-  protected void waitUntil(Supplier<Boolean> waitCondition) throws InterruptedException {
+  protected void waitUntil(Supplier<Boolean> waitCondition) throws Exception {
     WaitUtil.waitUntil(waitCondition, TEST_TIMEOUT);
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationQueueTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationQueueTest.java
index 9dc0b47..1cffec7 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationQueueTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationQueueTest.java
@@ -48,7 +48,6 @@
 import com.googlesource.gerrit.plugins.replication.ReplicationConfig;
 import com.googlesource.gerrit.plugins.replication.ReplicationFileBasedConfig;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionData;
-import com.googlesource.gerrit.plugins.replication.pull.api.exception.RefUpdateException;
 import com.googlesource.gerrit.plugins.replication.pull.client.FetchApiClient;
 import com.googlesource.gerrit.plugins.replication.pull.client.FetchRestApiClient;
 import com.googlesource.gerrit.plugins.replication.pull.client.HttpResult;
@@ -59,8 +58,6 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
-import org.apache.http.client.ClientProtocolException;
-import org.eclipse.jgit.errors.LargeObjectException;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.util.FS;
@@ -111,7 +108,7 @@
   private Path pluginDataPath;
 
   @Before
-  public void setup() throws IOException, LargeObjectException {
+  public void setup() throws Exception {
     Path sitePath = createTempPath("site");
     sitePaths = new SitePaths(sitePath);
     Path pluginDataPath = createTempPath("data");
@@ -180,7 +177,7 @@
   }
 
   @Test
-  public void shouldCallSendObjectWhenMetaRef() throws ClientProtocolException, IOException {
+  public void shouldCallSendObjectWhenMetaRef() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/meta");
     objectUnderTest.start();
     objectUnderTest.onEvent(event);
@@ -189,8 +186,7 @@
   }
 
   @Test
-  public void shouldIgnoreEventWhenIsNotLocalInstanceId()
-      throws ClientProtocolException, IOException {
+  public void shouldIgnoreEventWhenIsNotLocalInstanceId() throws Exception {
     Event event = new TestEvent();
     event.instanceId = FOREIGN_INSTANCE_ID;
     objectUnderTest.start();
@@ -201,7 +197,7 @@
   }
 
   @Test
-  public void shouldCallInitProjectWhenProjectIsMissing() throws IOException {
+  public void shouldCallInitProjectWhenProjectIsMissing() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/meta");
     when(httpResult.isSuccessful()).thenReturn(false);
     when(httpResult.isProjectMissing(any())).thenReturn(true);
@@ -214,7 +210,7 @@
   }
 
   @Test
-  public void shouldNotCallInitProjectWhenReplicateNewRepositoriesNotSet() throws IOException {
+  public void shouldNotCallInitProjectWhenReplicateNewRepositoriesNotSet() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/meta");
     when(httpResult.isSuccessful()).thenReturn(false);
     when(httpResult.isProjectMissing(any())).thenReturn(true);
@@ -227,7 +223,7 @@
   }
 
   @Test
-  public void shouldCallSendObjectWhenPatchSetRef() throws ClientProtocolException, IOException {
+  public void shouldCallSendObjectWhenPatchSetRef() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/1");
     objectUnderTest.start();
     objectUnderTest.onEvent(event);
@@ -236,8 +232,7 @@
   }
 
   @Test
-  public void shouldFallbackToCallFetchWhenIOException()
-      throws ClientProtocolException, IOException, LargeObjectException, RefUpdateException {
+  public void shouldFallbackToCallFetchWhenIOException() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/meta");
     objectUnderTest.start();
 
@@ -249,8 +244,7 @@
   }
 
   @Test
-  public void shouldFallbackToCallFetchWhenLargeRef()
-      throws ClientProtocolException, IOException, LargeObjectException, RefUpdateException {
+  public void shouldFallbackToCallFetchWhenLargeRef() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/1");
     objectUnderTest.start();
 
@@ -262,8 +256,7 @@
   }
 
   @Test
-  public void shouldFallbackToCallFetchWhenParentObjectIsMissing()
-      throws ClientProtocolException, IOException {
+  public void shouldFallbackToCallFetchWhenParentObjectIsMissing() throws Exception {
     Event event = new TestEvent("refs/changes/01/1/1");
     objectUnderTest.start();
 
@@ -279,7 +272,7 @@
 
   @Test
   public void shouldFallbackToApplyAllParentObjectsWhenParentObjectIsMissingOnMetaRef()
-      throws ClientProtocolException, IOException {
+      throws Exception {
     Event event = new TestEvent("refs/changes/01/1/meta");
     objectUnderTest.start();
 
@@ -305,7 +298,7 @@
 
   @Test
   public void shouldFallbackToApplyAllParentObjectsWhenParentObjectIsMissingOnAllowedRefs()
-      throws ClientProtocolException, IOException {
+      throws Exception {
     String refName = "refs/tags/test-tag";
     Event event = new TestEvent(refName);
     objectUnderTest.start();
@@ -332,7 +325,7 @@
   }
 
   @Test
-  public void shouldSkipEventWhenMultiSiteVersionRef() throws IOException {
+  public void shouldSkipEventWhenMultiSiteVersionRef() throws Exception {
     FileBasedConfig fileConfig =
         new FileBasedConfig(sitePaths.etc_dir.resolve("replication.config").toFile(), FS.DETECTED);
     fileConfig.setString("replication", null, "excludeRefs", "refs/multi-site/version");
@@ -362,7 +355,7 @@
   }
 
   @Test
-  public void shouldSetShutdownStateWhenStopping() throws IOException {
+  public void shouldSetShutdownStateWhenStopping() throws Exception {
     objectUnderTest.stop();
     assertThat(shutdownState.isShuttingDown()).isTrue();
   }
@@ -376,7 +369,7 @@
   }
 
   @Test
-  public void shouldCallDeleteWhenReplicateProjectDeletionsTrue() throws IOException {
+  public void shouldCallDeleteWhenReplicateProjectDeletionsTrue() throws Exception {
     when(source.wouldDeleteProject(any())).thenReturn(true);
 
     String projectName = "testProject";
@@ -392,7 +385,7 @@
   }
 
   @Test
-  public void shouldNotCallDeleteWhenProjectNotToDelete() throws IOException {
+  public void shouldNotCallDeleteWhenProjectNotToDelete() throws Exception {
     when(source.wouldDeleteProject(any())).thenReturn(false);
 
     FakeProjectDeletedEvent event = new FakeProjectDeletedEvent("testProject");
@@ -404,7 +397,7 @@
   }
 
   @Test
-  public void shouldScheduleUpdateHeadWhenWouldFetchProject() throws IOException {
+  public void shouldScheduleUpdateHeadWhenWouldFetchProject() throws Exception {
     when(source.wouldFetchProject(any())).thenReturn(true);
 
     String projectName = "aProject";
@@ -420,7 +413,7 @@
   }
 
   @Test
-  public void shouldNotScheduleUpdateHeadWhenNotWouldFetchProject() throws IOException {
+  public void shouldNotScheduleUpdateHeadWhenNotWouldFetchProject() throws Exception {
     when(source.wouldFetchProject(any())).thenReturn(false);
 
     String projectName = "aProject";
@@ -431,7 +424,7 @@
     verify(source, never()).scheduleUpdateHead(any(), any(), any());
   }
 
-  protected static Path createTempPath(String prefix) throws IOException {
+  protected static Path createTempPath(String prefix) throws Exception {
     return createTempDirectory(prefix);
   }
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationStateTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationStateTest.java
index eb52493..a1ef985 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationStateTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/ReplicationStateTest.java
@@ -19,7 +19,6 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-import java.net.URISyntaxException;
 import org.eclipse.jgit.lib.RefUpdate;
 import org.eclipse.jgit.transport.URIish;
 import org.junit.Before;
@@ -57,7 +56,7 @@
   }
 
   @Test
-  public void shouldFireEventsForReplicationOfOneRefToOneNode() throws URISyntaxException {
+  public void shouldFireEventsForReplicationOfOneRefToOneNode() throws Exception {
     URIish uri = new URIish("git://someHost/someRepo.git");
 
     // actual test
@@ -83,8 +82,7 @@
   }
 
   @Test
-  public void shouldFireEventsForReplicationOfMultipleRefsToMultipleNodes()
-      throws URISyntaxException {
+  public void shouldFireEventsForReplicationOfMultipleRefsToMultipleNodes() throws Exception {
     URIish uri1 = new URIish("git://host1/someRepo.git");
     URIish uri2 = new URIish("git://host2/someRepo.git");
     URIish uri3 = new URIish("git://host3/someRepo.git");
@@ -173,7 +171,7 @@
 
   @Test
   public void shouldFireEventsWhenSomeReplicationCompleteBeforeAllTasksAreScheduled()
-      throws URISyntaxException {
+      throws Exception {
     URIish uri1 = new URIish("git://host1/someRepo.git");
 
     // actual test
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/RevisionReaderIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/RevisionReaderIT.java
index a541d7e..96bd68e 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/RevisionReaderIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/RevisionReaderIT.java
@@ -33,7 +33,6 @@
 import com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput;
 import com.google.gerrit.extensions.client.Comment;
 import com.google.gerrit.extensions.config.FactoryModule;
-import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.server.notedb.Sequences;
 import com.google.inject.Scopes;
 import com.googlesource.gerrit.plugins.replication.ReplicationConfig;
@@ -41,7 +40,6 @@
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionData;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionObjectData;
 import com.googlesource.gerrit.plugins.replication.pull.fetch.ApplyObject;
-import java.io.IOException;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -178,20 +176,20 @@
     assertThat(parentObjectIds).hasSize(numberOfParents);
   }
 
-  private void addMultipleComments(int numberOfParents, Id changeId) throws RestApiException {
+  private void addMultipleComments(int numberOfParents, Id changeId) throws Exception {
     for (int i = 0; i < numberOfParents; i++) {
       addComment(changeId);
     }
   }
 
-  private void setReplicationConfig(int numberOfParents) throws IOException {
+  private void setReplicationConfig(int numberOfParents) throws Exception {
     FileBasedConfig config = (FileBasedConfig) replicationConfig.getConfig();
     config.setInt(
         "replication", null, RevisionReader.CONFIG_MAX_API_HISTORY_DEPTH, numberOfParents);
     config.save();
   }
 
-  private void addComment(Id changeId) throws RestApiException {
+  private void addComment(Id changeId) throws Exception {
     gApi.changes().id(changeId.get()).current().review(new ReviewInput().message("foo"));
   }
 
@@ -209,7 +207,7 @@
     }
   }
 
-  protected Optional<ObjectId> refObjectId(String refName) throws IOException {
+  protected Optional<ObjectId> refObjectId(String refName) throws Exception {
     try (Repository repo = repoManager.openRepository(project)) {
       return Optional.ofNullable(repo.exactRef(refName)).map(Ref::getObjectId);
     }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/WaitUtil.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/WaitUtil.java
index a99ac18..77145ba 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/WaitUtil.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/WaitUtil.java
@@ -21,8 +21,7 @@
 import java.util.function.Supplier;
 
 public class WaitUtil {
-  public static void waitUntil(Supplier<Boolean> waitCondition, Duration timeout)
-      throws InterruptedException {
+  public static void waitUntil(Supplier<Boolean> waitCondition, Duration timeout) throws Exception {
     Stopwatch stopwatch = Stopwatch.createStarted();
     while (!waitCondition.get()) {
       if (stopwatch.elapsed().compareTo(timeout) > 0) {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ActionITBase.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ActionITBase.java
index 20c1fea..a46846e 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ActionITBase.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ActionITBase.java
@@ -44,7 +44,6 @@
 import java.util.Optional;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
-import org.apache.http.auth.AuthenticationException;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.ResponseHandler;
@@ -181,17 +180,17 @@
   }
 
   protected HttpRequestBase withBasicAuthenticationAsAdmin(HttpRequestBase httpRequest)
-      throws AuthenticationException {
+      throws Exception {
     return withBasicAuthentication(httpRequest, admin);
   }
 
   protected HttpRequestBase withBasicAuthenticationAsUser(HttpRequestBase httpRequest)
-      throws AuthenticationException {
+      throws Exception {
     return withBasicAuthentication(httpRequest, user);
   }
 
   private HttpRequestBase withBasicAuthentication(HttpRequestBase httpRequest, TestAccount account)
-      throws AuthenticationException {
+      throws Exception {
     UsernamePasswordCredentials creds =
         new UsernamePasswordCredentials(account.username(), account.httpPassword());
     httpRequest.addHeader(new BasicScheme().authenticate(creds, httpRequest, null));
@@ -203,13 +202,12 @@
   }
 
   private void setReplicationSource(
-      String remoteName, String replicaSuffix, Optional<String> project) throws IOException {
+      String remoteName, String replicaSuffix, Optional<String> project) throws Exception {
     setReplicationSource(remoteName, Arrays.asList(replicaSuffix), project);
   }
 
   private void setReplicationSource(
-      String remoteName, List<String> replicaSuffixes, Optional<String> project)
-      throws IOException {
+      String remoteName, List<String> replicaSuffixes, Optional<String> project) throws Exception {
 
     List<String> replicaUrls =
         replicaSuffixes.stream()
@@ -226,7 +224,7 @@
   }
 
   private void setReplicationCredentials(String remoteName, String username, String password)
-      throws IOException {
+      throws Exception {
     secureConfig.setString("remote", remoteName, "username", username);
     secureConfig.setString("remote", remoteName, "password", password);
     secureConfig.save();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectActionTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectActionTest.java
index d0cd1b4..245003a 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectActionTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectActionTest.java
@@ -28,15 +28,11 @@
 import com.google.gerrit.extensions.restapi.BadRequestException;
 import com.google.gerrit.extensions.restapi.ResourceConflictException;
 import com.google.gerrit.extensions.restapi.Response;
-import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.server.project.ProjectResource;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionData;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionInput;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionObjectData;
 import com.googlesource.gerrit.plugins.replication.pull.api.exception.MissingParentObjectException;
-import com.googlesource.gerrit.plugins.replication.pull.api.exception.RefUpdateException;
-import com.googlesource.gerrit.plugins.replication.pull.api.exception.UnauthorizedAuthException;
-import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collections;
@@ -91,14 +87,14 @@
   @Mock FetchPreconditions preConditions;
 
   @Before
-  public void setup() throws UnauthorizedAuthException {
+  public void setup() throws Exception {
     when(preConditions.canCallFetchApi()).thenReturn(true);
 
     applyObjectAction = new ApplyObjectAction(applyObjectCommand, deleteRefCommand, preConditions);
   }
 
   @Test
-  public void shouldReturnCreatedResponseCode() throws RestApiException {
+  public void shouldReturnCreatedResponseCode() throws Exception {
     RevisionInput inputParams =
         new RevisionInput(label, refName, DUMMY_EVENT_TIMESTAMP, createSampleRevisionData());
 
@@ -108,7 +104,7 @@
   }
 
   @Test
-  public void shouldReturnCreatedResponseCodeForBlob() throws RestApiException {
+  public void shouldReturnCreatedResponseCodeForBlob() throws Exception {
     byte[] blobData = "foo".getBytes(StandardCharsets.UTF_8);
     RevisionInput inputParams =
         new RevisionInput(
@@ -191,8 +187,7 @@
   }
 
   @Test(expected = AuthException.class)
-  public void shouldThrowAuthExceptionWhenCallFetchActionCapabilityNotAssigned()
-      throws RestApiException {
+  public void shouldThrowAuthExceptionWhenCallFetchActionCapabilityNotAssigned() throws Exception {
     RevisionInput inputParams =
         new RevisionInput(label, refName, DUMMY_EVENT_TIMESTAMP, createSampleRevisionData());
 
@@ -202,8 +197,7 @@
   }
 
   @Test(expected = ResourceConflictException.class)
-  public void shouldThrowResourceConflictExceptionWhenMissingParentObject()
-      throws RestApiException, IOException, RefUpdateException, MissingParentObjectException {
+  public void shouldThrowResourceConflictExceptionWhenMissingParentObject() throws Exception {
     RevisionInput inputParams =
         new RevisionInput(label, refName, DUMMY_EVENT_TIMESTAMP, createSampleRevisionData());
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectCommandTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectCommandTest.java
index ee49aee..2ea0571 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectCommandTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectCommandTest.java
@@ -29,18 +29,15 @@
 import com.google.gerrit.metrics.Timer1;
 import com.google.gerrit.server.events.Event;
 import com.google.gerrit.server.events.EventDispatcher;
-import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.googlesource.gerrit.plugins.replication.pull.ApplyObjectMetrics;
 import com.googlesource.gerrit.plugins.replication.pull.ApplyObjectsCacheKey;
 import com.googlesource.gerrit.plugins.replication.pull.FetchRefReplicatedEvent;
 import com.googlesource.gerrit.plugins.replication.pull.PullReplicationStateLogger;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionData;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionObjectData;
-import com.googlesource.gerrit.plugins.replication.pull.api.exception.MissingParentObjectException;
 import com.googlesource.gerrit.plugins.replication.pull.api.exception.RefUpdateException;
 import com.googlesource.gerrit.plugins.replication.pull.fetch.ApplyObject;
 import com.googlesource.gerrit.plugins.replication.pull.fetch.RefUpdateState;
-import java.io.IOException;
 import java.util.Collections;
 import org.eclipse.jgit.lib.Constants;
 import org.eclipse.jgit.lib.RefUpdate;
@@ -78,7 +75,7 @@
   private ApplyObjectCommand objectUnderTest;
 
   @Before
-  public void setup() throws MissingParentObjectException, IOException {
+  public void setup() throws Exception {
     cache = CacheBuilder.newBuilder().build();
     RefUpdateState state = new RefUpdateState(TEST_REMOTE_NAME, RefUpdate.Result.NEW);
     when(eventDispatcherDataItem.get()).thenReturn(eventDispatcher);
@@ -91,9 +88,7 @@
   }
 
   @Test
-  public void shouldSendEventWhenApplyObject()
-      throws PermissionBackendException, IOException, RefUpdateException,
-          MissingParentObjectException {
+  public void shouldSendEventWhenApplyObject() throws Exception {
     RevisionData sampleRevisionData =
         createSampleRevisionData(sampleCommitObjectId, sampleTreeObjectId);
     objectUnderTest.applyObject(
@@ -112,8 +107,7 @@
   }
 
   @Test
-  public void shouldInsertIntoApplyObjectsCacheWhenApplyObjectIsSuccessful()
-      throws IOException, RefUpdateException, MissingParentObjectException {
+  public void shouldInsertIntoApplyObjectsCacheWhenApplyObjectIsSuccessful() throws Exception {
     RevisionData sampleRevisionData =
         createSampleRevisionData(sampleCommitObjectId, sampleTreeObjectId);
     RevisionData sampleRevisionData2 =
@@ -142,8 +136,7 @@
   }
 
   @Test(expected = RefUpdateException.class)
-  public void shouldNotInsertIntoApplyObjectsCacheWhenApplyObjectIsFailure()
-      throws IOException, RefUpdateException, MissingParentObjectException {
+  public void shouldNotInsertIntoApplyObjectsCacheWhenApplyObjectIsFailure() throws Exception {
     RevisionData sampleRevisionData =
         createSampleRevisionData(sampleCommitObjectId, sampleTreeObjectId);
     RefUpdateState failureState = new RefUpdateState(TEST_REMOTE_NAME, RefUpdate.Result.IO_FAILURE);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/BearerAuthenticationFilterTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/BearerAuthenticationFilterTest.java
index 9831d6c..3ca1308 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/BearerAuthenticationFilterTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/BearerAuthenticationFilterTest.java
@@ -26,10 +26,8 @@
 import com.google.gerrit.server.util.ThreadLocalRequestContext;
 import com.google.inject.Provider;
 import com.googlesource.gerrit.plugins.replication.pull.auth.PullReplicationInternalUser;
-import java.io.IOException;
 import java.util.Optional;
 import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.junit.Test;
@@ -54,13 +52,13 @@
   private final String pluginName = "pull-replication";
 
   private void authenticateAndFilter(String method, String uri, Optional<String> queryStringMaybe)
-      throws ServletException, IOException {
+      throws Exception {
     when(httpServletRequest.getMethod()).thenReturn(method);
     authenticateAndFilter(uri, queryStringMaybe);
   }
 
   private void authenticateAndFilter(String uri, Optional<String> queryStringMaybe)
-      throws ServletException, IOException {
+      throws Exception {
     final String bearerToken = "some-bearer-token";
     when(httpServletRequest.getRequestURI()).thenReturn(uri);
     queryStringMaybe.ifPresent(qs -> when(httpServletRequest.getQueryString()).thenReturn(qs));
@@ -83,50 +81,49 @@
   }
 
   @Test
-  public void shouldAuthenticateWhenFetch() throws ServletException, IOException {
+  public void shouldAuthenticateWhenFetch() throws Exception {
     authenticateAndFilter("any-prefix/pull-replication~fetch", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenApplyObject() throws ServletException, IOException {
+  public void shouldAuthenticateWhenApplyObject() throws Exception {
     authenticateAndFilter("any-prefix/pull-replication~apply-object", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenApplyObjects() throws ServletException, IOException {
+  public void shouldAuthenticateWhenApplyObjects() throws Exception {
     authenticateAndFilter("any-prefix/pull-replication~apply-objects", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenDeleteProject() throws ServletException, IOException {
+  public void shouldAuthenticateWhenDeleteProject() throws Exception {
     authenticateAndFilter("any-prefix/pull-replication~delete-project", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenUpdateHead() throws ServletException, IOException {
+  public void shouldAuthenticateWhenUpdateHead() throws Exception {
     authenticateAndFilter(
         "PUT", "any-prefix/projects/my-project/pull-replication~HEAD", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenInitProject() throws ServletException, IOException {
+  public void shouldAuthenticateWhenInitProject() throws Exception {
     authenticateAndFilter(
         "any-prefix/pull-replication/init-project/my-project.git", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenGitUploadPacket() throws ServletException, IOException {
+  public void shouldAuthenticateWhenGitUploadPacket() throws Exception {
     authenticateAndFilter("any-prefix/git-upload-pack", NO_QUERY_PARAMETERS);
   }
 
   @Test
-  public void shouldAuthenticateWhenGitUploadPacketInQueryParameter()
-      throws ServletException, IOException {
+  public void shouldAuthenticateWhenGitUploadPacketInQueryParameter() throws Exception {
     authenticateAndFilter("any-prefix", GIT_UPLOAD_PACK_QUERY_PARAMETER);
   }
 
   @Test
-  public void shouldBe401WhenBearerTokenDoesNotMatch() throws ServletException, IOException {
+  public void shouldBe401WhenBearerTokenDoesNotMatch() throws Exception {
     when(httpServletRequest.getRequestURI()).thenReturn("any-prefix/pull-replication~fetch");
     when(httpServletRequest.getHeader("Authorization"))
         .thenReturn(String.format("Bearer %s", "some-different-bearer-token"));
@@ -146,7 +143,7 @@
   }
 
   @Test
-  public void shouldBe401WhenBearerTokenCannotBeExtracted() throws ServletException, IOException {
+  public void shouldBe401WhenBearerTokenCannotBeExtracted() throws Exception {
     when(httpServletRequest.getRequestURI()).thenReturn("any-prefix/pull-replication~fetch");
     when(httpServletRequest.getHeader("Authorization")).thenReturn("bearer token");
 
@@ -165,7 +162,7 @@
   }
 
   @Test
-  public void shouldBe401WhenNoAuthorizationHeaderInRequest() throws ServletException, IOException {
+  public void shouldBe401WhenNoAuthorizationHeaderInRequest() throws Exception {
     when(httpServletRequest.getRequestURI()).thenReturn("any-prefix/pull-replication~fetch");
 
     final BearerAuthenticationFilter filter =
@@ -182,7 +179,7 @@
   }
 
   @Test
-  public void shouldGoNextInChainWhenUriDoesNotMatch() throws ServletException, IOException {
+  public void shouldGoNextInChainWhenUriDoesNotMatch() throws Exception {
     when(httpServletRequest.getRequestURI()).thenReturn("any-url");
 
     final BearerAuthenticationFilter filter =
@@ -199,8 +196,7 @@
   }
 
   @Test
-  public void shouldGoNextInChainWhenBasicAuthorizationIsRequired()
-      throws ServletException, IOException {
+  public void shouldGoNextInChainWhenBasicAuthorizationIsRequired() throws Exception {
     when(httpServletRequest.getRequestURI())
         .thenReturn("/a/projects/my-project/pull-replication~fetch");
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchActionTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchActionTest.java
index e7048f6..024a712 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchActionTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchActionTest.java
@@ -33,7 +33,6 @@
 import com.google.gerrit.server.git.WorkQueue.Task;
 import com.google.gerrit.server.project.ProjectResource;
 import com.googlesource.gerrit.plugins.replication.pull.api.exception.RemoteConfigurationMissingException;
-import com.googlesource.gerrit.plugins.replication.pull.api.exception.UnauthorizedAuthException;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ScheduledExecutorService;
@@ -67,7 +66,7 @@
   @Mock FetchPreconditions preConditions;
 
   @Before
-  public void setup() throws UnauthorizedAuthException {
+  public void setup() throws Exception {
     when(fetchJobFactory.create(any(), any(), any())).thenReturn(fetchJob);
     when(workQueue.getDefaultQueue()).thenReturn(exceutorService);
     when(urlFormatter.getRestUrl(anyString())).thenReturn(Optional.of(location));
@@ -89,7 +88,7 @@
   }
 
   @Test
-  public void shouldReturnCreatedResponseCode() throws RestApiException {
+  public void shouldReturnCreatedResponseCode() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
@@ -146,9 +145,7 @@
   }
 
   @Test(expected = RestApiException.class)
-  public void shouldThrowRestApiExceptionWhenPocessingInterrupted()
-      throws RestApiException, InterruptedException, ExecutionException,
-          RemoteConfigurationMissingException, TimeoutException {
+  public void shouldThrowRestApiExceptionWhenPocessingInterrupted() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
@@ -159,9 +156,7 @@
   }
 
   @Test(expected = UnprocessableEntityException.class)
-  public void shouldThrowRestApiExceptionWhenNoSurceForGivenLabel()
-      throws RestApiException, InterruptedException, ExecutionException,
-          RemoteConfigurationMissingException, TimeoutException {
+  public void shouldThrowRestApiExceptionWhenNoSurceForGivenLabel() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = "non-existing-label";
     inputParams.refName = refName;
@@ -174,9 +169,7 @@
   }
 
   @Test(expected = RestApiException.class)
-  public void shouldThrowRestApiExceptionWhenIssueDuringPocessing()
-      throws RestApiException, InterruptedException, ExecutionException,
-          RemoteConfigurationMissingException, TimeoutException {
+  public void shouldThrowRestApiExceptionWhenIssueDuringPocessing() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
@@ -189,9 +182,7 @@
   }
 
   @Test(expected = RestApiException.class)
-  public void shouldThrowRestApiExceptionWhenIssueWithUrlParam()
-      throws RestApiException, InterruptedException, ExecutionException,
-          RemoteConfigurationMissingException, TimeoutException {
+  public void shouldThrowRestApiExceptionWhenIssueWithUrlParam() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
@@ -202,9 +193,7 @@
   }
 
   @Test(expected = RestApiException.class)
-  public void shouldThrowRestApiExceptionWhenTimeout()
-      throws RestApiException, InterruptedException, ExecutionException,
-          RemoteConfigurationMissingException, TimeoutException {
+  public void shouldThrowRestApiExceptionWhenTimeout() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
@@ -215,8 +204,7 @@
   }
 
   @Test(expected = AuthException.class)
-  public void shouldThrowAuthExceptionWhenCallFetchActionCapabilityNotAssigned()
-      throws RestApiException {
+  public void shouldThrowAuthExceptionWhenCallFetchActionCapabilityNotAssigned() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
@@ -227,7 +215,7 @@
   }
 
   @Test
-  public void shouldReturnScheduledTaskForAsyncCall() throws RestApiException {
+  public void shouldReturnScheduledTaskForAsyncCall() throws Exception {
     FetchAction.Input inputParams = new FetchAction.Input();
     inputParams.label = label;
     inputParams.refName = refName;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java
index 9af2d10..7bd723b 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommandTest.java
@@ -34,7 +34,6 @@
 import com.googlesource.gerrit.plugins.replication.pull.Source;
 import com.googlesource.gerrit.plugins.replication.pull.SourcesCollection;
 import com.googlesource.gerrit.plugins.replication.pull.api.exception.RemoteConfigurationMissingException;
-import java.net.URISyntaxException;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
@@ -70,7 +69,7 @@
   FetchCommand objectUnderTest;
 
   @Before
-  public void setup() throws URISyntaxException {
+  public void setup() throws Exception {
     projectName = Project.nameKey("sample_project");
     uri = new URIish("file://sample_host/repository_path/repo.git");
     label = "instance-1-label";
@@ -85,9 +84,7 @@
   }
 
   @Test
-  public void shouldScheduleRefFetch()
-      throws InterruptedException, ExecutionException, RemoteConfigurationMissingException,
-          TimeoutException {
+  public void shouldScheduleRefFetch() throws Exception {
     objectUnderTest.fetchSync(projectName, label, REF_NAME_TO_FETCH);
 
     verify(source, times(1))
@@ -95,9 +92,7 @@
   }
 
   @Test
-  public void shouldScheduleRefFetchWithDelay()
-      throws InterruptedException, ExecutionException, RemoteConfigurationMissingException,
-          TimeoutException {
+  public void shouldScheduleRefFetchWithDelay() throws Exception {
     objectUnderTest.fetchAsync(projectName, label, REF_NAME_TO_FETCH, apiRequestMetrics);
 
     verify(source, times(1))
@@ -105,9 +100,7 @@
   }
 
   @Test
-  public void shouldMarkAllFetchTasksScheduled()
-      throws InterruptedException, ExecutionException, RemoteConfigurationMissingException,
-          TimeoutException {
+  public void shouldMarkAllFetchTasksScheduled() throws Exception {
     objectUnderTest.fetchSync(projectName, label, REF_NAME_TO_FETCH);
 
     verify(source, times(1))
@@ -125,8 +118,7 @@
 
   @SuppressWarnings("unchecked")
   @Test
-  public void shouldUpdateStateWhenInterruptedException()
-      throws InterruptedException, ExecutionException, TimeoutException {
+  public void shouldUpdateStateWhenInterruptedException() throws Exception {
     when(future.get(anyLong(), eq(TimeUnit.SECONDS))).thenThrow(new InterruptedException());
     when(source.schedule(projectName, REF_NAME_TO_FETCH, state, SYNC, Optional.empty()))
         .thenReturn(future);
@@ -140,8 +132,7 @@
 
   @SuppressWarnings("unchecked")
   @Test
-  public void shouldUpdateStateWhenExecutionException()
-      throws InterruptedException, ExecutionException, TimeoutException {
+  public void shouldUpdateStateWhenExecutionException() throws Exception {
     when(future.get(anyLong(), eq(TimeUnit.SECONDS)))
         .thenThrow(new ExecutionException(new Exception()));
     when(source.schedule(projectName, REF_NAME_TO_FETCH, state, SYNC, Optional.empty()))
@@ -156,8 +147,7 @@
 
   @SuppressWarnings("unchecked")
   @Test
-  public void shouldUpdateStateWhenTimeoutException()
-      throws InterruptedException, ExecutionException, TimeoutException {
+  public void shouldUpdateStateWhenTimeoutException() throws Exception {
     when(future.get(anyLong(), eq(TimeUnit.SECONDS))).thenThrow(new TimeoutException());
     when(source.schedule(projectName, REF_NAME_TO_FETCH, state, SYNC, Optional.empty()))
         .thenReturn(future);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/UpdateHeadActionIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/UpdateHeadActionIT.java
index 9ceae5a..f3802a3 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/UpdateHeadActionIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/UpdateHeadActionIT.java
@@ -26,10 +26,7 @@
 import com.google.gerrit.extensions.api.projects.HeadInput;
 import com.google.gson.Gson;
 import com.google.inject.Inject;
-import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
-import org.apache.http.auth.AuthenticationException;
-import org.apache.http.client.ClientProtocolException;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -173,8 +170,7 @@
     shouldReturnOKForUserWithPullReplicationCapabilityTest();
   }
 
-  private void shouldReturnOKForUserWithPullReplicationCapabilityTest()
-      throws ClientProtocolException, IOException, AuthenticationException {
+  private void shouldReturnOKForUserWithPullReplicationCapabilityTest() throws Exception {
     projectOperations
         .allProjectsForUpdate()
         .add(
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientBase.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientBase.java
index cdb238e..25aa2a7 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientBase.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientBase.java
@@ -33,13 +33,10 @@
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionData;
 import com.googlesource.gerrit.plugins.replication.pull.api.data.RevisionObjectData;
 import com.googlesource.gerrit.plugins.replication.pull.filter.SyncRefsFilter;
-import java.io.IOException;
 import java.io.InputStreamReader;
-import java.net.URISyntaxException;
 import java.nio.ByteBuffer;
 import java.util.Collections;
 import org.apache.http.Header;
-import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
@@ -150,8 +147,7 @@
   protected abstract void assertAuthentication(HttpRequestBase httpRequest);
 
   @Test
-  public void shouldCallFetchEndpoint()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldCallFetchEndpoint() throws Exception {
 
     objectUnderTest.callFetch(Project.nameKey("test_repo"), refName, new URIish(api));
 
@@ -167,8 +163,7 @@
   }
 
   @Test
-  public void shouldByDefaultCallSyncFetchForAllRefs()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldByDefaultCallSyncFetchForAllRefs() throws Exception {
 
     objectUnderTest.callFetch(Project.nameKey("test_repo"), refName, new URIish(api));
 
@@ -179,8 +174,7 @@
   }
 
   @Test
-  public void shouldCallAsyncFetchForAllRefs()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldCallAsyncFetchForAllRefs() throws Exception {
 
     when(config.getStringList("replication", null, "syncRefs"))
         .thenReturn(new String[] {"NO_SYNC_REFS"});
@@ -205,8 +199,7 @@
   }
 
   @Test
-  public void shouldCallSyncFetchOnlyForMetaRef()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldCallSyncFetchOnlyForMetaRef() throws Exception {
     String metaRefName = "refs/changes/01/101/meta";
     String expectedMetaRefPayload =
         "{\"label\":\"Replication\", \"ref_name\": \"" + metaRefName + "\", \"async\":false}";
@@ -237,8 +230,7 @@
   }
 
   @Test
-  public void shouldCallFetchEndpointWithPayload()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldCallFetchEndpointWithPayload() throws Exception {
 
     objectUnderTest.callFetch(Project.nameKey("test_repo"), refName, new URIish(api));
 
@@ -249,8 +241,7 @@
   }
 
   @Test
-  public void shouldSetContentTypeHeader()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldSetContentTypeHeader() throws Exception {
 
     objectUnderTest.callFetch(Project.nameKey("test_repo"), refName, new URIish(api));
 
@@ -262,8 +253,7 @@
   }
 
   @Test
-  public void shouldCallSendObjectEndpoint()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldCallSendObjectEndpoint() throws Exception {
 
     objectUnderTest.callSendObject(
         Project.nameKey("test_repo"),
@@ -285,8 +275,7 @@
   }
 
   @Test
-  public void shouldCallSendObjectEndpointWithPayload()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldCallSendObjectEndpointWithPayload() throws Exception {
 
     objectUnderTest.callSendObject(
         Project.nameKey("test_repo"),
@@ -303,8 +292,7 @@
   }
 
   @Test
-  public void shouldSetContentTypeHeaderForSendObjectCall()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldSetContentTypeHeaderForSendObjectCall() throws Exception {
 
     objectUnderTest.callFetch(Project.nameKey("test_repo"), refName, new URIish(api));
 
@@ -364,8 +352,7 @@
   }
 
   @Test
-  public void shouldUseReplicationLabelWhenProvided()
-      throws ClientProtocolException, IOException, URISyntaxException {
+  public void shouldUseReplicationLabelWhenProvided() throws Exception {
     when(config.getString("replication", null, "instanceLabel")).thenReturn(instanceId);
     FetchRestApiClient objectUnderTest =
         new FetchRestApiClient(
@@ -386,7 +373,7 @@
   }
 
   @Test
-  public void shouldCallInitProjectEndpoint() throws IOException, URISyntaxException {
+  public void shouldCallInitProjectEndpoint() throws Exception {
 
     objectUnderTest.initProject(Project.nameKey("test_repo"), new URIish(api));
 
@@ -403,7 +390,7 @@
   }
 
   @Test
-  public void shouldCallDeleteProjectEndpoint() throws IOException, URISyntaxException {
+  public void shouldCallDeleteProjectEndpoint() throws Exception {
 
     objectUnderTest.deleteProject(Project.nameKey("test_repo"), new URIish(api));
 
@@ -420,7 +407,7 @@
   }
 
   @Test
-  public void shouldCallUpdateHEADEndpoint() throws IOException, URISyntaxException {
+  public void shouldCallUpdateHEADEndpoint() throws Exception {
     String newHead = "newHead";
     String projectName = "aProject";
     objectUnderTest.updateHead(Project.nameKey(projectName), newHead, new URIish(api));
@@ -441,7 +428,7 @@
     assertAuthentication(httpPut);
   }
 
-  public String readPayload(HttpPost entity) throws UnsupportedOperationException, IOException {
+  public String readPayload(HttpPost entity) throws Exception {
     ByteBuffer buf = IO.readWholeStream(entity.getEntity().getContent(), 1024);
     return RawParseUtils.decode(buf.array(), buf.arrayOffset(), buf.limit()).trim();
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBasicAuthenticationTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBasicAuthenticationTest.java
index 644afce..b4d4e7a 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBasicAuthenticationTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBasicAuthenticationTest.java
@@ -19,11 +19,9 @@
 import static org.mockito.Mockito.*;
 
 import com.googlesource.gerrit.plugins.replication.pull.filter.SyncRefsFilter;
-import java.io.IOException;
 import java.util.Optional;
 import org.apache.http.Header;
 import org.apache.http.HttpHeaders;
-import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.eclipse.jgit.transport.CredentialItem;
 import org.junit.Before;
@@ -36,7 +34,7 @@
 public class FetchRestApiClientWithBasicAuthenticationTest extends FetchRestApiClientBase {
 
   @Before
-  public void setup() throws ClientProtocolException, IOException {
+  public void setup() throws Exception {
     when(bearerTokenProvider.get()).thenReturn(Optional.empty());
     when(credentialProvider.supports(any()))
         .thenAnswer(
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBearerTokenTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBearerTokenTest.java
index 90d71ad..fe50b5c 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBearerTokenTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/client/FetchRestApiClientWithBearerTokenTest.java
@@ -19,11 +19,9 @@
 import static org.mockito.Mockito.*;
 
 import com.googlesource.gerrit.plugins.replication.pull.filter.SyncRefsFilter;
-import java.io.IOException;
 import java.util.Optional;
 import org.apache.http.Header;
 import org.apache.http.HttpHeaders;
-import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -33,7 +31,7 @@
 public class FetchRestApiClientWithBearerTokenTest extends FetchRestApiClientBase {
 
   @Before
-  public void setup() throws ClientProtocolException, IOException {
+  public void setup() throws Exception {
     when(bearerTokenProvider.get()).thenReturn(Optional.of("some-bearer-token"));
     when(replicationConfig.getConfig()).thenReturn(config);
     when(config.getStringList("replication", null, "syncRefs")).thenReturn(new String[0]);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumerTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumerTest.java
index 8739d4b..0aba20a 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/EventsBrokerMessageConsumerTest.java
@@ -24,7 +24,6 @@
 
 import com.gerritforge.gerrit.eventbroker.BrokerApi;
 import com.google.gerrit.extensions.registration.DynamicItem;
-import com.google.gerrit.extensions.restapi.AuthException;
 import com.google.gerrit.server.events.RefUpdatedEvent;
 import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.googlesource.gerrit.plugins.replication.pull.ShutdownState;
@@ -53,29 +52,25 @@
   }
 
   @Test
-  public void shouldRethrowExceptionWhenFetchThrowsAuthException()
-      throws AuthException, PermissionBackendException {
+  public void shouldRethrowExceptionWhenFetchThrowsAuthException() throws Exception {
     doThrow(PermissionBackendException.class).when(eventListener).fetchRefsForEvent(any());
     assertThrows(EventRejectedException.class, () -> objectUnderTest.accept(new RefUpdatedEvent()));
   }
 
   @Test
-  public void shouldRethrowExceptionWhenFetchThrowsPermissionBackendException()
-      throws AuthException, PermissionBackendException {
+  public void shouldRethrowExceptionWhenFetchThrowsPermissionBackendException() throws Exception {
     doThrow(PermissionBackendException.class).when(eventListener).fetchRefsForEvent(any());
     assertThrows(EventRejectedException.class, () -> objectUnderTest.accept(new RefUpdatedEvent()));
   }
 
   @Test
-  public void shouldNotThrowExceptionWhenFetchSucceed()
-      throws AuthException, PermissionBackendException {
+  public void shouldNotThrowExceptionWhenFetchSucceed() throws Exception {
     doNothing().when(eventListener).fetchRefsForEvent(any());
     objectUnderTest.accept(new RefUpdatedEvent());
   }
 
   @Test
-  public void shouldStillAcceptLastEventDuringShutdownAndThenDisconnect()
-      throws AuthException, PermissionBackendException {
+  public void shouldStillAcceptLastEventDuringShutdownAndThenDisconnect() throws Exception {
     doNothing().when(eventListener).fetchRefsForEvent(any());
     when(eventsBrokerDynamicItem.get()).thenReturn(eventsBroker);
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/StreamEventListenerTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/StreamEventListenerTest.java
index 8dc0359..552853e 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/StreamEventListenerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/event/StreamEventListenerTest.java
@@ -26,14 +26,11 @@
 import com.google.common.collect.Lists;
 import com.google.gerrit.entities.Project;
 import com.google.gerrit.entities.RefNames;
-import com.google.gerrit.extensions.restapi.AuthException;
-import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.server.data.RefUpdateAttribute;
 import com.google.gerrit.server.events.Event;
 import com.google.gerrit.server.events.ProjectCreatedEvent;
 import com.google.gerrit.server.events.RefUpdatedEvent;
 import com.google.gerrit.server.git.WorkQueue;
-import com.google.gerrit.server.permissions.PermissionBackendException;
 import com.googlesource.gerrit.plugins.replication.pull.ApplyObjectsCacheKey;
 import com.googlesource.gerrit.plugins.replication.pull.FetchOne;
 import com.googlesource.gerrit.plugins.replication.pull.Source;
@@ -44,7 +41,6 @@
 import com.googlesource.gerrit.plugins.replication.pull.api.ProjectInitializationAction;
 import com.googlesource.gerrit.plugins.replication.pull.api.PullReplicationApiRequestMetrics;
 import com.googlesource.gerrit.plugins.replication.pull.filter.ExcludedRefsFilter;
-import java.io.IOException;
 import java.util.concurrent.ScheduledExecutorService;
 import org.eclipse.jgit.lib.ObjectId;
 import org.junit.Before;
@@ -151,7 +147,7 @@
   }
 
   @Test
-  public void shouldDeleteRefForRefDeleteEvent() throws IOException, RestApiException {
+  public void shouldDeleteRefForRefDeleteEvent() throws Exception {
     RefUpdatedEvent event = new RefUpdatedEvent();
     RefUpdateAttribute refUpdate = new RefUpdateAttribute();
     refUpdate.refName = TEST_REF_NAME;
@@ -209,8 +205,7 @@
   }
 
   @Test
-  public void shouldCreateProjectForProjectCreatedEvent()
-      throws AuthException, PermissionBackendException {
+  public void shouldCreateProjectForProjectCreatedEvent() throws Exception {
     ProjectCreatedEvent event = new ProjectCreatedEvent();
     event.instanceId = REMOTE_INSTANCE_ID;
     event.projectName = TEST_PROJECT;
@@ -221,8 +216,7 @@
   }
 
   @Test
-  public void shouldNotCreateProjectWhenCreateMissingRepositoriesNotSet()
-      throws AuthException, PermissionBackendException {
+  public void shouldNotCreateProjectWhenCreateMissingRepositoriesNotSet() throws Exception {
     when(source.isCreateMissingRepositories()).thenReturn(false);
 
     ProjectCreatedEvent event = new ProjectCreatedEvent();
@@ -235,8 +229,7 @@
   }
 
   @Test
-  public void shouldNotCreateProjectWhenReplicationNotAllowed()
-      throws AuthException, PermissionBackendException {
+  public void shouldNotCreateProjectWhenReplicationNotAllowed() throws Exception {
     when(source.isCreateMissingRepositories()).thenReturn(false);
 
     ProjectCreatedEvent event = new ProjectCreatedEvent();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/transport/TransportProviderTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/transport/TransportProviderTest.java
index 0b28c03..9fe4d53 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/transport/TransportProviderTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/transport/TransportProviderTest.java
@@ -23,8 +23,6 @@
 import com.googlesource.gerrit.plugins.replication.CredentialsFactory;
 import com.googlesource.gerrit.plugins.replication.pull.BearerTokenProvider;
 import com.googlesource.gerrit.plugins.replication.pull.SourceConfiguration;
-import java.io.IOException;
-import java.net.URISyntaxException;
 import java.util.Optional;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.StoredConfig;
@@ -65,7 +63,7 @@
   }
 
   @Test
-  public void shouldProvideTransportHttpWithBearerToken() throws URISyntaxException, IOException {
+  public void shouldProvideTransportHttpWithBearerToken() throws Exception {
     when(bearerTokenProvider.get()).thenReturn(Optional.of("some-bearer-token"));
 
     TransportProvider transportProvider =
@@ -80,8 +78,7 @@
   }
 
   @Test
-  public void shouldProvideNativeTransportWhenNoBearerTokenProvided()
-      throws URISyntaxException, IOException {
+  public void shouldProvideNativeTransportWhenNoBearerTokenProvided() throws Exception {
 
     when(bearerTokenProvider.get()).thenReturn(Optional.empty());
 
@@ -96,8 +93,7 @@
   }
 
   @Test
-  public void shouldProvideNativeTransportWhenNoHttpSchemeProvided()
-      throws URISyntaxException, IOException {
+  public void shouldProvideNativeTransportWhenNoHttpSchemeProvided() throws Exception {
     when(bearerTokenProvider.get()).thenReturn(Optional.of("some-bearer-token"));
 
     TransportProvider transportProvider =