I am using Robolectric and trying to create a Shadow object of GoogleApiClient but unsuccessfully. The methods from the Shadow class are never called. The GoogleApiClient is interface - could that be a problem? Is there any way how to 'shadow' the GoogleApiClient interface (or simulate GoogleApiClient in test)?
Implementation:
@Implements(GoogleApiClient.class)
public class ShadowGoogleApiClient {
public void __constructor__ (){
System.out.println("__constructor____constructor__");
}
@Implementation
void connect() {
System.out.println("connectconnectconnect");
}
@Implementation
boolean isConnected() {
System.out.println("isConnectedisConnected");
return false;
}
@Implementation
boolean isConnecting() {
System.out.println("isConnectingisConnecting");
return false;
}
}
and I've defined the Shadow class in my test:
@Config(shadows = {ShadowGoogleApiClient.class},
constants = BuildConfig.class)
@RunWith(CustomRobolectricRunner.class)
public class ApiTest {
...
}