Package org.adoptopenjdk.lambda.tutorial.exercise5.musicplayer

Examples of org.adoptopenjdk.lambda.tutorial.exercise5.musicplayer.MusicLibrary


     * @see MusicLibrary.SongByArtistSorter#sort(java.util.Collection)
     *
     */
    @Test
    public void useDefaultMethodToReturnPlaylistOrderedByArtist() {
        MusicLibrary library = new LocalFilesystemMusicLibrary(
            new Song("A Change Is Gonna Come", "Sam Cooke"),
            new Song("Bad Moon Rising", "Creedence Clearwater Revival"),
            new Song("Candy", "Paulo Nutini"),
            new Song("Desolation Row", "Bob Dylan"),
            new Song("Eleanor Rigby", "The Beatles")
View Full Code Here


     * @see MusicLibrary#ratingOf(Song)
     * @see CloudScrobblingMusicLibrary.CloudScrobblingService#retrieveScrobbledRatingOf(Song)
     */
    @Test
    public void overridesDefaultMethodInClassToProvideCustomSongRatingAlgorithm() {
        MusicLibrary library = new CloudScrobblingMusicLibrary();

        assertThat(library.ratingOf(new Song("Candy", "Paulo Nutini")), is(new Rating(78)));
        assertThat(CloudScrobblingMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

     * to a Rating type with the {@link UserRatedMusicLibrary.StarRatingConverter#convert(StarRating)} method.
     *
     */
    @Test
    public void overrideDefaultMethodInInterfaceToProvideUserEnteredSongRatings() {
        MusicLibrary library = new UserRatedLocalFilesystemMusicLibrary();

        assertThat(library.ratingOf(new Song("Desolation Row", "Bob Dylan")), is(new Rating(60)));
        assertThat(UserRatedMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

     */
    @Test
    public void overridesDefaultMethodInClassToProvideCustomSongRatingAlgorithm() {
        MusicLibrary library = new CloudScrobblingMusicLibrary();

        assertThat(library.ratingOf(new Song("Candy", "Paulo Nutini")), is(new Rating(78)));
        assertThat(CloudScrobblingMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

     */
    @Test
    public void overrideDefaultMethodInInterfaceToProvideUserEnteredSongRatings() {
        MusicLibrary library = new UserRatedLocalFilesystemMusicLibrary();

        assertThat(library.ratingOf(new Song("Desolation Row", "Bob Dylan")), is(new Rating(60)));
        assertThat(UserRatedMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

     *
     */
    @Test
    public void useDefaultMethodToReturnPlaylistOrderedByArtist() {
        MusicLibrary library = new LocalFilesystemMusicLibrary(
            new Song("A Change Is Gonna Come", "Sam Cooke"),
            new Song("Bad Moon Rising", "Creedence Clearwater Revival"),
            new Song("Candy", "Paulo Nutini"),
            new Song("Desolation Row", "Bob Dylan"),
            new Song("Eleanor Rigby", "The Beatles")
        );

//        UNCOMMENT THE LINES BELOW
//        Until the sortedByArtist method is added to MusicLibrary, there will be a compiler error.
//        assertThat(library.sortedByArtist(), containsSongsBy("Bob Dylan", "Creedence Clearwater Revival",
View Full Code Here

     */
    @Test
    public void overridesDefaultMethodInClassToProvideCustomSongRatingAlgorithm() {
        MusicLibrary library = new CloudScrobblingMusicLibrary();

        assertThat(library.ratingOf(new Song("Candy", "Paulo Nutini")), is(new Rating(78)));
        assertThat(CloudScrobblingMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

     */
    @Test
    public void overrideDefaultMethodInInterfaceToProvideUserEnteredSongRatings() {
        MusicLibrary library = new UserRatedLocalFilesystemMusicLibrary();

        assertThat(library.ratingOf(new Song("Desolation Row", "Bob Dylan")), is(new Rating(60)));
        assertThat(UserRatedMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

            }
        }

        public Collection<Song> retrieveAllSongs() {
            return Arrays.asList(
                    new Song("A Change Is Gonna Come", "Sam Cooke"),
                    new Song("Bad Moon Rising", "Creedence Clearwater Revival"),
                    new Song("Candy", "Paulo Nutini"),
                    new Song("Desolation Row", "Bob Dylan"),
                    new Song("Eleanor Rigby", "The Beatles"));
        }
View Full Code Here

     * @see MusicLibrary#ratingOf(Song)
     * @see CloudScrobblingMusicLibrary.CloudScrobblingService#retrieveScrobbledRatingOf(Song)
     */
    @Test
    public void overridesDefaultMethodInClassToProvideCustomSongRatingAlgorithm() {
        MusicLibrary library = new CloudScrobblingMusicLibrary();

        assertThat(library.ratingOf(new Song("Candy", "Paulo Nutini")), is(new Rating(78)));
        assertThat(CloudScrobblingMusicLibrary.class, HasConcreteMethod.called("ratingOf"));
    }
View Full Code Here

TOP

Related Classes of org.adoptopenjdk.lambda.tutorial.exercise5.musicplayer.MusicLibrary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.