-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : 알림 같이 가기 요청이 이미 존재한 경우 다시 알림을 보낼 수 없도록 validation 추가
- Loading branch information
1 parent
1394ea1
commit 2e06fc9
Showing
5 changed files
with
104 additions
and
36 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
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
44 changes: 44 additions & 0 deletions
44
...nd/emm-sale/src/test/java/com/emmsale/notification/domain/NotificationRepositoryTest.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,44 @@ | ||
package com.emmsale.notification.domain; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.test.context.jdbc.Sql; | ||
|
||
@DataJpaTest | ||
@AutoConfigureTestDatabase(replace = Replace.NONE) | ||
@Sql("/data-test.sql") | ||
class NotificationRepositoryTest { | ||
|
||
@Autowired | ||
private NotificationRepository notificationRepository; | ||
|
||
private Notification 알림1; | ||
|
||
@BeforeEach | ||
void init() { | ||
알림1 = new Notification(1L, 2L, 1L, "알림1"); | ||
notificationRepository.save(알림1); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"1,2,1,true", | ||
"1,2,2,false" | ||
}) | ||
@DisplayName("existsBySenderIdAndReceiverIdAndEventId() : receiverId, senderId, EventId를 통해서 알림이 존재하는지 확인할 수 있다.") | ||
void test_existsBySenderIdAndReceiverIdAndEventId( | ||
final Long senderId, final Long receiverId, final Long eventId, final boolean result | ||
) throws Exception { | ||
//when & then | ||
assertEquals(notificationRepository.existsBySenderIdAndReceiverIdAndEventId( | ||
senderId, receiverId, eventId), result); | ||
} | ||
} |