Fix errorprone build

Fixes:
packages/apps/Settings/tests/robotests/src/com/android/settings/language/LanguageAndInputSettingsTest.java:95: error: [MockitoCast] A bug in Mockito will cause this test to fail at runtime with a ClassCastException
        when(mContext.getSystemService(AutofillManager.class)).thenReturn(mAutofillManager);
            ^
    (see http://errorprone.info/bugpattern/MockitoCast)
  Did you mean 'when((Object) mContext.getSystemService(AutofillManager.class)).thenReturn(mAutofillManager);'?

packages/apps/Settings/tests/robotests/src/com/android/settings/search/IntentSearchViewHolderTest.java:195: error: [JUnit4TestNotRun] Test method will not be run; please add @Test annotation
    public void testBindViewElements_appSearchResult() {
                ^
    (see http://errorprone.info/bugpattern/JUnit4TestNotRun)
  Did you mean '@Test'?

Bug: 64489631
Test: m -j RUN_ERROR_PRONE=true javac-check
Merged-In: I79477f331ae447d2505a1519da09886bf07ba1a2
Merged-in: I333372699b263d02cc4083289dc746c7aacd414d
Change-Id: I8fd30fc741927de3f6527aca6d98d8851ef23794
This commit is contained in:
Colin Cross
2017-08-29 12:14:54 -07:00
parent 54eeafa052
commit 1ef4caaf3f
2 changed files with 5 additions and 1 deletions

View File

@@ -92,7 +92,8 @@ public class LanguageAndInputSettingsTest {
.thenReturn(mock(TextServicesManager.class));
when(mContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn(mDpm);
when(mContext.getSystemService(Context.INPUT_METHOD_SERVICE)).thenReturn(mImm);
when(mContext.getSystemService(AutofillManager.class)).thenReturn(mAutofillManager);
when((Object) mContext.getSystemService(AutofillManager.class))
.thenReturn(mAutofillManager);
mFragment = new TestFragment(mContext);
}

View File

@@ -50,6 +50,7 @@ import com.android.settings.search2.SearchResult.Builder;
import com.android.settings.testutils.FakeFeatureFactory;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -192,6 +193,8 @@ public class IntentSearchViewHolderTest {
assertThat(mHolder.summaryView.getVisibility()).isEqualTo(View.GONE);
}
@Test
@Ignore
public void testBindViewElements_appSearchResult() {
when(mPackageManager.getUserBadgedLabel(any(CharSequence.class),
eq(new UserHandle(USER_ID)))).thenReturn(BADGED_LABEL);