@Test public void givenPositionThatDiffersFromPlayheadPosition_whenStartingPlayAtVideoPosition_thenSeeksToVideoPosition() { long differentPositionInMillis = givenPositionThatDiffersFromPlayheadPosition(); player.playAt(differentPositionInMillis); ArgumentCaptor<DelayedActionExecutor.Action> argumentCaptor = ArgumentCaptor.forClass(DelayedActionExecutor.Action.class); verify(delayedActionExecutor).performAfterDelay(argumentCaptor.capture(), eq(DELAY_MILLIS)); argumentCaptor.getValue().perform(); verify(mediaPlayer).seekTo(differentPositionInMillis); }
@Test public void givenPositionThatDiffersFromPlayheadPosition_whenStartingPlayAtVideoPosition_thenNotifiesBufferStateListenersThatBufferStarted() { long differentPositionInMillis = givenPositionThatDiffersFromPlayheadPosition(); player.playAt(differentPositionInMillis); verify(bufferStateListener).onBufferStarted(); }
@Test public void givenPositionThatDiffersFromPlayheadPosition_whenStartingPlayAtVideoPosition_thenInitialisesPlaybackForSeeking() { long differentPositionInMillis = givenPositionThatDiffersFromPlayheadPosition(); player.playAt(differentPositionInMillis); thenInitialisesPlaybackForSeeking(); }
@Test public void whenStartingPlayAtVideoPosition_thenStartsBeatingHeart() { given(mediaPlayer.currentPositionInMillis()).willReturn((int) BEGINNING_POSITION); player.playAt(BEGINNING_POSITION); verify(heart).startBeatingHeart(); }
@Test public void whenStartingPlayAtVideoPosition_thenMediaPlayerStarts() { given(mediaPlayer.currentPositionInMillis()).willReturn((int) BEGINNING_POSITION); player.playAt(BEGINNING_POSITION); verify(mediaPlayer).start(surface); }
@Test public void whenStartingPlayAtVideoPosition_thenNotifiesStateListenersThatVideoIsPlaying() { given(mediaPlayer.currentPositionInMillis()).willReturn((int) BEGINNING_POSITION); player.playAt(BEGINNING_POSITION); verify(stateChangedListener).onVideoPlaying(); }