/** Tests whether a limit is taken into account when retrieving songs. */
 @Test
 public void testFetchSongsWithLimit() {
   persistTestSongs();
   SyncCommandTestImpl cmd = createCommand(SONG_COUNT - 1);
   List<SongEntity> songs = cmd.fetchSongsToSync(jpaHelper.getEM());
   assertEquals("Wrong number of songs", SONG_COUNT - 1, songs.size());
   for (SongEntity song : songs) {
     assertTrue("No play count: " + song, song.getCurrentPlayCount() > 0);
   }
 }
 /** Tests whether the song entities have been fully initialized. */
 @Test
 public void testFetchSongsInitialized() {
   persistTestSongs();
   SyncCommandTestImpl cmd = createCommand(null);
   List<SongEntity> songs = cmd.fetchSongsToSync(jpaHelper.getEM());
   jpaHelper.closeEM();
   for (SongEntity song : songs) {
     assertNotNull("No artist", song.getArtist());
     assertNotNull("No album", song.getAlbum());
   }
 }
 /** Tests whether all songs that need to be synchronized are found. */
 @Test
 public void testFetchSongsToSyncNoLimit() {
   persistTestSongs();
   SyncCommandTestImpl cmd = createCommand(null);
   List<SongEntity> songs = cmd.fetchSongsToSync(jpaHelper.getEM());
   assertEquals("Wrong number of songs", SONG_COUNT, songs.size());
   for (int i = 1; i <= SONG_COUNT; i++) {
     String songName = SONG_NAME + i;
     boolean found = false;
     for (SongEntity song : songs) {
       if (songName.equals(song.getName())) {
         found = true;
         break;
       }
     }
     assertTrue("Song not found: " + i, found);
   }
 }