adding unit tests
This commit is contained in:
parent
c9825e3fb3
commit
fe0d8d2dbf
@ -1,19 +1,39 @@
|
||||
package sarsoo.fmframework.fm;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import sarsoo.fmframework.music.Track;
|
||||
import sarsoo.fmframework.music.Album;
|
||||
import sarsoo.fmframework.music.Artist;
|
||||
import sarsoo.fmframework.net.Key;
|
||||
|
||||
public class FmNetworkTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
FmUserNetwork network = new FmUserNetwork("54a9f5c4c36f5d2cba0d4ffe3846e8b4", "sarsoo");
|
||||
|
||||
Track track = network.getLastTrack();
|
||||
|
||||
System.out.println(track);
|
||||
System.out.println(track.getUserPlayCount());
|
||||
public void testNetworkInstantiate() {
|
||||
assertNotNull(new FmNetwork(Key.getKey()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNonNullAlbum() {
|
||||
assertNotNull(new FmNetwork(Key.getKey()).getAlbum("To Pimp A Butterfly", "Kendrick Lamar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlbumDataMatch() {
|
||||
Album album = new FmNetwork(Key.getKey()).getAlbum("To Pimp A Butterfly", "Kendrick Lamar");
|
||||
assertEquals(album.getName(), "To Pimp a Butterfly");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNonNullArtist() {
|
||||
assertNotNull(new FmNetwork(Key.getKey()).getArtist("Kendrick Lamar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArtistDataMatch() {
|
||||
Artist artist= new FmNetwork(Key.getKey()).getArtist("Kendrick Lamar");
|
||||
assertEquals(artist.getName(), "Kendrick Lamar");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,14 @@ package sarsoo.fmframework.fm;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import sarsoo.fmframework.net.Key;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class FmUserNetworkTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
FmUserNetwork network = new FmUserNetwork("54a9f5c4c36f5d2cba0d4ffe3846e8b4", "sarsoo");
|
||||
|
||||
network.getScrobblesToday();
|
||||
public void testNetworkInstantiate() {
|
||||
assertNotNull(new FmUserNetwork(Key.getKey(), "sarsoo"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user