diff --git a/api/src/test/java/moa/acceptance/freind/FriendAcceptanceTest.java b/api/src/test/java/moa/acceptance/freind/FriendAcceptanceTest.java index 439a0f00..01c14bf7 100644 --- a/api/src/test/java/moa/acceptance/freind/FriendAcceptanceTest.java +++ b/api/src/test/java/moa/acceptance/freind/FriendAcceptanceTest.java @@ -54,6 +54,30 @@ class 연락처_동기화_API { // then assertStatus(response, OK); } + + @Test + void 연락처에_동일한_번호가_존재하면_둘_중_아무거나_하나의_이름으로_추가된다() { + // given + 말랑_token = login(말랑); + var request = new SyncContactRequest( + new ContactRequest("주예스", "010-2222-2222"), + new ContactRequest("주노", "010-2222-2222"), + new ContactRequest("주예스", "010-2222-2222") + ); + + // when + 연락처_동기화(말랑_token, request); + + // then + var response = 내_친구_목록_조회_요청(말랑_token); + List result = response.as(new TypeRef<>() { + }); + assertThat(result) + .hasSize(1) + .element(0) + .extracting(FriendResponse::customNickname) + .isIn("주노", "주예스"); + } } @Nested diff --git a/core/src/main/java/moa/client/discord/DiscordWebHookApiClient.java b/core/src/main/java/moa/client/discord/DiscordWebHookApiClient.java index ee31e30d..313e13b5 100644 --- a/core/src/main/java/moa/client/discord/DiscordWebHookApiClient.java +++ b/core/src/main/java/moa/client/discord/DiscordWebHookApiClient.java @@ -15,7 +15,7 @@ public interface DiscordWebHookApiClient { * https://discord.com/developers/docs/resources/webhook */ @PostExchange(url = "/webhooks/{webhookId}/{webhookToken}", contentType = APPLICATION_JSON_VALUE) - Void sendMessage( + void sendMessage( @PathVariable("webhookId") String webhookId, @PathVariable("webhookToken") String webhookToken, @RequestBody DiscordSendMessageRequest request diff --git a/core/src/main/java/moa/friend/application/command/MakeFromContactCommand.java b/core/src/main/java/moa/friend/application/command/MakeFromContactCommand.java index d06c9b90..ef9d8f6a 100644 --- a/core/src/main/java/moa/friend/application/command/MakeFromContactCommand.java +++ b/core/src/main/java/moa/friend/application/command/MakeFromContactCommand.java @@ -17,8 +17,11 @@ public record ContactInfo( public Map phoneAndNameMap() { return contactList.stream() - .collect(toMap(ContactInfo::phoneNumber, ContactInfo::name)); - + .collect(toMap( + ContactInfo::phoneNumber, + ContactInfo::name, + (order, recent) -> recent + )); } public List phones() {