Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
Upgrade bazlets to latest stable-2.15
Upgrade bazlets to latest stable-2.14
Change-Id: Id3ef3b303aa06b82cff4482b311b2004491ac105
diff --git a/.bazelversion b/.bazelversion
index 9084fa2..227cea2 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-1.1.0
+2.0.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..f0f0a5f 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "f53f51fb660552d0581aa0ba52c3836ed63d56a3",
+ commit = "59529f046a5cb855d9fe3ee87110d53305ec69b9",
#local_path = "/home/<user>/projects/bazlets",
)
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);
}
}