use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistInfoParserTest method emptyFileReturnsEmptyInfo.
@Test
public void emptyFileReturnsEmptyInfo() throws ApplicationException {
ArtistInfoParser parser = new ArtistInfoParserImpl(new ResourceUtil(EMPTY_ARTIST_INFO_FILE).getInputStream());
ArtistInfo artistInfo = parser.getArtistInfo();
Assert.assertNull(artistInfo);
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistSimilarityParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
ArtistSimilarityParser parser = new ArtistSimilarityParserImpl(new ResourceUtil(ARTIST_SIMILARITY_FILE).getInputStream());
assertNotNull(parser.getArtist());
assertNotNull(parser.getArtistRelations());
assertTrue(parser.getArtist().getName().equals("Cher"));
assertEquals(parser.getArtistRelations().size(), 100);
for (ArtistRelation ar : parser.getArtistRelations()) {
assertNotNull(ar.getTarget());
}
verifyArtistRelation(parser, 0, "Sonny & Cher", 1.0f);
verifyArtistRelation(parser, 1, "Madonna", 0.476751f);
verifyArtistRelation(parser, 2, "Cyndi Lauper", 0.407297f);
verifyArtistRelation(parser, 99, "Lara Fabian", 0.0617754f);
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistTopTagsParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
ArtistTopTagsParser parser = new ArtistTopTagsParserImpl(new ResourceUtil(TOP_TAGS_FILE).getInputStream());
assertNotNull(parser.getArtist());
assertNotNull(parser.getTopTags());
assertTrue(parser.getArtist().getName().equals("Cher"));
assertEquals(parser.getTopTags().size(), 100);
for (Tag tag : parser.getTopTags()) {
assertNotNull(tag);
assertNotNull(tag.getName());
}
verifyTopTag(parser, 0, "pop", 100);
verifyTopTag(parser, 1, "female vocalists", 72);
verifyTopTag(parser, 98, "women", 0);
verifyTopTag(parser, 99, "techno", 0);
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ArtistTopTracksParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
ArtistTopTracksParser parser = new ArtistTopTracksParserImpl(new ResourceUtil(TOP_TRACK_FILE).getInputStream());
assertNotNull(parser.getArtist());
assertNotNull(parser.getTopTracks());
assertTrue(parser.getArtist().getName().equals("Cher"));
assertEquals(parser.getTopTracks().size(), 50);
for (Track track : parser.getTopTracks()) {
assertNotNull(track);
assertNotNull(track.getArtist());
assertEquals(track.getArtist(), parser.getArtist());
}
verifyTopTrack(parser, 0, "Believe");
verifyTopTrack(parser, 1, "If I Could Turn Back Time");
verifyTopTrack(parser, 2, "Welcome To Burlesque");
verifyTopTrack(parser, 49, "Gypsys, Tramps and Thieves");
}
use of com.github.hakko.musiccabinet.util.ResourceUtil in project musiccabinet by hakko.
the class ScrobbledTracksParserTest method resourceFileCorrectlyParsed.
@Test
public void resourceFileCorrectlyParsed() throws ApplicationException {
ScrobbledTracksParser parser = new ScrobbledTracksParserImpl(new ResourceUtil(LIBRARY_TRACKS_FILE).getInputStream());
assertNotNull(parser.getTrackPlayCounts());
assertEquals(parser.getPage(), (short) 1);
assertEquals(parser.getTotalPages(), (short) 151);
assertEquals(parser.getTrackPlayCounts().size(), 100);
for (TrackPlayCount trackPlayCount : parser.getTrackPlayCounts()) {
assertNotNull(trackPlayCount.getTrack());
assertNotNull(trackPlayCount.getTrack().getArtist());
}
verifyLibraryTrack(parser, 0, "Can", "Thief", 181);
verifyLibraryTrack(parser, 1, "Roffe Ruff", "Ormar i gräset", 144);
verifyLibraryTrack(parser, 2, "Dungen", "Du E för Fin för Mig", 143);
verifyLibraryTrack(parser, 99, "The Radio Dept.", "Gibraltar", 41);
}
Aggregations