refactor: Exception Class Naming 변경
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package com.ticketing.server.global.exception;
|
||||
|
||||
public class NotFoundEmailException extends IllegalArgumentException {
|
||||
public class EmailNotFoundException extends IllegalArgumentException {
|
||||
|
||||
private static final String MESSAGE = "존재하지 않는 이메일 입니다.";
|
||||
|
||||
public NotFoundEmailException() {
|
||||
public EmailNotFoundException() {
|
||||
super(MESSAGE);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.ticketing.server.global.exception.token;
|
||||
|
||||
public class NotFindTokenException extends TokenException {
|
||||
public class TokenNotFindException extends TokenException {
|
||||
|
||||
private static final String MESSAGE = "일치하는 토큰을 찾지 못하였습니다.";
|
||||
|
||||
public NotFindTokenException() {
|
||||
public TokenNotFindException() {
|
||||
super(MESSAGE);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ticketing.server.user.service;
|
||||
|
||||
import com.ticketing.server.global.exception.token.NotFindTokenException;
|
||||
import com.ticketing.server.global.exception.token.TokenNotFindException;
|
||||
import com.ticketing.server.global.exception.token.TokenTypeException;
|
||||
import com.ticketing.server.global.exception.token.UnavailableRefreshTokenException;
|
||||
import com.ticketing.server.global.redis.RefreshRedisRepository;
|
||||
@@ -60,7 +60,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
||||
|
||||
// Redis 에 토큰이 있는지 검증
|
||||
RefreshToken findTokenEntity = refreshRedisRepository.findByEmail(authentication.getName())
|
||||
.orElseThrow(NotFindTokenException::new);
|
||||
.orElseThrow(TokenNotFindException::new);
|
||||
|
||||
// redis 토큰과 input 토큰이 일치한지 확인
|
||||
if (!refreshToken.equals(findTokenEntity.getToken())) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ticketing.server.user.service;
|
||||
|
||||
import com.ticketing.server.global.exception.NotFoundEmailException;
|
||||
import com.ticketing.server.global.exception.EmailNotFoundException;
|
||||
import com.ticketing.server.user.domain.User;
|
||||
import com.ticketing.server.user.domain.repository.UserRepository;
|
||||
import com.ticketing.server.user.service.dto.ChangePasswordDTO;
|
||||
@@ -42,7 +42,7 @@ public class UserServiceImpl implements UserService {
|
||||
User user = userRepository.findByEmail(deleteUserDto.getEmail())
|
||||
.orElseThrow(() -> {
|
||||
log.error("존재하지 않는 이메일 입니다. :: {}", deleteUserDto.getEmail());
|
||||
throw new NotFoundEmailException();
|
||||
throw new EmailNotFoundException();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class UserServiceImpl implements UserService {
|
||||
return userRepository.findByEmailAndIsDeletedFalse(email)
|
||||
.orElseThrow(() -> {
|
||||
log.error("존재하지 않는 이메일 입니다. :: {}", email);
|
||||
throw new NotFoundEmailException();
|
||||
throw new EmailNotFoundException();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.ticketing.server.global.exception.NotFoundEmailException;
|
||||
import com.ticketing.server.global.exception.EmailNotFoundException;
|
||||
import com.ticketing.server.user.domain.User;
|
||||
import com.ticketing.server.user.domain.UserGrade;
|
||||
import com.ticketing.server.user.domain.repository.UserRepository;
|
||||
@@ -79,7 +79,7 @@ class UserServiceImplTest {
|
||||
// when
|
||||
// then
|
||||
assertThatThrownBy(() -> userService.delete(deleteUserDto))
|
||||
.isInstanceOf(NotFoundEmailException.class);
|
||||
.isInstanceOf(EmailNotFoundException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,7 +104,7 @@ class UserServiceImplTest {
|
||||
// when
|
||||
// then
|
||||
assertThatThrownBy(() -> userService.changePassword(changePasswordDto))
|
||||
.isInstanceOf(NotFoundEmailException.class);
|
||||
.isInstanceOf(EmailNotFoundException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user