LastFMHelper { @DebugLog public Metadata lookupAlbumInfo(final String albumArtist, final String albumName) { Call<Album> call = mLastFM.getAlbum(albumArtist, albumName); Response<Album> response; try { response = call.execute(); } catch (IOException|IllegalArgumentException e) { return null; } Album album = response.body(); if (album == null) { Timber.w("Failed to retrieve album %s", albumName); return null; } Metadata.Builder bob = Metadata.builder(); bob.putString(KEY_ALBUM_NAME, album.getName()); bob.putString(KEY_ALBUM_ARTIST_NAME, album.getArtist()); bob.putString(KEY_ALBUM_SUMMARY, album.getWikiSummary()); bob.putString(KEY_ALBUM_BIO, album.getWikiText()); Date lastChanged = album.getWikiLastChanged(); if (lastChanged != null) { bob.putLong(KEY_LAST_MODIFIED, lastChanged.getTime()); } bob.putUri(KEY_ALBUM_URL_URI, Uri.parse(album.getUrl())); bob.putString(KEY_ALBUM_MBID, album.getMbid()); return bob.build(); } @Inject  LastFMHelper(LastFM mLastFM); @DebugLog Metadata lookupAlbumInfo(final String albumArtist, final String albumName); @DebugLog Metadata lookupArtistInfo(final String artistName); Observable<Album> getAlbum(final String mbid); Observable<Artist> getArtist(final String mbid); static boolean hasFeaturedArtist(String artist); static String resolveAlbumArtistFromTrackArtist(String trackArtist); static String resolveTrackArtist(String trackArtist);  }
@Test public void testAlbumLookup() { Metadata meta = mHelper.lookupAlbumInfo("foxes", "glorious"); Assertions.assertThat(meta).isNotNull(); }