Update JUnits
- Complet AllTest class - Fix JSONSearchAlbumTracksTest class
This commit is contained in:
parent
763c503229
commit
a439511e47
File diff suppressed because one or more lines are too long
@ -9,6 +9,7 @@ import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
|
||||
import fr.ensim.xml.deezer.data.Album;
|
||||
import fr.ensim.xml.deezer.data.Track;
|
||||
|
||||
public class JSONSearchAlbumTracksTest {
|
||||
|
||||
@ -20,24 +21,18 @@ public class JSONSearchAlbumTracksTest {
|
||||
|
||||
// Recuperation du flux a parser
|
||||
//InputStream in = getClass().getResourceAsStream("../list-albums.json");
|
||||
InputStream in = getClass().getClassLoader().getResourceAsStream("fr/ensim/json/list-albums.json");
|
||||
InputStream in = getClass().getClassLoader().getResourceAsStream("fr/ensim/json/47685332.json");
|
||||
|
||||
List<Tra> listAlbums = new JSONSearchAlbum().readAlbums(in);
|
||||
List<Track> trackList = new JSONSearchAlbumTracks().find(in);
|
||||
|
||||
assertEquals(10, handler.getListAlbum().size());
|
||||
assertEquals(13, trackList.size());
|
||||
//First album
|
||||
assertEquals("47685332", handler.getListAlbum().get(0).getId());
|
||||
assertEquals("The Evol", handler.getListAlbum().get(0).getTitle());
|
||||
assertEquals("http://api.deezer.com/2.0/album/47685332/image", handler.getListAlbum().get(0).getCover());
|
||||
assertEquals("83325", handler.getListAlbum().get(0).getArtist().getId());
|
||||
assertEquals("Shaka Ponk", handler.getListAlbum().get(0).getArtist().getName());
|
||||
assertEquals("Gung Ho", trackList.get(0).getTitle());
|
||||
assertEquals("http://cdn-preview-a.deezer.com/stream/c-abbf47cd151375ceee9a5d3835545268-4.mp3", trackList.get(0).getPreview());
|
||||
|
||||
//Second album
|
||||
assertEquals("1121440", handler.getListAlbum().get(1).getId());
|
||||
assertEquals("The Geeks And The Jerkin' Socks", handler.getListAlbum().get(1).getTitle());
|
||||
assertEquals("http://api.deezer.com/2.0/album/1121440/image", handler.getListAlbum().get(1).getCover());
|
||||
assertEquals("83325", handler.getListAlbum().get(1).getArtist().getId());
|
||||
assertEquals("Shaka Ponk", handler.getListAlbum().get(1).getArtist().getName());
|
||||
assertEquals("Fear Ya", trackList.get(1).getTitle());
|
||||
assertEquals("http://cdn-preview-f.deezer.com/stream/c-f2ff0cdc8bd8e4764f59d36ccf996d7c-4.mp3", trackList.get(1).getPreview());
|
||||
|
||||
LOG.debug("<<testParse");
|
||||
}
|
||||
|
@ -4,12 +4,18 @@ import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
import org.junit.runners.Suite.SuiteClasses;
|
||||
|
||||
import fr.ensim.json.JSONSearchAlbumTest;
|
||||
import fr.ensim.json.JSONSearchAlbumTracksTest;
|
||||
import fr.ensim.xml.deezer.dom.DOMSearchAlbumTracksTest;
|
||||
import fr.ensim.xml.deezer.dom.DOMSearchAlbumsTest;
|
||||
import fr.ensim.xml.deezer.sax.SAXSearchAlbumsTest;
|
||||
import fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses({ DOMSearchAlbumsTest.class, SAXSearchAlbumsTest.class, StAXSearchAlbumsTest.class})
|
||||
@SuiteClasses({ JSONSearchAlbumTest.class, JSONSearchAlbumTracksTest.class
|
||||
, DOMSearchAlbumsTest.class, DOMSearchAlbumTracksTest.class
|
||||
, SAXSearchAlbumsTest.class
|
||||
, StAXSearchAlbumsTest.class})
|
||||
public class AllTests {
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,8 @@
|
||||
17:15:23,447 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracksTest - >>testParse
|
||||
17:15:23,450 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracks - >>find
|
||||
17:15:23,461 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracks - >>find
|
||||
17:15:23,462 DEBUG fr.ensim.xml.deezer.dom.DOMSearchAlbumTracksTest - <<testParse
|
||||
17:25:23,069 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - >>testCount
|
||||
17:25:23,071 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>count
|
||||
17:25:23,082 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <<count 10
|
||||
17:25:23,082 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - <<testCount
|
||||
17:25:23,083 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - >>testParse
|
||||
17:25:23,083 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>readAlbums
|
||||
17:25:23,085 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <<readAlbums
|
||||
17:25:23,085 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - <<testParse
|
||||
|
Loading…
Reference in New Issue
Block a user