Loading core/tests/coretests/src/android/net/NetworkScorerAppManagerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,10 @@ import android.provider.Settings; import android.test.InstrumentationTestCase; import com.android.internal.R; import java.util.List; import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.compat.ArgumentMatcher; public class NetworkScorerAppManagerTest extends InstrumentationTestCase { @Mock private Context mMockContext; Loading Loading @@ -218,7 +218,7 @@ public class NetworkScorerAppManagerTest extends InstrumentationTestCase { when(mMockPm.resolveService( Mockito.argThat(new ArgumentMatcher<Intent>() { @Override public boolean matches(Object object) { public boolean matchesObject(Object object) { Intent intent = (Intent) object; return NetworkScoreManager.ACTION_RECOMMEND_NETWORKS .equals(intent.getAction()) Loading media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ import static android.hardware.camera2.CameraDevice.TEMPLATE_PREVIEW; import com.android.mediaframeworktest.MediaFrameworkIntegrationTestRunner; import org.mockito.ArgumentMatcher; import org.mockito.ArgumentCaptor; import org.mockito.compat.ArgumentMatcher; import static org.mockito.Mockito.*; public class CameraDeviceBinderTest extends AndroidTestCase { Loading Loading @@ -158,7 +158,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { class IsMetadataNotEmpty extends ArgumentMatcher<CameraMetadataNative> { @Override public boolean matches(Object obj) { public boolean matchesObject(Object obj) { return !((CameraMetadataNative) obj).isEmpty(); } } Loading services/tests/servicestests/src/com/android/server/NetworkScoreServiceTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -271,8 +271,8 @@ public class NetworkScoreServiceTest { final Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_RECOMMENDATION_RESULT, providerResult); doAnswer(invocation -> { bundle.putInt(EXTRA_SEQUENCE, invocation.getArgumentAt(2, int.class)); invocation.getArgumentAt(1, IRemoteCallback.class).sendResult(bundle); bundle.putInt(EXTRA_SEQUENCE, invocation.getArgument(2)); invocation.<IRemoteCallback>getArgument(1).sendResult(bundle); return null; }).when(mRecommendationProvider) .requestRecommendation(eq(mRecommendationRequest), isA(IRemoteCallback.class), Loading Loading @@ -336,7 +336,7 @@ public class NetworkScoreServiceTest { injectProvider(); final Bundle bundle = new Bundle(); doAnswer(invocation -> { invocation.getArgumentAt(1, IRemoteCallback.class).sendResult(bundle); invocation.<IRemoteCallback>getArgument(1).sendResult(bundle); return null; }).when(mRecommendationProvider) .requestRecommendation(eq(mRecommendationRequest), isA(IRemoteCallback.class), Loading Loading @@ -634,7 +634,7 @@ public class NetworkScoreServiceTest { IBinder mockBinder = mock(IBinder.class); when(mockBinder.queryLocalInterface(anyString())) .thenReturn(mRecommendationProvider); invocation.getArgumentAt(1, ServiceConnection.class) invocation.<ServiceConnection>getArgument(1) .onServiceConnected(componentName, mockBinder); return true; } Loading services/tests/servicestests/src/com/android/server/devicepolicy/MockUtils.java +6 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.mockito.Mockito; import org.mockito.hamcrest.MockitoHamcrest; public class MockUtils { private MockUtils() { Loading @@ -47,7 +48,7 @@ public class MockUtils { description.appendText("UserHandle: user-id= \"" + userId + "\""); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Intent checkIntentComponent(final ComponentName component) { Loading @@ -63,7 +64,7 @@ public class MockUtils { description.appendText("Intent: component=\"" + component + "\""); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Intent checkIntentAction(final String action) { Loading @@ -79,7 +80,7 @@ public class MockUtils { description.appendText("Intent: action=\"" + action + "\""); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Intent checkIntent(final Intent intent) { Loading @@ -94,7 +95,7 @@ public class MockUtils { description.appendText(intent.toString()); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Bundle checkUserRestrictions(String... keys) { Loading @@ -111,7 +112,7 @@ public class MockUtils { description.appendText("User restrictions=" + getRestrictionsAsString(expected)); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } private static String getRestrictionsAsString(Bundle b) { Loading services/tests/servicestests/src/com/android/server/webkit/WebViewUpdateServiceTest.java +4 −7 Original line number Diff line number Diff line Loading @@ -32,14 +32,12 @@ import android.webkit.WebViewFactory; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderResponse; import org.hamcrest.Description; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Matchers; import org.mockito.ArgumentMatcher; import org.mockito.compat.ArgumentMatcher; import java.util.concurrent.CountDownLatch; Loading Loading @@ -131,14 +129,13 @@ public class WebViewUpdateServiceTest { } @Override public boolean matches(Object p) { public boolean matchesObject(Object p) { return ((PackageInfo) p).packageName.equals(mPackageName); } // Provide a more useful description in case of mismatch @Override public void describeTo (Description description) { description.appendText(String.format("PackageInfo with name '%s'", mPackageName)); public String toString() { return String.format("PackageInfo with name '%s'", mPackageName); } } Loading Loading
core/tests/coretests/src/android/net/NetworkScorerAppManagerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,10 @@ import android.provider.Settings; import android.test.InstrumentationTestCase; import com.android.internal.R; import java.util.List; import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.compat.ArgumentMatcher; public class NetworkScorerAppManagerTest extends InstrumentationTestCase { @Mock private Context mMockContext; Loading Loading @@ -218,7 +218,7 @@ public class NetworkScorerAppManagerTest extends InstrumentationTestCase { when(mMockPm.resolveService( Mockito.argThat(new ArgumentMatcher<Intent>() { @Override public boolean matches(Object object) { public boolean matchesObject(Object object) { Intent intent = (Intent) object; return NetworkScoreManager.ACTION_RECOMMEND_NETWORKS .equals(intent.getAction()) Loading
media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ import static android.hardware.camera2.CameraDevice.TEMPLATE_PREVIEW; import com.android.mediaframeworktest.MediaFrameworkIntegrationTestRunner; import org.mockito.ArgumentMatcher; import org.mockito.ArgumentCaptor; import org.mockito.compat.ArgumentMatcher; import static org.mockito.Mockito.*; public class CameraDeviceBinderTest extends AndroidTestCase { Loading Loading @@ -158,7 +158,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { class IsMetadataNotEmpty extends ArgumentMatcher<CameraMetadataNative> { @Override public boolean matches(Object obj) { public boolean matchesObject(Object obj) { return !((CameraMetadataNative) obj).isEmpty(); } } Loading
services/tests/servicestests/src/com/android/server/NetworkScoreServiceTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -271,8 +271,8 @@ public class NetworkScoreServiceTest { final Bundle bundle = new Bundle(); bundle.putParcelable(EXTRA_RECOMMENDATION_RESULT, providerResult); doAnswer(invocation -> { bundle.putInt(EXTRA_SEQUENCE, invocation.getArgumentAt(2, int.class)); invocation.getArgumentAt(1, IRemoteCallback.class).sendResult(bundle); bundle.putInt(EXTRA_SEQUENCE, invocation.getArgument(2)); invocation.<IRemoteCallback>getArgument(1).sendResult(bundle); return null; }).when(mRecommendationProvider) .requestRecommendation(eq(mRecommendationRequest), isA(IRemoteCallback.class), Loading Loading @@ -336,7 +336,7 @@ public class NetworkScoreServiceTest { injectProvider(); final Bundle bundle = new Bundle(); doAnswer(invocation -> { invocation.getArgumentAt(1, IRemoteCallback.class).sendResult(bundle); invocation.<IRemoteCallback>getArgument(1).sendResult(bundle); return null; }).when(mRecommendationProvider) .requestRecommendation(eq(mRecommendationRequest), isA(IRemoteCallback.class), Loading Loading @@ -634,7 +634,7 @@ public class NetworkScoreServiceTest { IBinder mockBinder = mock(IBinder.class); when(mockBinder.queryLocalInterface(anyString())) .thenReturn(mRecommendationProvider); invocation.getArgumentAt(1, ServiceConnection.class) invocation.<ServiceConnection>getArgument(1) .onServiceConnected(componentName, mockBinder); return true; } Loading
services/tests/servicestests/src/com/android/server/devicepolicy/MockUtils.java +6 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.mockito.Mockito; import org.mockito.hamcrest.MockitoHamcrest; public class MockUtils { private MockUtils() { Loading @@ -47,7 +48,7 @@ public class MockUtils { description.appendText("UserHandle: user-id= \"" + userId + "\""); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Intent checkIntentComponent(final ComponentName component) { Loading @@ -63,7 +64,7 @@ public class MockUtils { description.appendText("Intent: component=\"" + component + "\""); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Intent checkIntentAction(final String action) { Loading @@ -79,7 +80,7 @@ public class MockUtils { description.appendText("Intent: action=\"" + action + "\""); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Intent checkIntent(final Intent intent) { Loading @@ -94,7 +95,7 @@ public class MockUtils { description.appendText(intent.toString()); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } public static Bundle checkUserRestrictions(String... keys) { Loading @@ -111,7 +112,7 @@ public class MockUtils { description.appendText("User restrictions=" + getRestrictionsAsString(expected)); } }; return Mockito.argThat(m); return MockitoHamcrest.argThat(m); } private static String getRestrictionsAsString(Bundle b) { Loading
services/tests/servicestests/src/com/android/server/webkit/WebViewUpdateServiceTest.java +4 −7 Original line number Diff line number Diff line Loading @@ -32,14 +32,12 @@ import android.webkit.WebViewFactory; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderResponse; import org.hamcrest.Description; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.Matchers; import org.mockito.ArgumentMatcher; import org.mockito.compat.ArgumentMatcher; import java.util.concurrent.CountDownLatch; Loading Loading @@ -131,14 +129,13 @@ public class WebViewUpdateServiceTest { } @Override public boolean matches(Object p) { public boolean matchesObject(Object p) { return ((PackageInfo) p).packageName.equals(mPackageName); } // Provide a more useful description in case of mismatch @Override public void describeTo (Description description) { description.appendText(String.format("PackageInfo with name '%s'", mPackageName)); public String toString() { return String.format("PackageInfo with name '%s'", mPackageName); } } Loading