adding unit tests
This commit is contained in:
parent
c9825e3fb3
commit
fe0d8d2dbf
@ -1,19 +1,39 @@
|
|||||||
package sarsoo.fmframework.fm;
|
package sarsoo.fmframework.fm;
|
||||||
|
|
||||||
import org.junit.Test;
|
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 {
|
public class FmNetworkTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void testNetworkInstantiate() {
|
||||||
FmUserNetwork network = new FmUserNetwork("54a9f5c4c36f5d2cba0d4ffe3846e8b4", "sarsoo");
|
assertNotNull(new FmNetwork(Key.getKey()));
|
||||||
|
}
|
||||||
Track track = network.getLastTrack();
|
|
||||||
|
@Test
|
||||||
System.out.println(track);
|
public void testGetNonNullAlbum() {
|
||||||
System.out.println(track.getUserPlayCount());
|
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 org.junit.Test;
|
||||||
|
|
||||||
|
import sarsoo.fmframework.net.Key;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class FmUserNetworkTest {
|
public class FmUserNetworkTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void testNetworkInstantiate() {
|
||||||
FmUserNetwork network = new FmUserNetwork("54a9f5c4c36f5d2cba0d4ffe3846e8b4", "sarsoo");
|
assertNotNull(new FmUserNetwork(Key.getKey(), "sarsoo"));
|
||||||
|
|
||||||
network.getScrobblesToday();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user