PlaybackManager implements Playback.Callback { @Override public void onCompletion() { Timber.d("onCompletion"); if (queueManager.hasNext()) { queueManager.next(); handlePlayRequest(); } else { handleStopRequest(); } } PlaybackManager(QueueManager queueManager, PlaybackServiceCallback serviceCallback,
                  AndroidClock androidClock, Playback playback); Playback getPlayback(); @Override void onCompletion(); @Override void onPlaybackStatusChanged(); @Override void setCurrentTrack(Track track);  }
@Test public void onCompletionShouldPlayNext() { when(mockQueueManager.hasNext()).thenReturn(true); playbackManager.onCompletion(); verify(mockQueueManager, times(1)).next(); }
@Test public void onCompletionShouldEndPlayback() { when(mockQueueManager.hasNext()).thenReturn(false); playbackManager.onCompletion(); verify(mockQueueManager, never()).next(); }