OSDN Git Service

Fix IpClientTest
authorRemi NGUYEN VAN <reminv@google.com>
Thu, 24 Jan 2019 11:13:09 +0000 (20:13 +0900)
committerRemi NGUYEN VAN <reminv@google.com>
Thu, 24 Jan 2019 11:14:48 +0000 (20:14 +0900)
NetworkStackTests is run with a version of mockito that allows mocking
final methods, which broke mocking of the ConnectivityService.

Test: atest NetworkStackTests
Change-Id: I430fe12216c43a0c4265a504dbefafad37c09291

packages/NetworkStack/tests/src/android/net/ip/IpClientTest.java

index f21809f..4ae044d 100644 (file)
@@ -103,9 +103,7 @@ public class IpClientTest {
         MockitoAnnotations.initMocks(this);
 
         when(mContext.getSystemService(eq(Context.ALARM_SERVICE))).thenReturn(mAlarm);
-        when(mContext.getSystemServiceName(ConnectivityManager.class))
-                .thenReturn(Context.CONNECTIVITY_SERVICE);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mCm);
+        when(mContext.getSystemService(eq(ConnectivityManager.class))).thenReturn(mCm);
         when(mContext.getResources()).thenReturn(mResources);
         when(mResources.getInteger(R.integer.config_networkAvoidBadWifi))
                 .thenReturn(DEFAULT_AVOIDBADWIFI_CONFIG_VALUE);