@Test
  public void itAnchorsMediaControllerToAudioView() {
    createActivity();

    View audioView = activity.findViewById(R.id.audio_view);
    activity.onEvent(new AudioPlayingEvent(audioPlayerMock));

    verify(mediaControllerMock).setAnchorView(audioView);
  }
  @Test
  public void itBindsAudioPlayerWithMediaControl() {
    createActivity();

    activity.onEvent(new AudioPlayingEvent(audioPlayerMock));

    verify(mediaControllerMock).setMediaPlayer(audioPlayerMock);
  }
  @Test
  public void itShowsMediaControlWhenAudioStartToPlay() {
    createActivity();

    activity.onEvent(new AudioPlayingEvent(audioPlayerMock));

    verify(mediaControllerMock).show();
  }
  @Test
  public void itShowsMediaControlOnTouchEvent() {
    createActivity();

    MotionEvent motionEvent = mock(MotionEvent.class);
    activity.onTouchEvent(motionEvent);

    verify(mediaControllerMock).show();
  }
  @Test
  public void itReturnsToPreviousActivityOnPressHomeButton() {
    MenuItem homeButton = mock(MenuItem.class);
    when(homeButton.getItemId()).thenReturn(android.R.id.home);

    Intent intent = getIntent();
    activity = spy(buildActivity(AudioPlayerActivity.class).withIntent(intent).create().get());

    activity.onOptionsItemSelected(homeButton);

    verify(activity).onBackPressed();
  }
  @Test
  public void itShowsAndHideProgressDialog() {
    when(progressDialogMock.isShowing()).thenReturn(true);
    String message = application.getString(R.string.loading_episode);

    createActivity();
    activity.onEvent(new AudioPlayingEvent(audioPlayerMock));

    InOrder order = inOrder(progressDialogMock);

    order.verify(progressDialogMock).show();
    order.verify(progressDialogMock).setMessage(message);

    order.verify(progressDialogMock).cancel();
  }