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

Commit 8e25dcae authored by Tsung-Mao Fang's avatar Tsung-Mao Fang
Browse files

Fix broken test

- Remove a test which is a non-public method.
- Re-implemented the test.

Fix: 180874869
Test: Run robo test
Change-Id: Ic9716278653c874a8f7d98b56b7e32f19d157382
parent a173e4ee
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -24,12 +24,9 @@ import android.content.Context;
import android.net.ConnectivityManager;
import android.net.ProxyInfo;

import androidx.preference.Preference;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
@@ -39,7 +36,7 @@ public class GlobalHttpProxyPreferenceControllerTest {

    private static final String KEY_GLOBAL_HTTP_PROXY = "global_http_proxy";

    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
    @Mock
    private Context mContext;
    @Mock
    private ConnectivityManager mCm;
@@ -49,6 +46,7 @@ public class GlobalHttpProxyPreferenceControllerTest {
    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mCm);
        mController = new GlobalHttpProxyPreferenceController(mContext);
    }

@@ -61,12 +59,6 @@ public class GlobalHttpProxyPreferenceControllerTest {
        assertThat(mController.isAvailable()).isTrue();
    }

    @Test
    public void testHandlePreferenceTreeClick() {
        assertThat(mController.handlePreferenceTreeClick(new Preference(mContext, null, 0, 0)))
                .isFalse();
    }

    @Test
    public void testGetPreferenceKey() {
        assertThat(mController.getPreferenceKey()).isEqualTo(KEY_GLOBAL_HTTP_PROXY);