Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a test_JavaHttpProvider that doesn't use the Apache HttpClient pr… #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -23,6 +23,7 @@
import com.here.account.auth.provider.FromHereCredentialsIniFile;
import com.here.account.auth.provider.FromHereCredentialsIniStream;
import com.here.account.http.HttpProvider;
import com.here.account.http.java.JavaHttpProvider;
import com.here.account.util.Clock;
import com.here.account.util.SettableSystemClock;
import org.junit.Ignore;
Expand All @@ -47,16 +48,32 @@ public void test_builder_basic() throws IOException {
try (
HereAccessTokenProvider accessTokens = HereAccessTokenProvider.builder().build()
) {
String accessToken = accessTokens.getAccessToken();
assertTrue("accessToken was null", null != accessToken);
assertTrue("accessToken was blank", accessToken.trim().length() > 0);
do_basic(accessTokens);

AccessTokenResponse accessTokenResponse = accessTokens.getAccessTokenResponse();
assertTrue("accessTokenResponse was null", null != accessTokenResponse);
assertEquals("tokenType invalid", "bearer", accessTokenResponse.getTokenType());
}
}

protected void do_basic(HereAccessTokenProvider accessTokens) {
String accessToken = accessTokens.getAccessToken();
assertTrue("accessToken was null", null != accessToken);
assertTrue("accessToken was blank", accessToken.trim().length() > 0);

AccessTokenResponse accessTokenResponse = accessTokens.getAccessTokenResponse();
assertTrue("accessTokenResponse was null", null != accessTokenResponse);
assertEquals("tokenType invalid", "bearer", accessTokenResponse.getTokenType());
}

@Test
public void test_JavaHttpProvider() throws IOException {
try (
HereAccessTokenProvider accessTokens = HereAccessTokenProvider.builder().setHttpProvider(JavaHttpProvider.builder().build()).build();
) {
do_basic(accessTokens);

}

}

private static final int ONE_HOUR_SKEW_MILLIS = 60 * 60 * 1000;

@Test
Expand Down