@Test
  public void addCherSimilarTracksAndGetPlaylist() throws ApplicationException {
    TrackSimilarityParser tsParser =
        new TrackSimilarityParserImpl(new ResourceUtil(CHER_SIMILAR_TRACKS).getInputStream());
    trackRelationDao.createTrackRelations(tsParser.getTrack(), tsParser.getTrackRelations());

    List<File> files = new ArrayList<>();
    for (TrackRelation tr : tsParser.getTrackRelations()) {
      String artistName = tr.getTarget().getArtist().getName();
      if ("Madonna".equals(artistName)) {
        files.add(getFile(artistName, null, tr.getTarget().getName()));
      }
    }
    UnittestLibraryUtil.submitFile(additionDao, files);

    int trackId =
        musicDao.getTrackId(
            tsParser.getTrack().getArtist().getName(), tsParser.getTrack().getName());

    playlistGeneratorDao.updateSearchIndex();
    List<PlaylistItem> ts = playlistGeneratorDao.getPlaylistForTrack(trackId);

    Assert.assertNotNull(ts);
    Assert.assertEquals(2, ts.size());
  }
  private int prepareTestdataForArtist() throws ApplicationException {
    ArtistSimilarityParser asParser =
        new ArtistSimilarityParserImpl(new ResourceUtil(CHER_SIMILAR_ARTISTS).getInputStream());
    artistRelationDao.createArtistRelations(asParser.getArtist(), asParser.getArtistRelations());

    ArtistTopTracksParser attParser =
        new ArtistTopTracksParserImpl(new ResourceUtil(CHER_TOP_TRACKS).getInputStream());
    artistTopTracksDao.createTopTracks(attParser.getArtist(), attParser.getTopTracks());

    List<File> files = new ArrayList<>();
    for (Track topTrack : attParser.getTopTracks()) {
      files.add(UnittestLibraryUtil.getFile(topTrack));
    }
    UnittestLibraryUtil.submitFile(additionDao, files);

    int artistId = musicDao.getArtistId(asParser.getArtist());

    playlistGeneratorDao.updateSearchIndex();

    return artistId;
  }