-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/#122 피드 아티스트 중복 제거
- Loading branch information
Showing
3 changed files
with
68 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/test/java/play/pluv/progress/domain/MusicTransferContextTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package play.pluv.progress.domain; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static play.pluv.fixture.TransferContextFixture.이전한_음악_목록; | ||
import static play.pluv.playlist.domain.MusicStreaming.APPLE; | ||
import static play.pluv.playlist.domain.MusicStreaming.SPOTIFY; | ||
import static play.pluv.playlist.domain.MusicStreaming.YOUTUBE; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import play.pluv.history.domain.HistoryMusicId; | ||
|
||
class MusicTransferContextTest { | ||
|
||
@Test | ||
void 피드를_생성할수_있다() { | ||
final List<TransferredMusicInContext> 이전한_음악_목록 = 이전한_음악_목록(); | ||
final MusicTransferContext context = new MusicTransferContext( | ||
10L, List.of(), 10, "imageUrl", "이전 중", APPLE, SPOTIFY | ||
); | ||
context.addTransferredMusics(이전한_음악_목록); | ||
|
||
final String actual = context.createFeed("creator").getArtistNames(); | ||
final String expected = "한로로,아이유,창모"; | ||
|
||
assertThat(actual) | ||
.isEqualTo(expected); | ||
} | ||
|
||
@Test | ||
void 피드를_생성할떄_가수이름이없는경우() { | ||
final List<TransferredMusicInContext> 이전한_음악_목록 = List.of( | ||
new TransferredMusicInContext(new HistoryMusicId(YOUTUBE, "c"), "ㅈㅣㅂ", "", "imageUrl", | ||
null), | ||
new TransferredMusicInContext(new HistoryMusicId(YOUTUBE, "d"), "금붕어", "", "imageUrl", | ||
null) | ||
); | ||
|
||
final MusicTransferContext context = new MusicTransferContext( | ||
10L, List.of(), 10, "imageUrl", "이전 중", APPLE, SPOTIFY | ||
); | ||
context.addTransferredMusics(이전한_음악_목록); | ||
|
||
final String actual = context.createFeed("creator").getArtistNames(); | ||
|
||
assertThat(actual) | ||
.isBlank(); | ||
} | ||
} |