我想用以下单元测试单元测试方法,并希望获得有关如何为代客警报方法编写单元测试的帮助
public void onCreate() {
mPreferences = getSharedPreferences(PREFS_TAG, 0);
mSpeedAlertPreferences = new SpeedAlertPreferences(getSharedPreferences(SpeedAlert.PREFS_TAG, 0));
mGeoFencingPreferences = new GeoFencingPreferences(getSharedPreferences(GeoFencing.PREFS_TAG, 0));
if (!isEnabled()) {
Log.d(LOG_TAG, "Disabled by configuration");
return;
}
mLocationTracing = getSharedPreferences(PREFS_LOCATION_MANAGER, 0).getBoolean(PREF_LOCATION_TRACING, true);
mConfigurationManager = CoreServices.getConfigurationManager(this);
mAlarmManager = new AlarmManager(Clock.getRealtimeClock());
mAlarmManager.onCreate();