everything. I'm new to Mockito :)
Context mockContext = mock(Context.class); TelephonyManager mockTelephonyManager = mock(TelephonyManager.class); when(mockTelephonyManager.getNetworkCountryIso()).thenReturn("CN"); when(mockContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mockTelephonyManager);
the above will not work if the espresso test tries to use telephony, it still returns the system network of the ISO country. Any thoughts? thanks!
android mockito
Wenchao
source share