@Test public void play_resetsAndPreparesAndStartsMediaPlayer() throws Exception { viewModel.play(new Clip("clip1", "file: InOrder inOrder = Mockito.inOrder(mediaPlayer); inOrder.verify(mediaPlayer).reset(); inOrder.verify(mediaPlayer).setDataSource("file: inOrder.verify(mediaPlayer).prepare(); inOrder.verify(mediaPlayer).start(); }
public void play(Clip clip) { LinkedList<Clip> playlist = new LinkedList<>(); playlist.add(clip); playNext(playlist); }
AudioPlayerViewModel extends ViewModel implements MediaPlayer.OnCompletionListener { public void play(Clip clip) { LinkedList<Clip> playlist = new LinkedList<>(); playlist.add(clip); playNext(playlist); } }
AudioPlayerViewModel extends ViewModel implements MediaPlayer.OnCompletionListener { public void play(Clip clip) { LinkedList<Clip> playlist = new LinkedList<>(); playlist.add(clip); playNext(playlist); } AudioPlayerViewModel(Supplier<MediaPlayer> mediaPlayerFactory, Scheduler scheduler); }
AudioPlayerViewModel extends ViewModel implements MediaPlayer.OnCompletionListener { public void play(Clip clip) { LinkedList<Clip> playlist = new LinkedList<>(); playlist.add(clip); playNext(playlist); } AudioPlayerViewModel(Supplier<MediaPlayer> mediaPlayerFactory, Scheduler scheduler); void play(Clip clip); void playInOrder(List<Clip> clips); void stop(); void pause(); LiveData<Boolean> isPlaying(@NonNull String clipID); LiveData<Integer> getPosition(String clipID); void setPosition(String clipID, Integer newPosition); void background(); @Override void onCompletion(MediaPlayer mediaPlayer); LiveData<Exception> getError(); void errorDisplayed(); }
AudioPlayerViewModel extends ViewModel implements MediaPlayer.OnCompletionListener { public void play(Clip clip) { LinkedList<Clip> playlist = new LinkedList<>(); playlist.add(clip); playNext(playlist); } AudioPlayerViewModel(Supplier<MediaPlayer> mediaPlayerFactory, Scheduler scheduler); void play(Clip clip); void playInOrder(List<Clip> clips); void stop(); void pause(); LiveData<Boolean> isPlaying(@NonNull String clipID); LiveData<Integer> getPosition(String clipID); void setPosition(String clipID, Integer newPosition); void background(); @Override void onCompletion(MediaPlayer mediaPlayer); LiveData<Exception> getError(); void errorDisplayed();  }