Skip to content

Commit 0d840a3

Browse files
committed
lint fix
1 parent 820b8ce commit 0d840a3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

auth/src/test/java/com/google/cloud/auth/samples/AuthExampleIT.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import static org.junit.Assert.assertTrue;
2121

2222
import com.google.api.apikeys.v2.Key;
23+
import com.google.api.gax.rpc.InvalidArgumentException;
2324
import com.google.cloud.ServiceOptions;
2425
import io.grpc.StatusRuntimeException;
25-
import com.google.api.gax.rpc.InvalidArgumentException;
2626
import java.io.ByteArrayOutputStream;
2727
import java.io.IOException;
2828
import java.io.PrintStream;
@@ -66,15 +66,12 @@ public void testAuthExplicitNoPath() throws IOException {
6666
@Test
6767
public void testAuthApiKey() throws IOException, IllegalStateException {
6868
String projectId = ServiceOptions.getDefaultProjectId();
69-
java.util.Random random = new java.util.Random();
70-
String keyDisplayName = "Test API Key " + random.nextInt();
69+
String keyDisplayName = "Test API Key";
7170
String service = "language.googleapis.com";
7271
String method = "google.cloud.language.v2.LanguageService.AnalyzeSentiment";
7372
Key apiKey = null;
7473
try {
7574
apiKey = AuthTestUtils.createTestApiKey(projectId, keyDisplayName, service, method);
76-
assertNotNull(apiKey);
77-
System.out.println("key string " + apiKey.getKeyString());
7875
String output = authenticateUsingApiKeyWithRetry(apiKey.getKeyString());
7976
assertTrue(output.contains("magnitude:"));
8077
} finally {
@@ -92,7 +89,7 @@ static String authenticateUsingApiKeyWithRetry(String apiKey) throws IOException
9289
for (int i = 0; i < retries; i++) {
9390
try {
9491
return ApiKeyAuthExample.authenticateUsingApiKey(apiKey);
95-
} catch (StatusRuntimeException | InvalidArgumentException e ) {
92+
} catch (StatusRuntimeException | InvalidArgumentException e) {
9693
if (e.getMessage().contains("API key expired")) {
9794
System.out.println("API key not yet active, retrying...");
9895
try {

0 commit comments

Comments
 (0)