Exemplo n.º 1
0
  public void testPlaysNewTrackAsSoonAsLocationChangesIfPreviousTrackFinishedWhileInSameLocation() {
    startingIn(LOCATION_A);
    dj.mediaFinished();

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

    dj.locationChangedTo(LOCATION_B);
  }
Exemplo n.º 2
0
  public void
      testPlaysTrackForCurrentLocationWhenPreviousTrackFinishesIfLocationChangedWhileTrackWasPlaying() {
    startingIn(LOCATION_A);

    dj.locationChangedTo(LOCATION_B);

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

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

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

    dj.locationChangedTo(LOCATION_A);
  }
Exemplo n.º 5
0
  public void testDoesNotPlayTrackAgainIfStillInTheSameLocation() {
    startingIn(LOCATION_A);

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

    dj.mediaFinished();
  }