DecoratedMediaManager { public void play(String filename, ProgressBar progressBar, boolean isAsset) throws AudioFileException { this.progressBar = progressBar; this.filename = filename; audioPlayerManager.play(this.filename, isAsset); progressBar.setMax(audioPlayerManager.getMaxDuration()); schedule(); } @Inject  DecoratedMediaManager(AudioPlayerManager audioPlayerManager, ScheduledExecutorService scheduledExecutorService); void play(String filename, ProgressBar progressBar, boolean isAsset); void stop(); ScheduledFuture getScheduledFuture(); boolean isPlaying(); boolean isCurrentlyPlayingSameCard(String fileName);  }
@Test public void shouldPlayAudioWhenPlayIsCalled() throws Exception { decoratedMediaManager.play(FILENAME, progressBar, IS_NOT_ASSET); verify(audioPlayerManager).play(FILENAME, IS_NOT_ASSET); }
@Test public void shouldSetMaxDurationOfProgressBarWhenPlayIsCalled() throws Exception { decoratedMediaManager.play(FILENAME, progressBar, IS_NOT_ASSET); verify(progressBar).setMax(DEFAULT_MAX); }
@Test public void shouldCreatedScheduledFutureWhenPlayIsCalled() throws Exception { decoratedMediaManager.play(FILENAME, progressBar, IS_NOT_ASSET); verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(INITIAL_DELAY), eq(PERIOD), eq(TimeUnit.MILLISECONDS)); }