Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
Init: Default to yes only for currently configured providers
Change-Id: Ie6c0d2b4db52ccf1c80ce1a5867987fd0bee66d8
diff --git a/.bazelversion b/.bazelversion
index 9084fa2..7ec1d6d 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-1.1.0
+2.1.0
diff --git a/.gitignore b/.gitignore
index b9fe628..c20030a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/.apt_generated
/.classpath
/.project
/.settings
diff --git a/WORKSPACE b/WORKSPACE
index 5bfeaa2..b1c2133 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "f53f51fb660552d0581aa0ba52c3836ed63d56a3",
+ commit = "1b6fc9b39001806b37a4eedbb0a4816daf1a227d",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 08ddcdc..33f9bd0 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -68,6 +68,13 @@
bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
```
+To execute the tests run either one of:
+
+```
+ bazel test --test_tag_filters=@PLUGIN@ //...
+ bazel test plugins/@PLUGIN@:@PLUGIN@_tests
+```
+
This project can be imported into the Eclipse IDE.
Add the plugin name to the `CUSTOM_PLUGINS` set in
Gerrit core in `tools/bzl/plugins.bzl`, and execute:
@@ -75,3 +82,7 @@
```
./tools/eclipse/project.py
```
+
+[Back to @PLUGIN@ documentation index][index]
+
+[index]: index.html
diff --git a/src/test/java/com/googlesource/gerrit/plugins/oauth/OAuth2AccessTokenJsonExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/oauth/OAuth2AccessTokenJsonExtractorTest.java
index 09df7ee..ccc1db3 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/oauth/OAuth2AccessTokenJsonExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/oauth/OAuth2AccessTokenJsonExtractorTest.java
@@ -14,12 +14,12 @@
package com.googlesource.gerrit.plugins.oauth;
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import static org.junit.Assert.assertEquals;
import static org.scribe.model.OAuthConstants.ACCESS_TOKEN;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.scribe.exceptions.OAuthException;
import org.scribe.extractors.AccessTokenExtractor;
import org.scribe.model.Token;
@@ -33,8 +33,6 @@
"{ \"" + ACCESS_TOKEN + "\" : \"" + TOKEN + "\"}'";
private static final String MESSAGE = "Cannot extract a token from a null or empty String";
- @Rule public ExpectedException exception = ExpectedException.none();
-
@Test
public void parseResponse() throws Exception {
Token token = extractor.extract(RESPONSE);
@@ -49,22 +47,24 @@
@Test
public void failParseNonJsonResponse() throws Exception {
- exception.expect(OAuthException.class);
- exception.expectMessage("Cannot extract an access token. Response was: " + RESPONSE_NON_JSON);
- extractor.extract(RESPONSE_NON_JSON);
+ OAuthException thrown =
+ assertThrows(OAuthException.class, () -> extractor.extract(RESPONSE_NON_JSON));
+ assertThat(thrown)
+ .hasMessageThat()
+ .contains("Cannot extract an access token. Response was: " + RESPONSE_NON_JSON);
}
@Test
public void shouldThrowExceptionIfForNullParameter() throws Exception {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage(MESSAGE);
- extractor.extract(null);
+ IllegalArgumentException thrown =
+ assertThrows(IllegalArgumentException.class, () -> extractor.extract(null));
+ assertThat(thrown).hasMessageThat().contains(MESSAGE);
}
@Test
public void shouldThrowExceptionIfForEmptyString() throws Exception {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage(MESSAGE);
- extractor.extract("");
+ IllegalArgumentException thrown =
+ assertThrows(IllegalArgumentException.class, () -> extractor.extract(""));
+ assertThat(thrown).hasMessageThat().contains(MESSAGE);
}
}
diff --git a/tools/BUILD b/tools/BUILD
new file mode 100644
index 0000000..1fa2160
--- /dev/null
+++ b/tools/BUILD
@@ -0,0 +1 @@
+# Empty file - bazel treat directories with BUILD file as a package
\ No newline at end of file