Merge "Add afterclass method to remove static field"

This commit is contained in:
TreeHugger Robot
2018-04-03 04:41:57 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfile; import com.android.settingslib.bluetooth.LocalBluetoothProfile;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager; import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -88,6 +89,11 @@ public class DeviceProfilesSettingsTest {
when(mDeviceManager.findDevice(any())).thenReturn(mCachedDevice); when(mDeviceManager.findDevice(any())).thenReturn(mCachedDevice);
} }
@After
public void tearDown() {
ReflectionHelpers.setStaticField(LocalBluetoothManager.class, "sInstance", null);
}
@Test @Test
public void deviceHasHighQualityAudio() { public void deviceHasHighQualityAudio() {
when(mProfile.supportsHighQualityAudio(any())).thenReturn(true); when(mProfile.supportsHighQualityAudio(any())).thenReturn(true);

View File

@@ -33,6 +33,7 @@ import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter; import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager; import com.android.settingslib.bluetooth.LocalBluetoothManager;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -67,6 +68,11 @@ public class LocalDeviceNameDialogFragmentTest {
when(mFragment.getContext()).thenReturn(mContext); when(mFragment.getContext()).thenReturn(mContext);
} }
@After
public void tearDown() {
ReflectionHelpers.setStaticField(LocalBluetoothManager.class, "sInstance", null);
}
@Test @Test
public void diaglogTriggersShowSoftInput() { public void diaglogTriggersShowSoftInput() {
FragmentTestUtil.startFragment(mFragment); FragmentTestUtil.startFragment(mFragment);

View File

@@ -24,7 +24,6 @@ import com.android.settings.search.SearchIndexProviderCodeInspector;
import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -55,7 +54,6 @@ public class CodeInspectionTest {
new BasePreferenceControllerSignatureInspector(mClasses).run(); new BasePreferenceControllerSignatureInspector(mClasses).run();
} }
@Ignore("b/73960706")
@Test @Test
public void runSearchIndexProviderCodeInspection() { public void runSearchIndexProviderCodeInspection() {
new SearchIndexProviderCodeInspector(mClasses).run(); new SearchIndexProviderCodeInspector(mClasses).run();