@Test public void testFormatArtistAndAlbum() { final Context context = RuntimeEnvironment.application; final String separator = context.getString(R.string.artist_album_separator); final String artist = "artist"; final String album = "album"; final String expected = artist + separator + album; assertEquals(expected, underTest.formatArtistAndAlbum(context.getResources(), artist, album)); }
@NonNull public String formatArtistAndAlbum(@NonNull final Resources res, @Nullable String artist, @Nullable String album) { if (TextUtils.isEmpty(artist)) { artist = res.getString(R.string.Unknown_artist); } if (TextUtils.isEmpty(album)) { album = res.getString(R.string.Unknown_album); } return artist + res.getString(R.string.artist_album_separator) + album; }
ArtistAlbumFormatter { @NonNull public String formatArtistAndAlbum(@NonNull final Resources res, @Nullable String artist, @Nullable String album) { if (TextUtils.isEmpty(artist)) { artist = res.getString(R.string.Unknown_artist); } if (TextUtils.isEmpty(album)) { album = res.getString(R.string.Unknown_album); } return artist + res.getString(R.string.artist_album_separator) + album; } }
ArtistAlbumFormatter { @NonNull public String formatArtistAndAlbum(@NonNull final Resources res, @Nullable String artist, @Nullable String album) { if (TextUtils.isEmpty(artist)) { artist = res.getString(R.string.Unknown_artist); } if (TextUtils.isEmpty(album)) { album = res.getString(R.string.Unknown_album); } return artist + res.getString(R.string.artist_album_separator) + album; }  }
ArtistAlbumFormatter { @NonNull public String formatArtistAndAlbum(@NonNull final Resources res, @Nullable String artist, @Nullable String album) { if (TextUtils.isEmpty(artist)) { artist = res.getString(R.string.Unknown_artist); } if (TextUtils.isEmpty(album)) { album = res.getString(R.string.Unknown_album); } return artist + res.getString(R.string.artist_album_separator) + album; }  @NonNull String formatArtistAndAlbum(@NonNull final Resources res,
            @Nullable String artist,
            @Nullable String album); }
ArtistAlbumFormatter { @NonNull public String formatArtistAndAlbum(@NonNull final Resources res, @Nullable String artist, @Nullable String album) { if (TextUtils.isEmpty(artist)) { artist = res.getString(R.string.Unknown_artist); } if (TextUtils.isEmpty(album)) { album = res.getString(R.string.Unknown_album); } return artist + res.getString(R.string.artist_album_separator) + album; }  @NonNull String formatArtistAndAlbum(@NonNull final Resources res,
            @Nullable String artist,
            @Nullable String album);  }