Package com.pugh.sockso.tests

Source Code of com.pugh.sockso.tests.PlaylistTestCase

package com.pugh.sockso.tests;

import com.pugh.sockso.Properties;
import com.pugh.sockso.music.Track;
import com.pugh.sockso.web.Request;
import com.pugh.sockso.web.Server;
import com.pugh.sockso.web.User;
import com.pugh.sockso.web.action.playlist.PlaylistTemplate;

import static org.easymock.EasyMock.*;

public class PlaylistTestCase extends SocksoTestCase {

    protected String renderPlaylist( final Class tplClass, final Properties p, final User user ) throws Exception {

        final Track track = TestUtils.getTrack();
       
        final Server server = createNiceMock( Server.class );
        final Request req = createNiceMock( Request.class );

        replay( server );
        replay( req );

        final PlaylistTemplate tpl = (PlaylistTemplate) tplClass.newInstance();

        tpl.setProperties( p );
        tpl.setUser( user );
        tpl.setTracks( new Track[] {track} );
        tpl.setRequest( req );
        tpl.setProtocol( "http" );

        return tpl.makeRenderer().asString();

    }

}
TOP

Related Classes of com.pugh.sockso.tests.PlaylistTestCase

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.