use of com.braintreepayments.api.internal.BraintreeGraphQLHttpClient in project braintree_android by braintree.
the class MockFragmentBuilder method build.
public BraintreeFragment build() {
BraintreeFragment fragment = mock(BraintreeFragment.class);
when(fragment.getApplicationContext()).thenReturn(mContext);
when(fragment.getAuthorization()).thenReturn(mAuthorization);
when(fragment.getSessionId()).thenReturn(mSessionId);
when(fragment.getReturnUrlScheme()).thenReturn("com.braintreepayments.api.braintree");
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
((ConfigurationListener) invocation.getArguments()[0]).onConfigurationFetched(mConfiguration);
return null;
}
}).when(fragment).waitForConfiguration(any(ConfigurationListener.class));
when(fragment.getConfiguration()).thenReturn(mConfiguration);
BraintreeHttpClient httpClient = mock(BraintreeHttpClient.class);
if (mSuccessResponse != null) {
setupSuccessResponses(httpClient);
} else if (mErrorResponse != null) {
setupErrorResponses(httpClient);
}
when(fragment.getHttpClient()).thenReturn(httpClient);
BraintreeGraphQLHttpClient graphQLHttpClient = mock(BraintreeGraphQLHttpClient.class);
if (mGraphQLSuccessResponse != null) {
setupGraphQLSuccessResponses(graphQLHttpClient);
} else if (mGraphQLErrorResponse != null) {
setupGraphQLErrorResponses(graphQLHttpClient);
}
when(fragment.getGraphQLHttpClient()).thenReturn(graphQLHttpClient);
return fragment;
}
use of com.braintreepayments.api.internal.BraintreeGraphQLHttpClient in project braintree_android by braintree.
the class BraintreeFragment method setConfiguration.
protected void setConfiguration(Configuration configuration) {
mConfiguration = configuration;
getHttpClient().setBaseUrl(configuration.getClientApiUrl());
if (configuration.getGraphQL().isEnabled()) {
mGraphQLHttpClient = new BraintreeGraphQLHttpClient(configuration.getGraphQL().getUrl(), mAuthorization.getBearer());
}
}
Aggregations