Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4923f67f authored by William Escande's avatar William Escande
Browse files

ErrorProne: Enforce & fix MockNotUsedInProduction

See https://errorprone.info/bugpattern/MockNotUsedInProduction

Bug: 344658662
Test: m BluetoothInstrumentationTests
Flag: Exempt Build and test only
Change-Id: I83a8cb5becddb1e7e226a15cf277863481e907f4
parent 8e5c9694
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -325,6 +325,7 @@ android_app {
            "-Xep:ClassCanBeStatic:ERROR",
            "-Xep:InlineMeInliner:ERROR",
            "-Xep:InvalidBlockTag:ERROR",
            "-Xep:MockNotUsedInProduction:ERROR",
            "-Xep:UnusedMethod:ERROR",
            "-Xep:UnusedVariable:ERROR",
            "-XepExcludedPaths:.*/srcjars/.*", // Exclude generated files
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ java_defaults {
            "-Xep:InlineMeInliner:ERROR",
            "-Xep:InvalidBlockTag:ERROR",
            "-Xep:InvalidInlineTag:ERROR",
            "-Xep:MockNotUsedInProduction:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:StringCharset:ERROR",
            "-Xep:UnnecessaryAssignment:ERROR",
+0 −6
Original line number Diff line number Diff line
@@ -86,13 +86,9 @@ public class AvrcpControllerServiceTest {
    @Mock private AvrcpControllerStateMachine mStateMachine2;
    @Mock private AvrcpControllerNativeInterface mNativeInterface;

    @Mock private Resources mMockResources;

    private BluetoothDevice mRemoteDevice;
    private BluetoothDevice mRemoteDevice2;

    @Mock private AvrcpControllerStateMachine mAvrcpStateMachine;

    @Before
    public void setUp() throws Exception {
        Context targetContext = InstrumentationRegistry.getTargetContext();
@@ -105,8 +101,6 @@ public class AvrcpControllerServiceTest {
        assertThat(mAdapter).isNotNull();
        // Set a mock A2dpSinkService for audio focus calls
        A2dpSinkService.setA2dpSinkService(mA2dpSinkService);
        when(mMockResources.getBoolean(R.bool.a2dp_sink_automatically_request_audio_focus))
                .thenReturn(true);

        mRemoteDevice = mAdapter.getRemoteDevice(REMOTE_DEVICE_ADDRESS);
        mService.mDeviceStateMap.put(mRemoteDevice, mStateMachine);
+0 −2
Original line number Diff line number Diff line
@@ -784,8 +784,6 @@ public class GattServiceBinderTest {

    @Test
    public void disconnectAll() throws Exception {
        IPeriodicAdvertisingCallback callback = mock(IPeriodicAdvertisingCallback.class);

        mBinder.disconnectAll(mAttributionSource);

        verify(mService).disconnectAll(mAttributionSource);
+0 −5
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ import android.util.Log;
import androidx.test.filters.MediumTest;
import androidx.test.runner.AndroidJUnit4;

import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.vcard.VCardConstants;
import com.android.vcard.VCardEntry;
import com.android.vcard.VCardProperty;
@@ -96,9 +94,6 @@ public class MapClientContentTest {

    @Rule public MockitoRule mockitoRule = MockitoJUnit.rule();

    @Mock private AdapterService mAdapterService;
    @Mock private DatabaseManager mDatabaseManager;
    @Mock private MapClientService mMockMapClientService;
    @Mock private Context mMockContext;
    @Mock private MapClientContent.Callbacks mCallbacks;

Loading