Package com.github.hakko.musiccabinet.parser.lastfm

Source Code of com.github.hakko.musiccabinet.parser.lastfm.AuthSessionParserTest

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

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;

import org.junit.Test;

import com.github.hakko.musiccabinet.domain.model.library.LastFmUser;
import com.github.hakko.musiccabinet.exception.ApplicationException;
import com.github.hakko.musiccabinet.util.ResourceUtil;

public class AuthSessionParserTest {
 
  private static final String AUTH_SESSION_FILE =
    "last.fm/xml/auth.getSession.xml";

  // constant values below are copied from file above
 
  private static final String NAME = "MyLastFMUsername";
  private static final String KEY = "d580d57f32848f5dcf574d1ce18d78b2";
 
  @Test
  public void resourceFileCorrectlyParsed() throws ApplicationException {
    AuthSessionParser parser = new AuthSessionParserImpl(
        new ResourceUtil(AUTH_SESSION_FILE).getInputStream());

    LastFmUser lastFmUser = parser.getLastFmUser();

    assertNotNull(lastFmUser);
    assertEquals(NAME, lastFmUser.getLastFmUsername());
    assertEquals(KEY, lastFmUser.getSessionKey());
  }

}
TOP

Related Classes of com.github.hakko.musiccabinet.parser.lastfm.AuthSessionParserTest

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.