@Before public void setUp() { activity = Robolectric.buildActivity(MainActivity.class).create().get(); shadowNotificationManager = shadowOf((NotificationManager) RuntimeEnvironment.application .getSystemService(Context.NOTIFICATION_SERVICE)); shadowMediaPlayer = new ShadowMediaPlayer(); shadowAudioManager = shadowOf((AudioManager) RuntimeEnvironment.application.getSystemService(Context.AUDIO_SERVICE)); //(AudioManager) RuntimeEnvironment.application.getSystemService(Context.AUDIO_SERVICE); ShadowLog.stream = System.out; preferences = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); }
public static ShadowMediaPlayer shadowOf(MediaPlayer instance) { return (ShadowMediaPlayer) shadowOf_(instance); }