Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;

import com.google.auth.CredentialTypeForMetrics;
import com.google.auth.RequestMetadataCallback;
Expand All @@ -45,10 +46,14 @@

@RunWith(JUnit4.class)
public class MutableCredentialsTest {
ServiceAccountCredentials initialCredentials = mock(ServiceAccountCredentials.class);
ServiceAccountCredentials initialScopedCredentials = mock(ServiceAccountCredentials.class);
ServiceAccountCredentials updatedCredentials = mock(ServiceAccountCredentials.class);
ServiceAccountCredentials updatedScopedCredentials = mock(ServiceAccountCredentials.class);
ServiceAccountCredentials initialCredentials =
mock(ServiceAccountCredentials.class, withSettings().withoutAnnotations());
ServiceAccountCredentials initialScopedCredentials =
mock(ServiceAccountCredentials.class, withSettings().withoutAnnotations());
ServiceAccountCredentials updatedCredentials =
mock(ServiceAccountCredentials.class, withSettings().withoutAnnotations());
ServiceAccountCredentials updatedScopedCredentials =
mock(ServiceAccountCredentials.class, withSettings().withoutAnnotations());
Set<String> scopes = new HashSet<>(Arrays.asList("scope-a", "scope-b"));
Map<String, List<String>> initialMetadata =
Collections.singletonMap("Authorization", Collections.singletonList("v1"));
Expand All @@ -70,7 +75,8 @@ public void testCreateMutableCredentials() throws IOException {
MutableCredentials credentials = new MutableCredentials(initialCredentials, scopes);
URI testUri = URI.create("https://spanner.googleapis.com");
Executor executor = mock(Executor.class);
RequestMetadataCallback callback = mock(RequestMetadataCallback.class);
RequestMetadataCallback callback =
mock(RequestMetadataCallback.class, withSettings().withoutAnnotations());

validateInitialDelegatedCredentialsAreSet(credentials, testUri);

Expand Down Expand Up @@ -111,7 +117,8 @@ public void testUpdateMutableCredentials() throws IOException {
MutableCredentials credentials = new MutableCredentials(initialCredentials, scopes);
URI testUri = URI.create("https://example.com");
Executor executor = mock(Executor.class);
RequestMetadataCallback callback = mock(RequestMetadataCallback.class);
RequestMetadataCallback callback =
mock(RequestMetadataCallback.class, withSettings().withoutAnnotations());

validateInitialDelegatedCredentialsAreSet(credentials, testUri);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.withSettings;

import com.google.auth.Credentials;
import com.google.cloud.NoCredentials;
Expand Down Expand Up @@ -477,7 +478,7 @@ public void testSpannerPoolKeyEquality() {
.setUri(
"cloudspanner://localhost:9010/projects/p1/instances/i/databases/d"
+ "?minSessions=200;maxSessions=400;numChannels=8;usePlainText=true;userAgent=test-agent")
.setCredentials(mock(Credentials.class))
.setCredentials(mock(Credentials.class, withSettings().withoutAnnotations()))
.build();
// options2 equals the default session pool options, and is therefore equal to ConnectionOptions
// without any session pool configuration.
Expand Down
Loading