Skip to content

Commit

Permalink
refactor: if 문 메서드 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyma-s committed Aug 9, 2023
1 parent 2c5c53b commit 7bd679a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public class UnregisteredSongResponse {

public static UnregisteredSongResponse from(
final SearchedSongFromManiaDBApiResponse searchedSongFromManiaDBApiResponse) {
if (searchedSongFromManiaDBApiResponse.getTrackArtists() == null
|| searchedSongFromManiaDBApiResponse.getTrackArtists().getArtists() == null) {
if (isEmptyArtists(searchedSongFromManiaDBApiResponse)) {
return new UnregisteredSongResponse(
searchedSongFromManiaDBApiResponse.getTitle().trim(),
EMPTY_SINGER,
Expand All @@ -37,6 +36,12 @@ public static UnregisteredSongResponse from(
);
}

private static boolean isEmptyArtists(
final SearchedSongFromManiaDBApiResponse searchedSongFromManiaDBApiResponse) {
return searchedSongFromManiaDBApiResponse.getTrackArtists() == null
|| searchedSongFromManiaDBApiResponse.getTrackArtists().getArtists() == null;
}

private static String collectToString(
final SearchedSongFromManiaDBApiResponse searchedSongFromManiaDBApiResponse) {
return searchedSongFromManiaDBApiResponse.getTrackArtists().getArtists().stream()
Expand Down

0 comments on commit 7bd679a

Please sign in to comment.