@Test void testVolumeIntOutOfRangeNegative() { assertThat(this.playerLogic.setVolume(-2), equalTo(-1)); }
public int setVolume(String volumeString) { int volume = getVolume(); if (volume != -1) { switch (volumeString) { case "mute": return setVolume(VOLUME_MUTE_VALUE); case "max": case "full": return setVolume(VOLUME_MAX_VALUE); case "up": volume = Math.min(VOLUME_MAX_VALUE, volume + VOLUME_UPDOWN_VALUE); return setVolume(volume); case "down": volume = Math.max(VOLUME_MUTE_VALUE, volume - VOLUME_UPDOWN_VALUE); return setVolume(volume); default: this.logger.warn("Incorrect volume command"); return -1; } } return volume; }
PlayerLogic { public int setVolume(String volumeString) { int volume = getVolume(); if (volume != -1) { switch (volumeString) { case "mute": return setVolume(VOLUME_MUTE_VALUE); case "max": case "full": return setVolume(VOLUME_MAX_VALUE); case "up": volume = Math.min(VOLUME_MAX_VALUE, volume + VOLUME_UPDOWN_VALUE); return setVolume(volume); case "down": volume = Math.max(VOLUME_MUTE_VALUE, volume - VOLUME_UPDOWN_VALUE); return setVolume(volume); default: this.logger.warn("Incorrect volume command"); return -1; } } return volume; } }
PlayerLogic { public int setVolume(String volumeString) { int volume = getVolume(); if (volume != -1) { switch (volumeString) { case "mute": return setVolume(VOLUME_MUTE_VALUE); case "max": case "full": return setVolume(VOLUME_MAX_VALUE); case "up": volume = Math.min(VOLUME_MAX_VALUE, volume + VOLUME_UPDOWN_VALUE); return setVolume(volume); case "down": volume = Math.max(VOLUME_MUTE_VALUE, volume - VOLUME_UPDOWN_VALUE); return setVolume(volume); default: this.logger.warn("Incorrect volume command"); return -1; } } return volume; }  }
PlayerLogic { public int setVolume(String volumeString) { int volume = getVolume(); if (volume != -1) { switch (volumeString) { case "mute": return setVolume(VOLUME_MUTE_VALUE); case "max": case "full": return setVolume(VOLUME_MAX_VALUE); case "up": volume = Math.min(VOLUME_MAX_VALUE, volume + VOLUME_UPDOWN_VALUE); return setVolume(volume); case "down": volume = Math.max(VOLUME_MUTE_VALUE, volume - VOLUME_UPDOWN_VALUE); return setVolume(volume); default: this.logger.warn("Incorrect volume command"); return -1; } } return volume; }  URI firstTimeInit(String clientID, String clientSecret); URI firstTimeInit(); void inputAuthCode(String authCode); PlaylistEntity play(); PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type); TrackEntity playTrack(int trackNumber); AlbumEntity playAlbum(int albumNumber); ArtistEntity playArtist(int artistNumber); boolean resume(); boolean pause(); boolean skip(); boolean back(); TrackEntity getCurrentSong(); int setVolume(String volumeString); int setVolume(int volume); int getVolume(); }
PlayerLogic { public int setVolume(String volumeString) { int volume = getVolume(); if (volume != -1) { switch (volumeString) { case "mute": return setVolume(VOLUME_MUTE_VALUE); case "max": case "full": return setVolume(VOLUME_MAX_VALUE); case "up": volume = Math.min(VOLUME_MAX_VALUE, volume + VOLUME_UPDOWN_VALUE); return setVolume(volume); case "down": volume = Math.max(VOLUME_MUTE_VALUE, volume - VOLUME_UPDOWN_VALUE); return setVolume(volume); default: this.logger.warn("Incorrect volume command"); return -1; } } return volume; }  URI firstTimeInit(String clientID, String clientSecret); URI firstTimeInit(); void inputAuthCode(String authCode); PlaylistEntity play(); PlaylistEntity playPlaylist(int playlistNumber, SearchTypes type); TrackEntity playTrack(int trackNumber); AlbumEntity playAlbum(int albumNumber); ArtistEntity playArtist(int artistNumber); boolean resume(); boolean pause(); boolean skip(); boolean back(); TrackEntity getCurrentSong(); int setVolume(String volumeString); int setVolume(int volume); int getVolume();  }