-
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.
- Loading branch information
Showing
2 changed files
with
50 additions
and
10 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
50 changes: 50 additions & 0 deletions
50
src/test/java/org/sopt/app/application/UserWithdrawTest.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,50 @@ | ||
package org.sopt.app.application; | ||
|
||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.verify; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
import org.sopt.app.application.user.UserWithdrawService; | ||
import org.sopt.app.common.event.EventPublisher; | ||
import org.sopt.app.interfaces.postgres.UserRepository; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class UserWithdrawTest { | ||
|
||
@Mock | ||
private EventPublisher eventPublisher; | ||
|
||
@Mock | ||
private UserRepository userRepository; | ||
|
||
@InjectMocks | ||
private UserWithdrawService userWithdrawService; | ||
|
||
@Test | ||
void SUCCESS_유저_탈퇴시_유저_삭제() { | ||
//given | ||
final Long userId = 1L; | ||
|
||
// when | ||
userWithdrawService.withdrawUser(userId); | ||
|
||
//then | ||
verify(userRepository).deleteById(userId); | ||
} | ||
|
||
@Test | ||
void SUCCESS_유저_탈퇴시_스탬프_삭제_이벤트_발생() { | ||
//given | ||
final Long userId = 1L; | ||
|
||
// when | ||
userWithdrawService.withdrawUser(userId); | ||
|
||
//then | ||
verify(eventPublisher).raise(any()); | ||
} | ||
} |