@Test public void updatesPreferencesForLoadedFeedMediaIfPlayerStatusIsPaused() { PlaybackVolumeUpdater playbackVolumeUpdater = new PlaybackVolumeUpdater(); when(mediaPlayer.getPlayerStatus()).thenReturn(PlayerStatus.PAUSED); FeedMedia feedMedia = mockFeedMedia(); when(mediaPlayer.getPlayable()).thenReturn(feedMedia); FeedPreferences feedPreferences = feedMedia.getItem().getFeed().getPreferences(); playbackVolumeUpdater.updateVolumeIfNecessary(mediaPlayer, FEED_ID, VolumeAdaptionSetting.LIGHT_REDUCTION); verify(feedPreferences, times(1)).setVolumeAdaptionSetting(VolumeAdaptionSetting.LIGHT_REDUCTION); verify(mediaPlayer, never()).pause(anyBoolean(), anyBoolean()); verify(mediaPlayer, never()).resume(); }
public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId, VolumeAdaptionSetting volumeAdaptionSetting) { Playable playable = mediaPlayer.getPlayable(); if (playable instanceof FeedMedia) { updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable); } }
PlaybackVolumeUpdater { public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId, VolumeAdaptionSetting volumeAdaptionSetting) { Playable playable = mediaPlayer.getPlayable(); if (playable instanceof FeedMedia) { updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable); } } }
PlaybackVolumeUpdater { public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId, VolumeAdaptionSetting volumeAdaptionSetting) { Playable playable = mediaPlayer.getPlayable(); if (playable instanceof FeedMedia) { updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable); } }  }
PlaybackVolumeUpdater { public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId, VolumeAdaptionSetting volumeAdaptionSetting) { Playable playable = mediaPlayer.getPlayable(); if (playable instanceof FeedMedia) { updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable); } }  void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId,
                                        VolumeAdaptionSetting volumeAdaptionSetting); }
PlaybackVolumeUpdater { public void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId, VolumeAdaptionSetting volumeAdaptionSetting) { Playable playable = mediaPlayer.getPlayable(); if (playable instanceof FeedMedia) { updateFeedMediaVolumeIfNecessary(mediaPlayer, feedId, volumeAdaptionSetting, (FeedMedia) playable); } }  void updateVolumeIfNecessary(PlaybackServiceMediaPlayer mediaPlayer, long feedId,
                                        VolumeAdaptionSetting volumeAdaptionSetting);  }