Merge branch 'stable-3.0'

* stable-3.0:
  Upgrade bazlets to latest stable-3.0
  Upgrade bazlets to latest stable-2.16

Change-Id: Ife65dc2ca775a393ed615b4e9100f0a8a36fef40
diff --git a/WORKSPACE b/WORKSPACE
index 612a0f5..dfb4df2 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "4909dd878ded009edc140319246a2e0681763743",
+    commit = "fbe2b2fd07c95d752dced6b8624c9d5a08e8c6c6",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java b/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java
index e625187..90212f4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java
@@ -14,8 +14,8 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.events.ProjectDeletedListener;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.inject.Inject;
 
 public class DeletionListener implements ProjectDeletedListener {
@@ -29,6 +29,6 @@
 
   @Override
   public void onProjectDeleted(Event event) {
-    repoSizeCache.evict(new Project.NameKey(event.getProjectName()));
+    repoSizeCache.evict(Project.nameKey(event.getProjectName()));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java b/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java
index ca2e933..1ac9c84 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java
@@ -14,9 +14,8 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.events.GarbageCollectorListener;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.Project.NameKey;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import java.util.Properties;
@@ -33,7 +32,7 @@
 
   @Override
   public void onGarbageCollected(GarbageCollectorListener.Event event) {
-    Project.NameKey key = new NameKey(event.getProjectName());
+    Project.NameKey key = Project.nameKey(event.getProjectName());
     Properties statistics = event.getStatistics();
     if (statistics != null) {
       Number sizeOfLooseObjects = (Number) statistics.get("sizeOfLooseObjects");
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java b/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java
index 854d9ef..d735e95 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java
@@ -17,8 +17,9 @@
 import static com.googlesource.gerrit.plugins.quota.MaxRepositorySizeQuota.REPO_SIZE_CACHE;
 
 import com.google.common.cache.LoadingCache;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.extensions.restapi.RestReadView;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.gerrit.server.project.ProjectResource;
 import com.google.inject.Inject;
@@ -43,8 +44,8 @@
   }
 
   @Override
-  public QuotaInfo apply(ProjectResource rsrc) throws ExecutionException {
-    return getInfo(rsrc.getNameKey());
+  public Response<QuotaInfo> apply(ProjectResource rsrc) throws ExecutionException {
+    return Response.ok(getInfo(rsrc.getNameKey()));
   }
 
   QuotaInfo getInfo(Project.NameKey n) throws ExecutionException {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/quota/HttpModule.java
index 5a2148e..fec49cd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/HttpModule.java
@@ -16,10 +16,10 @@
 
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.LoadingCache;
+import com.google.gerrit.entities.Account;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.registration.DynamicSet;
 import com.google.gerrit.httpd.AllRequestFilter;
-import com.google.gerrit.reviewdb.client.Account;
 import com.google.gerrit.server.IdentifiedUser.GenericFactory;
 import com.google.gerrit.server.cache.CacheModule;
 import com.google.gerrit.server.config.PluginConfig;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java b/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java
index 37d1db4..5031937 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java
@@ -15,12 +15,13 @@
 package com.googlesource.gerrit.plugins.quota;
 
 import com.google.common.collect.Maps;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.extensions.restapi.Response;
 import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.extensions.restapi.RestReadView;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.config.ConfigResource;
-import com.google.gerrit.server.restapi.project.ListProjects;
 import com.google.gerrit.server.permissions.PermissionBackendException;
+import com.google.gerrit.server.restapi.project.ListProjects;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.googlesource.gerrit.plugins.quota.GetQuota.QuotaInfo;
@@ -50,15 +51,15 @@
   }
 
   @Override
-  public Map<String, QuotaInfo> apply(ConfigResource resource)
+  public Response<Map<String, QuotaInfo>> apply(ConfigResource resource)
       throws RestApiException, ExecutionException, PermissionBackendException {
     Map<String, QuotaInfo> result = Maps.newTreeMap();
     ListProjects lister = listProjects.get();
     lister.setMatchPrefix(matchPrefix);
     for (String projectName : lister.apply().keySet()) {
-      Project.NameKey n = new Project.NameKey(projectName);
+      Project.NameKey n = Project.nameKey(projectName);
       result.put(projectName, getQuota.getInfo(n));
     }
-    return result;
+    return Response.ok(result);
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java
index 16499c1..12b6e19 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.project.CreateProjectArgs;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.gerrit.server.validators.ProjectCreationValidationListener;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java
index a20ebed..ab132db 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java
@@ -22,8 +22,8 @@
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.collect.Ordering;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.annotations.PluginName;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.cache.CacheModule;
 import com.google.gerrit.server.config.PluginConfigFactory;
 import com.google.gerrit.server.git.GitRepositoryManager;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java b/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java
index 37b7b06..8745983 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java
@@ -22,6 +22,7 @@
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.RateLimiter;
+import com.google.gerrit.entities.Account;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.events.GarbageCollectorListener;
 import com.google.gerrit.extensions.events.LifecycleListener;
@@ -29,7 +30,6 @@
 import com.google.gerrit.extensions.registration.DynamicMap;
 import com.google.gerrit.extensions.registration.DynamicSet;
 import com.google.gerrit.extensions.restapi.RestApiModule;
-import com.google.gerrit.reviewdb.client.Account;
 import com.google.gerrit.server.IdentifiedUser;
 import com.google.gerrit.server.IdentifiedUser.GenericFactory;
 import com.google.gerrit.server.cache.CacheModule;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java b/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java
index 9b018ec..bd1bb27 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 
 public class Namespace {
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java
index f32e1ac..6650880 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.inject.Inject;
 import java.util.Set;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java
index 07e6e20..3dc7c06 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import org.eclipse.jgit.lib.Config;
 
 public class QuotaSection {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java b/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java
index dfac1d9..2b2f171 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java
@@ -17,8 +17,8 @@
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.RateLimiter;
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Account;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.git.validators.UploadValidationListener;
 import com.google.gerrit.server.validators.ValidationException;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeCache.java b/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeCache.java
index 2b20d59..f60fc90 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeCache.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeCache.java
@@ -14,7 +14,7 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 
 public interface RepoSizeCache {
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java b/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java
index 08a9959..50c229a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java
@@ -14,9 +14,9 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
 import com.google.gerrit.extensions.events.UsageDataPublishedListener.MetaData;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiter.java b/src/main/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiter.java
index 1a7fa98..6f5c334 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiter.java
@@ -15,8 +15,8 @@
 package com.googlesource.gerrit.plugins.quota;
 
 import com.google.common.cache.LoadingCache;
+import com.google.gerrit.entities.Account;
 import com.google.gerrit.httpd.AllRequestFilter;
-import com.google.gerrit.reviewdb.client.Account;
 import com.google.gerrit.server.CurrentUser;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java
index 592809e..316baa3 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java
@@ -14,13 +14,12 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.api.changes.NotifyHandling;
 import com.google.gerrit.extensions.events.ProjectDeletedListener;
-import com.google.gerrit.reviewdb.client.Project;
 import org.junit.Test;
 
 public class DeletionListenerTest {
@@ -28,11 +27,9 @@
 
   @Test
   public void testName() throws Exception {
-    RepoSizeCache repoSizeCache = createMock(RepoSizeCache.class);
-    Project.NameKey p = new Project.NameKey(MY_PROJECT);
-    repoSizeCache.evict(p);
+    RepoSizeCache repoSizeCache = mock(RepoSizeCache.class);
+    Project.NameKey p = Project.nameKey(MY_PROJECT);
     DeletionListener classUnderTest = new DeletionListener(repoSizeCache);
-    replay(repoSizeCache);
 
     ProjectDeletedListener.Event event =
         new ProjectDeletedListener.Event() {
@@ -48,6 +45,6 @@
         };
     classUnderTest.onProjectDeleted(event);
 
-    verify(repoSizeCache);
+    verify(repoSizeCache).evict(p);
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java
index f73ef3d..b5d141d 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java
@@ -14,14 +14,12 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.api.changes.NotifyHandling;
 import com.google.gerrit.extensions.events.GarbageCollectorListener;
-import com.google.gerrit.reviewdb.client.Project;
 import java.util.Properties;
 import org.junit.Test;
 
@@ -30,10 +28,7 @@
 
   @Test
   public void testEventWithStatistics() {
-    RepoSizeCache repoSizeCache = createMock(RepoSizeCache.class);
-    repoSizeCache.set(new Project.NameKey(PROJECT_NAME), 9999L);
-    expectLastCall();
-    replay(repoSizeCache);
+    RepoSizeCache repoSizeCache = mock(RepoSizeCache.class);
 
     GCListener listener = new GCListener(repoSizeCache);
 
@@ -43,35 +38,29 @@
 
     listener.onGarbageCollected(createEvent(PROJECT_NAME, statistics));
 
-    verify(repoSizeCache);
+    verify(repoSizeCache).set(Project.nameKey(PROJECT_NAME), 9999L);
   }
 
   @Test
   public void testEventWithoutStatistics() {
-    RepoSizeCache repoSizeCache = createMock(RepoSizeCache.class);
-    repoSizeCache.evict(new Project.NameKey(PROJECT_NAME));
-    expectLastCall();
-    replay(repoSizeCache);
+    RepoSizeCache repoSizeCache = mock(RepoSizeCache.class);
 
     GCListener listener = new GCListener(repoSizeCache);
 
     listener.onGarbageCollected(createEvent(PROJECT_NAME, null));
 
-    verify(repoSizeCache);
+    verify(repoSizeCache).evict(Project.nameKey(PROJECT_NAME));
   }
 
   @Test
   public void testEventWithEmptyStatistics() {
-    RepoSizeCache repoSizeCache = createMock(RepoSizeCache.class);
-    repoSizeCache.evict(new Project.NameKey(PROJECT_NAME));
-    expectLastCall();
-    replay(repoSizeCache);
+    RepoSizeCache repoSizeCache = mock(RepoSizeCache.class);
 
     GCListener listener = new GCListener(repoSizeCache);
 
     listener.onGarbageCollected(createEvent(PROJECT_NAME, new Properties()));
 
-    verify(repoSizeCache);
+    verify(repoSizeCache).evict(Project.nameKey(PROJECT_NAME));
   }
 
   private static GarbageCollectorListener.Event createEvent(
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java
index fa7351e..4c64bdb 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java
@@ -14,8 +14,12 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.extensions.events.UsageDataPublishedListener;
 import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
@@ -24,9 +28,9 @@
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
-import org.easymock.Capture;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.ArgumentCaptor;
 
 public class PublisherExceptionTest {
 
@@ -35,18 +39,18 @@
   private UsageDataEventCreator creator;
   private Publisher classUnderTest;
   private Appender appender;
-  private Capture<LoggingEvent> captor;
+  private ArgumentCaptor<LoggingEvent> captor;
   private DynamicSet<UsageDataPublishedListener> listeners;
   private DynamicSet<UsageDataEventCreator> creators;
 
   @Before
   public void setupClassUnderTest() {
-    listener = createMock(UsageDataPublishedListener.class);
+    listener = mock(UsageDataPublishedListener.class);
     listeners = DynamicSet.emptySet();
     listeners.add("quota", listener);
 
-    creator = createMock(UsageDataEventCreator.class);
-    expect(creator.getName()).andStubReturn(CREATOR_NAME);
+    creator = mock(UsageDataEventCreator.class);
+    when(creator.getName()).thenReturn(CREATOR_NAME);
     creators = DynamicSet.emptySet();
     creators.add("quota", creator);
 
@@ -55,25 +59,20 @@
 
   @Before
   public void setupLogging() {
-    captor = new Capture<>();
-    appender = createMock(Appender.class);
-    appender.doAppend(capture(captor));
-    expectLastCall().anyTimes();
+    captor = ArgumentCaptor.forClass(LoggingEvent.class);
+    appender = mock(Appender.class);
+    // appender.doAppend(captor.capture());
     Logger.getRootLogger().addAppender(appender);
   }
 
   @Test
   public void testExceptionInCreatorIsLogged() {
     RuntimeException ex = new RuntimeException();
-    expect(creator.create()).andStubThrow(ex);
-
-    replay(listener, creator, appender);
+    when(creator.create()).thenThrow(ex);
 
     classUnderTest.run();
 
-    verify(listener, creator, appender);
-
-    assertTrue(captor.hasCaptured());
+    verify(appender).doAppend(captor.capture());
     LoggingEvent event = captor.getValue();
     assertEquals(Level.WARN, event.getLevel());
     assertTrue(((String) event.getMessage()).contains(CREATOR_NAME));
@@ -82,39 +81,30 @@
   @Test
   public void testDataFromGoodCreatorIsPropagated() {
     RuntimeException ex = new RuntimeException();
-    expect(creator.create()).andStubThrow(ex);
+    when(creator.create()).thenThrow(ex);
 
-    UsageDataEventCreator good = createMock(UsageDataEventCreator.class);
+    UsageDataEventCreator good = mock(UsageDataEventCreator.class);
     Event data = new UsageDataEvent(null);
-    expect(good.create()).andStubReturn(data);
+    when(good.create()).thenReturn(data);
     creators.add("quota", good);
 
-    listener.onUsageDataPublished(data);
-    expectLastCall();
-
-    replay(listener, creator, good, appender);
-
     classUnderTest.run();
 
-    verify(listener, creator, appender);
+    verify(listener).onUsageDataPublished(data);
   }
 
   @Test
   public void testExceptionInListenerIsLogged() {
     RuntimeException ex = new RuntimeException();
     Event data = new UsageDataEvent(null);
-    expect(creator.create()).andStubReturn(data);
-
-    listener.onUsageDataPublished(data);
-    expectLastCall().andStubThrow(ex);
-
-    replay(listener, creator, appender);
+    when(creator.create()).thenReturn(data);
+    doThrow(ex).when(listener).onUsageDataPublished(data);
 
     classUnderTest.run();
 
-    verify(listener, creator, appender);
+    verify(listener).onUsageDataPublished(data);
 
-    assertTrue(captor.hasCaptured());
+    verify(appender).doAppend(captor.capture());
     LoggingEvent event = captor.getValue();
     assertEquals(Level.WARN, event.getLevel());
   }
@@ -123,19 +113,15 @@
   public void testIsPropagatedToGoodListener() {
     RuntimeException ex = new RuntimeException();
     Event data = new UsageDataEvent(null);
-    expect(creator.create()).andStubReturn(data);
+    when(creator.create()).thenReturn(data);
+    doThrow(ex).when(listener).onUsageDataPublished(data);
 
-    listener.onUsageDataPublished(data);
-    expectLastCall().andStubThrow(ex);
-
-    UsageDataPublishedListener good = createMock(UsageDataPublishedListener.class);
-    good.onUsageDataPublished(data);
+    UsageDataPublishedListener good = mock(UsageDataPublishedListener.class);
     listeners.add("quota", good);
 
-    replay(listener, good, creator, appender);
-
     classUnderTest.run();
 
-    verify(listener, good, creator, appender);
+    verify(listener).onUsageDataPublished(data);
+    verify(good).onUsageDataPublished(data);
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java
index d78b7e1..36fc5ff 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java
@@ -14,11 +14,9 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import com.google.gerrit.extensions.events.UsageDataPublishedListener;
 import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
@@ -30,50 +28,40 @@
   @Test
   public void testAllEventsPropagatedToListener() throws Exception {
     Event e1 = new UsageDataEvent(null);
-    UsageDataEventCreator c1 = createMock(UsageDataEventCreator.class);
-    expect(c1.create()).andStubReturn(e1);
+    UsageDataEventCreator c1 = mock(UsageDataEventCreator.class);
+    when(c1.create()).thenReturn(e1);
 
     Event e2 = new UsageDataEvent(null);
-    UsageDataEventCreator c2 = createMock(UsageDataEventCreator.class);
-    expect(c2.create()).andStubReturn(e2);
+    UsageDataEventCreator c2 = mock(UsageDataEventCreator.class);
+    when(c2.create()).thenReturn(e2);
 
     DynamicSet<UsageDataEventCreator> creators = DynamicSet.emptySet();
     creators.add("quota", c1);
     creators.add("quota", c2);
 
-    UsageDataPublishedListener listener = createMock(UsageDataPublishedListener.class);
-    listener.onUsageDataPublished(e1);
-    expectLastCall();
-    listener.onUsageDataPublished(e2);
-    expectLastCall();
+    UsageDataPublishedListener listener = mock(UsageDataPublishedListener.class);
 
-    replay(c1, c2, listener);
     DynamicSet<UsageDataPublishedListener> listeners = DynamicSet.emptySet();
     listeners.add("quota", listener);
 
     Publisher classUnderTest = new Publisher(listeners, creators);
     classUnderTest.run();
 
-    verify(c1, c2, listener);
+    verify(listener).onUsageDataPublished(e1);
+    verify(listener).onUsageDataPublished(e2);
   }
 
   @Test
   public void testEventPropagatedToAllListeners() throws Exception {
     Event event = new UsageDataEvent(null);
-    UsageDataEventCreator creator = createMock(UsageDataEventCreator.class);
-    expect(creator.create()).andStubReturn(event);
+    UsageDataEventCreator creator = mock(UsageDataEventCreator.class);
+    when(creator.create()).thenReturn(event);
     DynamicSet<UsageDataEventCreator> creators = DynamicSet.emptySet();
     creators.add("quota", creator);
 
-    UsageDataPublishedListener l1 = createMock(UsageDataPublishedListener.class);
-    l1.onUsageDataPublished(event);
-    expectLastCall();
+    UsageDataPublishedListener l1 = mock(UsageDataPublishedListener.class);
 
-    UsageDataPublishedListener l2 = createMock(UsageDataPublishedListener.class);
-    l2.onUsageDataPublished(event);
-    expectLastCall();
-
-    replay(creator, l1, l2);
+    UsageDataPublishedListener l2 = mock(UsageDataPublishedListener.class);
 
     DynamicSet<UsageDataPublishedListener> listeners = DynamicSet.emptySet();
     listeners.add("quota", l1);
@@ -82,20 +70,18 @@
     Publisher classUnderTest = new Publisher(listeners, creators);
     classUnderTest.run();
 
-    verify(creator, l1, l2);
+    verify(l1).onUsageDataPublished(event);
+    verify(l2).onUsageDataPublished(event);
   }
 
   @Test
   public void testNoEventsCreatedIfNoListenersRegistered() throws Exception {
-    UsageDataEventCreator creator = createMock(UsageDataEventCreator.class);
-    replay(creator);
+    UsageDataEventCreator creator = mock(UsageDataEventCreator.class);
     DynamicSet<UsageDataEventCreator> creators = DynamicSet.emptySet();
     creators.add("quota", creator);
 
     DynamicSet<UsageDataPublishedListener> listeners = DynamicSet.emptySet();
     Publisher classUnderTest = new Publisher(listeners, creators);
     classUnderTest.run();
-
-    verify(creator);
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java b/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java
new file mode 100644
index 0000000..3e7bc31
--- /dev/null
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java
@@ -0,0 +1,26 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.quota;
+
+import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
+import com.google.gerrit.acceptance.TestPlugin;
+import org.junit.Test;
+
+@TestPlugin(name = "quota", sysModule = "com.googlesource.gerrit.plugins.quota.Module")
+public class QuotaPluginIT extends LightweightPluginDaemonTest {
+
+  @Test
+  public void pluginCanLoad() throws Exception {}
+}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListenerTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListenerTest.java
index a6f2a47..fc6a196 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListenerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListenerTest.java
@@ -21,7 +21,7 @@
 
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.RateLimiter;
-import com.google.gerrit.reviewdb.client.Account;
+import com.google.gerrit.entities.Account;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.validators.ValidationException;
 import com.google.inject.Provider;
@@ -70,7 +70,6 @@
     when(currentUser.isIdentifiedUser()).thenReturn(true);
     when(currentUser.asIdentifiedUser().getAccountId()).thenReturn(accountId);
     when(limitsPerAccount.get(accountId)).thenThrow(new ExecutionException(null));
-    when(accountId.toString()).thenReturn("123");
   }
 
   private void setUpAnonymous() throws ExecutionException {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java
index 2b40ca4..47de700 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java
@@ -14,17 +14,15 @@
 
 package com.googlesource.gerrit.plugins.quota;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableSortedSet;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.events.UsageDataPublishedListener.Data;
 import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
-import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.project.ProjectCache;
 import java.io.File;
 import java.io.IOException;
@@ -32,9 +30,9 @@
 import org.junit.Test;
 
 public class RepoSizeEventCreatorTest {
-  private Project.NameKey p1 = new Project.NameKey("p1");
-  private Project.NameKey p2 = new Project.NameKey("p2");
-  private Project.NameKey p3 = new Project.NameKey("p3");
+  private Project.NameKey p1 = Project.nameKey("p1");
+  private Project.NameKey p2 = Project.nameKey("p2");
+  private Project.NameKey p3 = Project.nameKey("p3");
   private ProjectCache projectCache;
   private RepoSizeEventCreator classUnderTest;
   private File tmp;
@@ -45,18 +43,15 @@
     tmp = File.createTempFile("quota-test", "dir");
     tmp.delete();
     tmp.mkdir();
-    projectCache = createMock(ProjectCache.class);
+    projectCache = mock(ProjectCache.class);
     ImmutableSortedSet<Project.NameKey> projects = ImmutableSortedSet.of(p1, p2, p3);
-    expect(projectCache.all()).andStubReturn(projects);
-    repoSizeCache = createNiceMock(RepoSizeCache.class);
-    replay(projectCache);
+    when(projectCache.all()).thenReturn(projects);
+    repoSizeCache = mock(RepoSizeCache.class);
     classUnderTest = new RepoSizeEventCreator(projectCache, repoSizeCache);
   }
 
   @Test
   public void testEmpty() {
-    replay(repoSizeCache);
-
     Event event = classUnderTest.create();
 
     assertEquals("repoSize", event.getMetaData().getName());
@@ -65,8 +60,7 @@
 
   @Test
   public void testOneDataPoint() {
-    expect(repoSizeCache.get(p1)).andStubReturn(100L);
-    replay(repoSizeCache);
+    when(repoSizeCache.get(p1)).thenReturn(100L);
 
     Event event = classUnderTest.create();
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiterTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiterTest.java
index 64fe0c7..4795212 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiterTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/RestApiRateLimiterTest.java
@@ -26,7 +26,7 @@
 
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.RateLimiter;
-import com.google.gerrit.reviewdb.client.Account;
+import com.google.gerrit.entities.Account;
 import com.google.gerrit.server.CurrentUser;
 import com.google.inject.Provider;
 import com.googlesource.gerrit.plugins.quota.Module.Holder;
@@ -86,7 +86,6 @@
     when(currentUser.isIdentifiedUser()).thenReturn(true);
     when(currentUser.asIdentifiedUser().getAccountId()).thenReturn(accountId);
     when(limitsPerAccount.get(accountId)).thenThrow(new ExecutionException(null));
-    when(accountId.toString()).thenReturn("123");
   }
 
   private void setUpAnonymous() throws ExecutionException {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java b/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java
index 53253ee..77ec067 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java
@@ -17,7 +17,7 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.entities.Project;
 import org.junit.Test;
 
 public class TestNamespaceMatching {
@@ -25,22 +25,22 @@
   @Test
   public void exactNamespace() {
     String exact = "test/myProject";
-    assertTrue(new Namespace(exact).matches(new Project.NameKey("test/myProject")));
-    assertFalse(new Namespace(exact).matches(new Project.NameKey("test/myOtherProject")));
+    assertTrue(new Namespace(exact).matches(Project.nameKey("test/myProject")));
+    assertFalse(new Namespace(exact).matches(Project.nameKey("test/myOtherProject")));
   }
 
   @Test
   public void patternNamespace() {
     String pattern = "test/*";
-    assertTrue(new Namespace(pattern).matches(new Project.NameKey("test/myProject")));
-    assertFalse(new Namespace(pattern).matches(new Project.NameKey("other/myOtherProject")));
+    assertTrue(new Namespace(pattern).matches(Project.nameKey("test/myProject")));
+    assertFalse(new Namespace(pattern).matches(Project.nameKey("other/myOtherProject")));
   }
 
   @Test
   public void regExp() {
     String pattern = "^test/.*/my.*";
-    assertTrue(new Namespace(pattern).matches(new Project.NameKey("test/a/myProject")));
-    assertTrue(new Namespace(pattern).matches(new Project.NameKey("test/b/myOtherProject")));
-    assertFalse(new Namespace(pattern).matches(new Project.NameKey("other/otherProject")));
+    assertTrue(new Namespace(pattern).matches(Project.nameKey("test/a/myProject")));
+    assertTrue(new Namespace(pattern).matches(Project.nameKey("test/b/myOtherProject")));
+    assertFalse(new Namespace(pattern).matches(Project.nameKey("other/otherProject")));
   }
 }