public void testFindOne() { MockMusicService service = new MockMusicService(); Song song = service.findOne("Dark Horse"); Assert.assertEquals("Dark Horse", song.getSongTitle()); Assert.assertEquals("Katy Perry", song.getArtistName()); Assert.assertEquals("Single", song.getAlbumTitle()); }
@Override public View getView(int position, View view, ViewGroup parent) { if (view == null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.listview_for_songs, parent, false); } final Song song = mEntries.get(position); TextView textViewTitle = (TextView) view.findViewById(R.id.textViewSongTitle); textViewTitle.setText(song.getSongTitle() + " (" + song.getArtistName() + ")"); TextView textViewAlbum = (TextView) view.findViewById(R.id.textViewSongArtist); textViewAlbum.setText(song.getAlbumTitle()); TextView textViewPublishedDate = (TextView) view.findViewById(R.id.textViewSongDate); textViewPublishedDate.setText(df.format(song.getSongPublishedDate())); return view; }