Skip to content

Commit

Permalink
fix imports and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
shubha-rajan committed May 12, 2021
1 parent c4b430c commit bfc1e86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Expand Up @@ -70,7 +70,7 @@ public HttpCredentialsAdapter(Credentials credentials) {
}

/** A getter for the credentials instance being used */
public Credentials getCredentials(){
public Credentials getCredentials() {
return credentials;
}

Expand Down
Expand Up @@ -31,6 +31,7 @@

package com.google.auth.http;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

Expand All @@ -40,6 +41,7 @@
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpTransport;
import com.google.auth.Credentials;
import com.google.auth.oauth2.GoogleCredentialsTest.MockTokenServerTransportFactory;
import com.google.auth.oauth2.MockTokenCheckingTransport;
import com.google.auth.oauth2.OAuth2Credentials;
Expand Down Expand Up @@ -150,12 +152,10 @@ public void initialize_noURI() throws IOException {
String authorizationHeader = requestHeaders.getAuthorization();
assertEquals(authorizationHeader, expectedAuthorization);
}
}

@Test
public void getCredentials() throws IOException {
public void getCredentials() {
final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2";
final String expectedAuthorization = InternalAuthHttpConstants.BEARER_PREFIX + accessToken;
MockTokenServerTransportFactory tokenServerTransportFactory =
new MockTokenServerTransportFactory();
tokenServerTransportFactory.transport.addClient(CLIENT_ID, CLIENT_SECRET);
Expand All @@ -170,7 +170,7 @@ public void getCredentials() throws IOException {
.build();

HttpCredentialsAdapter adapter = new HttpCredentialsAdapter(credentials);
OAuth2Credentials returnedCredentials = adapter.getCredentials();
assertThat(returnedCredentials, instanceOf(OAuth2Credentials.class));
Credentials returnedCredentials = adapter.getCredentials();
assertThat(returnedCredentials, instanceOf(Credentials.class));
}
}
6 changes: 6 additions & 0 deletions oauth2_http/pom.xml
Expand Up @@ -141,5 +141,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

0 comments on commit bfc1e86

Please sign in to comment.