MusicPerformer implements StepPerformer { @Override public void doStep() { if (rainbowInputController.isScreenTouched()) { increaseVolume(); } else { decreaseVolume(); } } protected  MusicPerformer(MediaPlayer mediaPlayer, RainbowInputController rainbowInputController); static MusicPerformer newInstance(RainbowInputController rainbowInputController); @Override void init(); @Override void doStep(); @Override void reset(); @Override void disable(); @Override void enable();  }
@Test public void testThatOnEveryStepIfScreenIsTouchedAndIsPlayingVolumeIsIncreased() { givenThatIsPlaying(); givenThatScreenIsTouched(); musicPerformer.doStep(); verify(mediaPlayer).setVolume(MIN_VOLUME + MUSIC_STEP, MIN_VOLUME + MUSIC_STEP); }
@Test public void testThatOnEveryStepIfScreenIsTouchedAndIsNotPlayingVolumeNotChanged() { givenThatIsNotPlaying(); givenThatScreenIsTouched(); musicPerformer.doStep(); verify(mediaPlayer, never()).setVolume(anyFloat(), anyFloat()); }
@Test public void testThatOnEveryStepIfScreenIsNotTouchedAndIsPlayingVolumeIsDecreased() { givenThatIsPlaying(); givenThatVolumeIsTwoStepsOverInitial(); givenThatScreenIsNotTouched(); musicPerformer.doStep(); verify(mediaPlayer, times(2)).setVolume(MIN_VOLUME + MUSIC_STEP, MIN_VOLUME + MUSIC_STEP); }
@Test public void testThatOnEveryStepIfScreenIsNotTouchedAndIsNotPlayingVolumeNotChanged() { givenThatIsNotPlaying(); givenThatScreenIsNotTouched(); musicPerformer.doStep(); verify(mediaPlayer, never()).setVolume(anyFloat(), anyFloat()); }