Skip to content

Commit

Permalink
test: (#281) 변수 명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 committed Jan 13, 2023
1 parent c680cc9 commit 02a5261
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class AdminSignInUseCaseTests {
private lateinit var queryUserPort: QueryUserPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

@MockBean
private lateinit var userJwtPort: UserJwtPort
private lateinit var jwtPort: UserJwtPort

private lateinit var adminSignInUseCase: AdminSignInUseCase

Expand Down Expand Up @@ -83,8 +83,8 @@ class AdminSignInUseCaseTests {
fun setUp() {
adminSignInUseCase = AdminSignInUseCase(
queryUserPort,
userJwtPort,
userSecurityPort
jwtPort,
securityPort
)
}

Expand All @@ -94,10 +94,10 @@ class AdminSignInUseCaseTests {
given(queryUserPort.queryUserByEmployeeNumber(employeeNumber))
.willReturn(adminStub)

given(userSecurityPort.compare(requestStub.password, adminStub.password.value))
given(securityPort.compare(requestStub.password, adminStub.password.value))
.willReturn(true)

given(userJwtPort.receiveToken(adminStub.id, adminStub.authority))
given(jwtPort.receiveToken(adminStub.id, adminStub.authority))
.willReturn(responseStub)

// when
Expand All @@ -113,7 +113,7 @@ class AdminSignInUseCaseTests {
given(queryUserPort.queryUserByEmployeeNumber(employeeNumber))
.willReturn(adminStub)

given(userSecurityPort.compare(requestStub.password, adminStub.password.value))
given(securityPort.compare(requestStub.password, adminStub.password.value))
.willReturn(false)

// when & then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChangeEmailUseCaseTests {
private lateinit var queryUserPort: QueryUserPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

@MockBean
private lateinit var queryAuthCodeLimitPort: QueryAuthCodeLimitPort
Expand Down Expand Up @@ -75,7 +75,7 @@ class ChangeEmailUseCaseTests {
fun setUp() {
changeEmailUseCase = ChangeEmailUseCase(
queryUserPort,
userSecurityPort,
securityPort,
queryAuthCodeLimitPort,
commandUserPort
)
Expand All @@ -90,7 +90,7 @@ class ChangeEmailUseCaseTests {
given(queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(requestStub.email))
.willReturn(authCodeLimitStub)

given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
Expand Down Expand Up @@ -153,7 +153,7 @@ class ChangeEmailUseCaseTests {
given(queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(requestStub.email))
.willReturn(authCodeLimitStub)

given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ChangeNicknameUseCaseTests {
private lateinit var queryUserPort: QueryUserPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

@MockBean
private lateinit var commandUserPort: CommandUserPort
Expand Down Expand Up @@ -57,7 +57,7 @@ class ChangeNicknameUseCaseTests {
fun setUp() {
changeNicknameUseCase = ChangeNicknameUseCase(
queryUserPort,
userSecurityPort,
securityPort,
commandUserPort
)
}
Expand All @@ -68,7 +68,7 @@ class ChangeNicknameUseCaseTests {
given(queryUserPort.existsUserByNickname(requestStub.nickname))
.willReturn(false)

given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ChangePasswordUseCaseTests {
private lateinit var queryUserPort: QueryUserPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

@MockBean
private lateinit var commandUserPort: CommandUserPort
Expand Down Expand Up @@ -58,24 +58,24 @@ class ChangePasswordUseCaseTests {
fun setUp() {
changePasswordUseCase = ChangePasswordUseCase(
queryUserPort,
userSecurityPort,
securityPort,
commandUserPort
)
}

@Test
fun `비밀번호 변경 성공`() {
// given
given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
.willReturn(userStub)

given(userSecurityPort.compare(requestStub.password, userStub.password.value))
given(securityPort.compare(requestStub.password, userStub.password.value))
.willReturn(true)

given(userSecurityPort.encode(requestStub.newPassword))
given(securityPort.encode(requestStub.newPassword))
.willReturn(requestStub.newPassword)

// when & then
Expand All @@ -87,7 +87,7 @@ class ChangePasswordUseCaseTests {
@Test
fun `유저 찾기 실패`() {
// given
given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
Expand All @@ -102,13 +102,13 @@ class ChangePasswordUseCaseTests {
@Test
fun `비밀번호 불일치`() {
// given
given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
.willReturn(userStub)

given(userSecurityPort.compare(requestStub.password, userStub.password.value))
given(securityPort.compare(requestStub.password, userStub.password.value))
.willReturn(false)

// when & then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ChangeProfileImageUseCaseTests {
private lateinit var queryUserPort: QueryUserPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

@MockBean
private lateinit var commandUserPort: CommandUserPort
Expand Down Expand Up @@ -62,7 +62,7 @@ class ChangeProfileImageUseCaseTests {
fun setUp() {
changeProfileImageUseCase = ChangeProfileImageUseCase(
queryUserPort,
userSecurityPort,
securityPort,
commandUserPort,
checkFilePort
)
Expand All @@ -74,7 +74,7 @@ class ChangeProfileImageUseCaseTests {
given(checkFilePort.existsPath(requestStub.profileImagePath))
.willReturn(true)

given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
Expand Down Expand Up @@ -104,7 +104,7 @@ class ChangeProfileImageUseCaseTests {
given(checkFilePort.existsPath(requestStub.profileImagePath))
.willReturn(true)

given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(id)

given(queryUserPort.queryUserById(id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ChangeSpotUseCaseTests {
private lateinit var querySpotPort: UserQuerySpotPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

private lateinit var changeSpotUseCase: ChangeSpotUseCase

Expand Down Expand Up @@ -63,13 +63,13 @@ class ChangeSpotUseCaseTests {

@BeforeEach
fun setUp() {
changeSpotUseCase = ChangeSpotUseCase(queryUserPort, commandUserPort, querySpotPort, userSecurityPort)
changeSpotUseCase = ChangeSpotUseCase(queryUserPort, commandUserPort, querySpotPort, securityPort)
}

@Test
fun `지점 변경 성공`() {
// given
given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
Expand All @@ -87,7 +87,7 @@ class ChangeSpotUseCaseTests {
@Test
fun `유저를 찾을 수 없음`() {
// given
given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
Expand All @@ -102,7 +102,7 @@ class ChangeSpotUseCaseTests {
@Test
fun `지점을 찾을 수 없음`() {
// given
given(userSecurityPort.getCurrentUserId())
given(securityPort.getCurrentUserId())
.willReturn(userId)

given(queryUserPort.queryUserById(userId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ResetPasswordUseCaseTests {
private lateinit var commandUserPort: CommandUserPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

private lateinit var resetPasswordUseCase: ResetPasswordUseCase

Expand Down Expand Up @@ -84,7 +84,7 @@ class ResetPasswordUseCaseTests {
userQueryAuthCodeLimitPort,
commandAuthCodeLimitPort,
commandUserPort,
userSecurityPort
securityPort
)
}

Expand All @@ -97,7 +97,7 @@ class ResetPasswordUseCaseTests {
given(queryUserPort.queryUserByEmailAndEmployeeNumber(requestStub.email, requestStub.employeeNumber))
.willReturn(userStub)

given(userSecurityPort.encode(requestStub.newPassword))
given(securityPort.encode(requestStub.newPassword))
.willReturn(requestStub.newPassword)

// when & then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import java.util.UUID
class SignUpUseCaseTests {

@MockBean
private lateinit var userJwtPort: UserJwtPort
private lateinit var jwtPort: UserJwtPort

@MockBean
private lateinit var commandUserPort: CommandUserPort
Expand All @@ -46,7 +46,7 @@ class SignUpUseCaseTests {
private lateinit var commandDeviceTokenPort: CommandDeviceTokenPort

@MockBean
private lateinit var userSecurityPort: UserSecurityPort
private lateinit var securityPort: UserSecurityPort

@MockBean
private lateinit var queryUserPort: QueryUserPort
Expand Down Expand Up @@ -154,15 +154,15 @@ class SignUpUseCaseTests {
@BeforeEach
fun setUp() {
signUpUseCase = SignUpUseCase(
userJwtPort,
jwtPort,
commandUserPort,
commandDeviceTokenPort,
queryUserPort,
userQueryAuthCodeLimitPort,
commandAuthCodeLimitPort,
userQuerySpotPort,
userQueryTeamPort,
userSecurityPort,
securityPort,
queryEmployeeCertificatePort
)
}
Expand Down Expand Up @@ -203,13 +203,13 @@ class SignUpUseCaseTests {
given(userQueryTeamPort.queryTeamByName(employeeCertificateStub.teamName))
.willReturn(teamStub)

given(userSecurityPort.encode(requestStub.password))
given(securityPort.encode(requestStub.password))
.willReturn(userStub.password.value)

given(commandUserPort.save(userStub))
.willReturn(saveUserStub)

given(userJwtPort.receiveToken(saveUserStub.id, saveUserStub.authority))
given(jwtPort.receiveToken(saveUserStub.id, saveUserStub.authority))
.willReturn(responseStub)

// when
Expand Down Expand Up @@ -265,13 +265,13 @@ class SignUpUseCaseTests {
given(userQueryTeamPort.queryTeamByName(employeeCertificateStub.teamName))
.willReturn(teamStub)

given(userSecurityPort.encode(requestStub.password))
given(securityPort.encode(requestStub.password))
.willReturn(userStub.password.value)

given(commandUserPort.save(userStub))
.willReturn(saveUserStub)

given(userJwtPort.receiveToken(saveUserStub.id, saveUserStub.authority))
given(jwtPort.receiveToken(saveUserStub.id, saveUserStub.authority))
.willReturn(responseStub)

// when
Expand Down

0 comments on commit 02a5261

Please sign in to comment.