Package com.github.hakko.musiccabinet.ws.lastfm

Source Code of com.github.hakko.musiccabinet.ws.lastfm.AlbumInfoClientTest

package com.github.hakko.musiccabinet.ws.lastfm;

import java.util.List;

import junit.framework.Assert;

import org.apache.http.NameValuePair;
import org.junit.Test;
import org.mockito.Mockito;

import com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation;
import com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation.Calltype;
import com.github.hakko.musiccabinet.domain.model.music.Album;
import com.github.hakko.musiccabinet.exception.ApplicationException;
import com.github.hakko.musiccabinet.service.lastfm.WebserviceHistoryService;

public class AlbumInfoClientTest extends AbstractWSImplementationTest {

  @Test
  public void validateParameters() throws ApplicationException {

    final String method = AlbumInfoClient.METHOD;
    final String artistName = "The Beatles";
    final String albumName = "Sergeant Pepper's Lonely Hearts Club Band";
   
    new AlbumInfoClient() {
      @Override
      protected WSResponse executeWSRequest(WebserviceInvocation wi,
          List<NameValuePair> params) throws ApplicationException {
       
        Assert.assertEquals(Calltype.ALBUM_GET_INFO, wi.getCallType());
        Assert.assertTrue(albumName.equals(wi.getAlbum().getName()));
       
        assertHasParameter(params, PARAM_METHOD, method);
        assertHasParameter(params, PARAM_ARTIST, artistName);
        assertHasParameter(params, PARAM_ALBUM, albumName);
       
        return null;
      }
     
      @Override
      protected WebserviceHistoryService getHistoryService() {
        return Mockito.mock(WebserviceHistoryService.class);
      }

    }.getAlbumInfo(new Album(artistName, albumName));
  }
 
}
TOP

Related Classes of com.github.hakko.musiccabinet.ws.lastfm.AlbumInfoClientTest

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.