Merge branch 'stable-3.0'
* stable-3.0:
Bazel: Consume mockito library from plugin API
Change-Id: Ic10c2a07488ea80a7cd2bf7997e2894cbbd922ab
diff --git a/.gitignore b/.gitignore
index 9a6a3fa..045b49d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/.primary_build_tool
/bazel-*
/eclipse-out/
+/.apt_generated/
diff --git a/WORKSPACE b/WORKSPACE
index 2934588..7c49ee6 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "1d381f01c853e2c02ae35430a8e294e485635d62",
+ commit = "d826d85285bb22d3fe817fe165a7e1d3472f65fa",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/ratelimiter/UserResolver.java b/src/main/java/com/googlesource/gerrit/plugins/ratelimiter/UserResolver.java
index 11dffed..5766a6d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/ratelimiter/UserResolver.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/ratelimiter/UserResolver.java
@@ -33,7 +33,7 @@
Optional<IdentifiedUser> getIdentifiedUser(String key) {
return isNumeric(key)
- ? Optional.ofNullable(userFactory.create(new Account.Id(Integer.parseInt(key))))
+ ? Optional.ofNullable(userFactory.create(Account.id(Integer.parseInt(key))))
: Optional.empty();
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/ConfigurationTest.java b/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/ConfigurationTest.java
index c17839d..f0490ad 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/ConfigurationTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/ConfigurationTest.java
@@ -54,12 +54,11 @@
when(pluginConfigFactoryMock.getGlobalPluginConfig(PLUGIN_NAME)).thenReturn(globalPluginConfig);
- when(administratorsGroupDescMock.getGroupUUID())
- .thenReturn(new AccountGroup.UUID("admin_uuid"));
+ when(administratorsGroupDescMock.getGroupUUID()).thenReturn(AccountGroup.uuid("admin_uuid"));
when(groupsCollectionMock.parseId("Administrators")).thenReturn(administratorsGroupDescMock);
when(someGroupDescMock.getName()).thenReturn("someGroup");
- when(someGroupDescMock.getGroupUUID()).thenReturn(new AccountGroup.UUID("some_uuid"));
+ when(someGroupDescMock.getGroupUUID()).thenReturn(AccountGroup.uuid("some_uuid"));
when(groupsCollectionMock.parseId("someGroup")).thenReturn(someGroupDescMock);
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/RateLimitUploadPackIT.java b/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/RateLimitUploadPackIT.java
index 352389b..17839b1 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/RateLimitUploadPackIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/ratelimiter/RateLimitUploadPackIT.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.ratelimiter;
+import static com.google.gerrit.testing.GerritJUnit.assertThrows;
+
import com.google.gerrit.acceptance.GlobalPluginConfig;
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
import com.google.gerrit.acceptance.TestPlugin;
@@ -55,9 +57,8 @@
createProjectWithChange(projectA);
createProjectWithChange(projectB);
- cloneProject(new Project.NameKey(projectA), user);
- exception.expect(TransportException.class);
- cloneProject(new Project.NameKey(projectB), user);
+ cloneProject(Project.nameKey(projectA), user);
+ assertThrows(TransportException.class, () -> cloneProject(Project.nameKey(projectB), user));
}
private void addUserToNewGroup() throws RestApiException {