Exemple #1
0
  public void testPlaysNewTrackAsSoonAsLocationChangesIfPreviousTrackFinishedWhileInSameLocation() {
    startingIn(LOCATION_A);
    dj.mediaFinished();

    checking(
        new Expectations() {
          {
            oneOf(mediaControl).play(TRACK_B);
          }
        });

    dj.locationChangedTo(LOCATION_B);
  }
Exemple #2
0
  public void
      testPlaysTrackForCurrentLocationWhenPreviousTrackFinishesIfLocationChangedWhileTrackWasPlaying() {
    startingIn(LOCATION_A);

    dj.locationChangedTo(LOCATION_B);

    checking(
        new Expectations() {
          {
            oneOf(mediaControl).play(TRACK_B);
          }
        });

    dj.mediaFinished();
  }
Exemple #3
0
  private void startingIn(String initialLocation) {
    checking(
        new Expectations() {
          {
            oneOf(mediaControl).play(with(any(String.class)));
          }
        });

    dj.locationChangedTo(initialLocation);
  }
Exemple #4
0
  public void testStartsPlayingTrackForCurrentLocationWhenLocationFirstDetected() {
    checking(
        new Expectations() {
          {
            oneOf(mediaControl).play(TRACK_A);
          }
        });

    dj.locationChangedTo(LOCATION_A);
  }
Exemple #5
0
  public void testDoesNotPlayTrackAgainIfStillInTheSameLocation() {
    startingIn(LOCATION_A);

    checking(
        new Expectations() {
          {
            never(mediaControl).play(with(any(String.class)));
          }
        });

    dj.mediaFinished();
  }