use of com.telenor.mobileconnect.operatordiscovery.OperatorDiscoveryAPI.OperatorDiscoveryResult in project connect-android-sdk by telenordigital.
the class MobileConnectTestHelper method getValidOperatorDiscoveryApiMock.
private static OperatorDiscoveryAPI getValidOperatorDiscoveryApiMock() {
final OperatorDiscoveryAPI.OperatorDiscoveryResult odResult = mock(OperatorDiscoveryAPI.OperatorDiscoveryResult.class);
when(odResult.getWellKnownEndpoint()).thenReturn(MOCKED_WELL_KNOWN_ENDPONT);
when(odResult.getMobileConnectApiUrl()).thenReturn(HttpUrl.parse(MOCKED_API_URL));
when(odResult.getClientId()).thenReturn(MOCKED_CLIENT_ID);
OperatorDiscoveryAPI api = mock(OperatorDiscoveryAPI.class);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Callback<OperatorDiscoveryResult> callback = (Callback<OperatorDiscoveryResult>) invocation.getArguments()[4];
callback.success(odResult, null);
return null;
}
}).when(api).getOperatorDiscoveryResult_ForMccMnc(anyString(), anyString(), anyString(), anyString(), any(Callback.class));
return api;
}
use of com.telenor.mobileconnect.operatordiscovery.OperatorDiscoveryAPI.OperatorDiscoveryResult in project connect-android-sdk by telenordigital.
the class MobileConnectTestHelper method getFailingOperatorDiscoveryApiMock.
private static OperatorDiscoveryAPI getFailingOperatorDiscoveryApiMock() {
OperatorDiscoveryAPI api = mock(OperatorDiscoveryAPI.class);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Callback<OperatorDiscoveryResult> callback = (Callback<OperatorDiscoveryResult>) invocation.getArguments()[4];
callback.failure(null);
return null;
}
}).when(api).getOperatorDiscoveryResult_ForMccMnc(anyString(), anyString(), anyString(), anyString(), any(Callback.class));
return api;
}
Aggregations