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());
 }
  public void testFindAll() {
    MockMusicService service = new MockMusicService();
    List<Song> songs = service.findAll();
    Assert.assertNotNull(songs);

    boolean testResultFound = false;
    for (Song song : songs) {
      if (song.getAlbumTitle().equalsIgnoreCase("Dark Horse")) {
        testResultFound = true;
      }
    }
    Assert.assertEquals(false, testResultFound);
  }
Example #3
0
  @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;
  }