MainFragment extends BrowseFragment implements
        LoaderManager.LoaderCallbacks<HashMap<String, List<Song>>>, OnPlaylistLoaded { protected List<String> startSong(List<Song> songs, Song song) { Log.d(TAG, "Item: " + song.getTitle()); int index = songs.indexOf(song); Collections.rotate(songs, -1 * index); ArrayList<String> uris = new ArrayList<String>(); ArrayList<String> images = new ArrayList<String>(); ArrayList<String> titles = new ArrayList<String>(); ArrayList<String> artists = new ArrayList<String>(); for (Song s : songs) { uris.add(s.getId()); images.add(s.getBackgroundImageUrl()); titles.add(s.getTitle()); artists.add(s.getArtist()); } Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(PlayerActivity.ARG_SONG_IDS, uris); intent.putExtra(PlayerActivity.ARG_SONG_IMAGES, images); intent.putExtra(PlayerActivity.ARG_SONG_TITLES, titles); intent.putExtra(PlayerActivity.ARG_SONG_ARTISTS, artists); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); return uris; }  @Override void onActivityCreated(Bundle savedInstanceState); @Override Loader<HashMap<String, List<Song>>> onCreateLoader(int arg0, Bundle arg1); @Override void onLoadFinished(Loader<HashMap<String, List<Song>>> arg0,
            HashMap<String, List<Song>> data); @Override void onLoaderReset(Loader<HashMap<String, List<Song>>> arg0); @Override void onPlaylistLoaded(PlaylistSimple playlist, final int currentNumber, final int totalNumber); ArrayObjectAdapter getAdapter(); void setArrayObjectAdapter(ArrayObjectAdapter adapter);  }
@Test public void test_startSong() { List<Song> songs = new ArrayList<Song>(); for (int i = 0; i < 10; i++) { Song song = new Song(); song.setId(i + ""); songs.add(song); } Song song = songs.get(2); List<String> ids = fragment.startSong(songs, song); assertEquals(song.getId(), ids.get(0)); assertNotEquals(song.getId(), ids.get(2)); assertNotEquals(song.getId(), ids.get(3)); verify(fragment).startActivity(any(Intent.class)); }