Package com.pugh.sockso.web

Source Code of com.pugh.sockso.web.RelatedArtistsTest

package com.pugh.sockso.web;

import com.pugh.sockso.music.Artist;
import com.pugh.sockso.tests.SocksoTestCase;
import com.pugh.sockso.tests.TestDatabase;
import com.pugh.sockso.web.action.AudioScrobbler;
import java.util.List;

import static org.easymock.classextension.EasyMock.*;

public class RelatedArtistsTest extends SocksoTestCase {

    private RelatedArtists related;
   
    @Override
    protected void setUp() throws Exception {
        String[] artists = new String[] { "Beep Artist", "Xylophone" };
        TestDatabase db = new TestDatabase();
        db.fixture( "artists" );
        AudioScrobbler scrobbler = createMock( AudioScrobbler.class );
        expect( scrobbler.getSimilarArtists(1) ).andReturn( artists );
        replay( scrobbler );
        related = new RelatedArtists( db, scrobbler );
    }
   
    public void testOnlyRelatedArtistsInCollectionAreReturned() throws Exception {
        List<Artist> artists = related.getRelatedArtistsFor( 1 );
        assertEquals( 2, artists.size() );
    }
   
    public void testArtistAddedDateIsReturnedWithArtistObjects() throws Exception {
        List<Artist> artists = related.getRelatedArtistsFor( 1 );
        assertNotNull( artists.get(0).getDateAdded() );
    }
}
TOP

Related Classes of com.pugh.sockso.web.RelatedArtistsTest

TOP
Copyright © 2018 www.massapi.com. 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.