generated from pricelees/issue-pr-template
[#5]: 공통 기능 코틀린 마이그레이션 및 패키지 분리 #6
@ -5,7 +5,7 @@ import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.stereotype.Component
|
||||
import roomescape.common.exception.ErrorType
|
||||
import roomescape.common.exception.RoomEscapeException
|
||||
import roomescape.common.exception.RoomescapeException
|
||||
import java.util.*
|
||||
|
||||
@Component
|
||||
@ -38,12 +38,12 @@ class JwtHandler(
|
||||
.toLong()
|
||||
} catch (e: Exception) {
|
||||
when (e) {
|
||||
is ExpiredJwtException -> throw RoomEscapeException(ErrorType.EXPIRED_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is UnsupportedJwtException -> throw RoomEscapeException(ErrorType.UNSUPPORTED_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is MalformedJwtException -> throw RoomEscapeException(ErrorType.MALFORMED_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is SignatureException -> throw RoomEscapeException(ErrorType.INVALID_SIGNATURE_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is IllegalArgumentException -> throw RoomEscapeException(ErrorType.INVALID_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
else -> throw RoomEscapeException(ErrorType.UNEXPECTED_ERROR, HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
is ExpiredJwtException -> throw RoomescapeException(ErrorType.EXPIRED_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is UnsupportedJwtException -> throw RoomescapeException(ErrorType.UNSUPPORTED_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is MalformedJwtException -> throw RoomescapeException(ErrorType.MALFORMED_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is SignatureException -> throw RoomescapeException(ErrorType.INVALID_SIGNATURE_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
is IllegalArgumentException -> throw RoomescapeException(ErrorType.INVALID_TOKEN, HttpStatus.UNAUTHORIZED)
|
||||
else -> throw RoomescapeException(ErrorType.UNEXPECTED_ERROR, HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import roomescape.member.business.MemberService
|
||||
import roomescape.member.infrastructure.persistence.Member
|
||||
import roomescape.auth.infrastructure.jwt.JwtHandler
|
||||
import roomescape.common.exception.ErrorType
|
||||
import roomescape.common.exception.RoomEscapeException
|
||||
import roomescape.common.exception.RoomescapeException
|
||||
|
||||
private fun Any.isIrrelevantWith(annotationType: Class<out Annotation>): Boolean {
|
||||
if (this !is HandlerMethod) {
|
||||
@ -40,9 +40,9 @@ class LoginInterceptor(
|
||||
val memberId: Long = jwtHandler.getMemberIdFromToken(token)
|
||||
|
||||
return memberService.existsById(memberId)
|
||||
} catch (e: RoomEscapeException) {
|
||||
} catch (e: RoomescapeException) {
|
||||
response.sendRedirect("/login")
|
||||
throw RoomEscapeException(ErrorType.LOGIN_REQUIRED, HttpStatus.FORBIDDEN)
|
||||
throw RoomescapeException(ErrorType.LOGIN_REQUIRED, HttpStatus.FORBIDDEN)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ class AdminInterceptor(
|
||||
val token: String? = request.accessTokenCookie().value
|
||||
val memberId: Long = jwtHandler.getMemberIdFromToken(token)
|
||||
member = memberService.findById(memberId)
|
||||
} catch (e: RoomEscapeException) {
|
||||
} catch (e: RoomescapeException) {
|
||||
response.sendRedirect("/login")
|
||||
throw e
|
||||
}
|
||||
@ -80,7 +80,7 @@ class AdminInterceptor(
|
||||
}
|
||||
|
||||
response.sendRedirect("/login")
|
||||
throw RoomEscapeException(
|
||||
throw RoomescapeException(
|
||||
ErrorType.PERMISSION_DOES_NOT_EXIST,
|
||||
String.format("[memberId: %d, Role: %s]", this.id, this.role),
|
||||
HttpStatus.FORBIDDEN
|
||||
|
||||
@ -60,7 +60,7 @@ enum class ErrorType(
|
||||
fun from(@JsonProperty("errorType") errorType: String): ErrorType {
|
||||
return entries.toTypedArray()
|
||||
.firstOrNull { it.name == errorType }
|
||||
?: throw RoomEscapeException(
|
||||
?: throw RoomescapeException(
|
||||
INVALID_REQUEST_DATA,
|
||||
"[ErrorType: ${errorType}]",
|
||||
HttpStatus.BAD_REQUEST
|
||||
|
||||
@ -22,9 +22,9 @@ public class ExceptionControllerAdvice {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@ExceptionHandler(value = {RoomEscapeException.class})
|
||||
public ErrorResponse handleRoomEscapeException(RoomEscapeException e, HttpServletResponse response) {
|
||||
logger.error("{}{}", e.getMessage(), e.getInvalidValue().orElse(""), e);
|
||||
@ExceptionHandler(value = {RoomescapeException.class})
|
||||
public ErrorResponse handleRoomEscapeException(RoomescapeException e, HttpServletResponse response) {
|
||||
logger.error("{}{}", e.getMessage(), e.getInvalidValue(), e);
|
||||
response.setStatus(e.getHttpStatus().value());
|
||||
return ErrorResponse.of(e.getErrorType(), e.getMessage());
|
||||
}
|
||||
|
||||
@ -1,41 +1,11 @@
|
||||
package roomescape.common.exception;
|
||||
package roomescape.common.exception
|
||||
|
||||
import java.util.Optional;
|
||||
import org.springframework.http.HttpStatusCode
|
||||
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
|
||||
public class RoomEscapeException extends RuntimeException {
|
||||
|
||||
private final ErrorType errorType;
|
||||
private final String message;
|
||||
private final String invalidValue;
|
||||
private final HttpStatusCode httpStatus;
|
||||
|
||||
public RoomEscapeException(ErrorType errorType, HttpStatusCode httpStatus) {
|
||||
this(errorType, null, httpStatus);
|
||||
}
|
||||
|
||||
public RoomEscapeException(ErrorType errorType, String invalidValue, HttpStatusCode httpStatus) {
|
||||
this.errorType = errorType;
|
||||
this.message = errorType.description;
|
||||
this.invalidValue = invalidValue;
|
||||
this.httpStatus = httpStatus;
|
||||
}
|
||||
|
||||
public ErrorType getErrorType() {
|
||||
return errorType;
|
||||
}
|
||||
|
||||
public HttpStatusCode getHttpStatus() {
|
||||
return httpStatus;
|
||||
}
|
||||
|
||||
public Optional<String> getInvalidValue() {
|
||||
return Optional.ofNullable(invalidValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
class RoomescapeException(
|
||||
val errorType: ErrorType,
|
||||
val invalidValue: String? = "",
|
||||
val httpStatus: HttpStatusCode,
|
||||
) : RuntimeException(errorType.description) {
|
||||
constructor(errorType: ErrorType, httpStatus: HttpStatusCode) : this(errorType, null, httpStatus)
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import roomescape.member.infrastructure.persistence.MemberRepository
|
||||
import roomescape.member.web.MembersResponse
|
||||
import roomescape.member.web.toResponse
|
||||
import roomescape.common.exception.ErrorType
|
||||
import roomescape.common.exception.RoomEscapeException
|
||||
import roomescape.common.exception.RoomescapeException
|
||||
|
||||
@Service
|
||||
@Transactional(readOnly = true)
|
||||
@ -23,7 +23,7 @@ class MemberService(
|
||||
)
|
||||
|
||||
fun findById(memberId: Long): Member = memberRepository.findByIdOrNull(memberId)
|
||||
?: throw RoomEscapeException(
|
||||
?: throw RoomescapeException(
|
||||
ErrorType.MEMBER_NOT_FOUND,
|
||||
String.format("[memberId: %d]", memberId),
|
||||
HttpStatus.BAD_REQUEST
|
||||
@ -31,7 +31,7 @@ class MemberService(
|
||||
|
||||
fun findMemberByEmailAndPassword(email: String, password: String): Member =
|
||||
memberRepository.findByEmailAndPassword(email, password)
|
||||
?: throw RoomEscapeException(
|
||||
?: throw RoomescapeException(
|
||||
ErrorType.MEMBER_NOT_FOUND,
|
||||
String.format("[email: %s, password: %s]", email, password),
|
||||
HttpStatus.BAD_REQUEST
|
||||
|
||||
@ -20,7 +20,7 @@ import roomescape.payment.dto.response.PaymentCancelResponse;
|
||||
import roomescape.payment.dto.response.PaymentResponse;
|
||||
import roomescape.payment.dto.response.TossPaymentErrorResponse;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Component
|
||||
public class TossPaymentClient {
|
||||
@ -76,7 +76,7 @@ public class TossPaymentClient {
|
||||
ErrorType errorType = getErrorTypeByStatusCode(statusCode);
|
||||
TossPaymentErrorResponse errorResponse = getErrorResponse(res);
|
||||
|
||||
throw new RoomEscapeException(errorType,
|
||||
throw new RoomescapeException(errorType,
|
||||
String.format("[ErrorCode = %s, ErrorMessage = %s]", errorResponse.code(), errorResponse.message()),
|
||||
statusCode);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Entity
|
||||
public class CanceledPayment {
|
||||
@ -39,7 +39,7 @@ public class CanceledPayment {
|
||||
|
||||
private void validateDate(OffsetDateTime approvedAt, OffsetDateTime canceledAt) {
|
||||
if (canceledAt.isBefore(approvedAt)) {
|
||||
throw new RoomEscapeException(ErrorType.CANCELED_BEFORE_PAYMENT,
|
||||
throw new RoomescapeException(ErrorType.CANCELED_BEFORE_PAYMENT,
|
||||
String.format("[approvedAt: %s, canceledAt: %s]", approvedAt, canceledAt),
|
||||
HttpStatus.CONFLICT);
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import roomescape.reservation.domain.Reservation;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Entity
|
||||
public class Payment {
|
||||
@ -63,21 +63,21 @@ public class Payment {
|
||||
|
||||
private void validateIsNullOrBlank(String input, String fieldName) {
|
||||
if (input == null || input.isBlank()) {
|
||||
throw new RoomEscapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[value : %s]", fieldName),
|
||||
throw new RoomescapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[value : %s]", fieldName),
|
||||
HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateIsInvalidAmount(Long totalAmount) {
|
||||
if (totalAmount == null || totalAmount < 0) {
|
||||
throw new RoomEscapeException(ErrorType.INVALID_REQUEST_DATA,
|
||||
throw new RoomescapeException(ErrorType.INVALID_REQUEST_DATA,
|
||||
String.format("[totalAmount : %d]", totalAmount), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void validateIsNull(T value, String fieldName) {
|
||||
if (value == null) {
|
||||
throw new RoomEscapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[value : %s]", fieldName),
|
||||
throw new RoomescapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[value : %s]", fieldName),
|
||||
HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ import roomescape.payment.dto.response.PaymentResponse;
|
||||
import roomescape.payment.dto.response.ReservationPaymentResponse;
|
||||
import roomescape.reservation.domain.Reservation;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@ -50,7 +50,7 @@ public class PaymentService {
|
||||
|
||||
public PaymentCancelRequest cancelPaymentByAdmin(Long reservationId) {
|
||||
String paymentKey = findPaymentByReservationId(reservationId)
|
||||
.orElseThrow(() -> new RoomEscapeException(ErrorType.PAYMENT_NOT_POUND,
|
||||
.orElseThrow(() -> new RoomescapeException(ErrorType.PAYMENT_NOT_POUND,
|
||||
String.format("[reservationId: %d]", reservationId), HttpStatus.NOT_FOUND))
|
||||
.getPaymentKey();
|
||||
// 취소 시간은 현재 시간으로 일단 생성한 뒤, 결제 취소 완료 후 해당 시간으로 변경합니다.
|
||||
@ -74,8 +74,8 @@ public class PaymentService {
|
||||
canceledPayment.setCanceledAt(canceledAt);
|
||||
}
|
||||
|
||||
private RoomEscapeException throwPaymentNotFoundByPaymentKey(String paymentKey) {
|
||||
return new RoomEscapeException(
|
||||
private RoomescapeException throwPaymentNotFoundByPaymentKey(String paymentKey) {
|
||||
return new RoomescapeException(
|
||||
ErrorType.PAYMENT_NOT_POUND, String.format("[paymentKey: %s]", paymentKey),
|
||||
HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ import roomescape.auth.web.support.LoginRequired;
|
||||
import roomescape.auth.web.support.MemberId;
|
||||
import roomescape.common.dto.response.ErrorResponse;
|
||||
import roomescape.common.dto.response.RoomEscapeApiResponse;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "3. 예약 API", description = "예약 및 대기 정보를 추가 / 조회 / 삭제할 때 사용합니다.")
|
||||
@ -151,7 +151,7 @@ public class ReservationController {
|
||||
ReservationResponse reservationResponse = reservationWithPaymentService.addReservationWithPayment(
|
||||
reservationRequest, paymentResponse, memberId);
|
||||
return getCreatedReservationResponse(reservationResponse, response);
|
||||
} catch (RoomEscapeException e) {
|
||||
} catch (RoomescapeException e) {
|
||||
PaymentCancelRequest cancelRequest = new PaymentCancelRequest(paymentRequest.paymentKey(),
|
||||
paymentRequest.amount(), e.getMessage());
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import roomescape.member.infrastructure.persistence.Member;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
|
||||
@Entity
|
||||
@ -77,7 +77,7 @@ public class Reservation {
|
||||
private void validateIsNull(LocalDate date, ReservationTime reservationTime, Theme theme, Member member,
|
||||
ReservationStatus reservationStatus) {
|
||||
if (date == null || reservationTime == null || theme == null || member == null || reservationStatus == null) {
|
||||
throw new RoomEscapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[values: %s]", this),
|
||||
throw new RoomescapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[values: %s]", this),
|
||||
HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Entity
|
||||
public class ReservationTime {
|
||||
@ -36,7 +36,7 @@ public class ReservationTime {
|
||||
|
||||
private void validateNull() {
|
||||
if (startAt == null) {
|
||||
throw new RoomEscapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[values: %s]", this),
|
||||
throw new RoomescapeException(ErrorType.REQUEST_DATA_BLANK, String.format("[values: %s]", this),
|
||||
HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import roomescape.reservation.domain.ReservationTime;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Schema(name = "예약 시간 저장 요청", description = "예약 시간 저장 요청시 사용됩니다.")
|
||||
public record ReservationTimeRequest(
|
||||
@ -20,7 +20,7 @@ public record ReservationTimeRequest(
|
||||
|
||||
public ReservationTimeRequest {
|
||||
if (StringUtils.isBlank(startAt.toString())) {
|
||||
throw new RoomEscapeException(ErrorType.REQUEST_DATA_BLANK,
|
||||
throw new RoomescapeException(ErrorType.REQUEST_DATA_BLANK,
|
||||
String.format("[values: %s]", this), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ import roomescape.reservation.dto.response.MyReservationsResponse;
|
||||
import roomescape.reservation.dto.response.ReservationResponse;
|
||||
import roomescape.reservation.dto.response.ReservationsResponse;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
import roomescape.theme.service.ThemeService;
|
||||
|
||||
@ -111,7 +111,7 @@ public class ReservationService {
|
||||
.build();
|
||||
|
||||
if (reservationRepository.exists(spec)) {
|
||||
throw new RoomEscapeException(ErrorType.HAS_RESERVATION_OR_WAITING, HttpStatus.BAD_REQUEST);
|
||||
throw new RoomescapeException(ErrorType.HAS_RESERVATION_OR_WAITING, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class ReservationService {
|
||||
.build();
|
||||
|
||||
if (reservationRepository.exists(spec)) {
|
||||
throw new RoomEscapeException(ErrorType.RESERVATION_DUPLICATED, HttpStatus.CONFLICT);
|
||||
throw new RoomescapeException(ErrorType.RESERVATION_DUPLICATED, HttpStatus.CONFLICT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ public class ReservationService {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime request = LocalDateTime.of(requestDate, requestReservationTime.getStartAt());
|
||||
if (request.isBefore(now)) {
|
||||
throw new RoomEscapeException(ErrorType.RESERVATION_PERIOD_IN_PAST,
|
||||
throw new RoomescapeException(ErrorType.RESERVATION_PERIOD_IN_PAST,
|
||||
String.format("[now: %s %s | request: %s %s]",
|
||||
now.toLocalDate(), now.toLocalTime(), requestDate, requestReservationTime.getStartAt()),
|
||||
HttpStatus.BAD_REQUEST
|
||||
@ -178,7 +178,7 @@ public class ReservationService {
|
||||
return;
|
||||
}
|
||||
if (startFrom.isAfter(endAt)) {
|
||||
throw new RoomEscapeException(ErrorType.INVALID_DATE_RANGE,
|
||||
throw new RoomescapeException(ErrorType.INVALID_DATE_RANGE,
|
||||
String.format("[startFrom: %s, endAt: %s", startFrom, endAt), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ public class ReservationService {
|
||||
public void approveWaiting(Long reservationId, Long memberId) {
|
||||
validateIsMemberAdmin(memberId);
|
||||
if (reservationRepository.isExistConfirmedReservation(reservationId)) {
|
||||
throw new RoomEscapeException(ErrorType.RESERVATION_DUPLICATED, HttpStatus.CONFLICT);
|
||||
throw new RoomescapeException(ErrorType.RESERVATION_DUPLICATED, HttpStatus.CONFLICT);
|
||||
}
|
||||
reservationRepository.updateStatusByReservationId(reservationId, ReservationStatus.CONFIRMED_PAYMENT_REQUIRED);
|
||||
}
|
||||
@ -217,11 +217,11 @@ public class ReservationService {
|
||||
if (member.isAdmin()) {
|
||||
return;
|
||||
}
|
||||
throw new RoomEscapeException(ErrorType.PERMISSION_DOES_NOT_EXIST, HttpStatus.FORBIDDEN);
|
||||
throw new RoomescapeException(ErrorType.PERMISSION_DOES_NOT_EXIST, HttpStatus.FORBIDDEN);
|
||||
}
|
||||
|
||||
private RoomEscapeException throwReservationNotFound(Long reservationId) {
|
||||
return new RoomEscapeException(ErrorType.RESERVATION_NOT_FOUND,
|
||||
private RoomescapeException throwReservationNotFound(Long reservationId) {
|
||||
return new RoomescapeException(ErrorType.RESERVATION_NOT_FOUND,
|
||||
String.format("[reservationId: %d]", reservationId), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ import roomescape.reservation.dto.response.ReservationTimeInfosResponse;
|
||||
import roomescape.reservation.dto.response.ReservationTimeResponse;
|
||||
import roomescape.reservation.dto.response.ReservationTimesResponse;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@ -37,7 +37,7 @@ public class ReservationTimeService {
|
||||
@Transactional(readOnly = true)
|
||||
public ReservationTime findTimeById(Long id) {
|
||||
return reservationTimeRepository.findById(id)
|
||||
.orElseThrow(() -> new RoomEscapeException(ErrorType.RESERVATION_TIME_NOT_FOUND,
|
||||
.orElseThrow(() -> new RoomescapeException(ErrorType.RESERVATION_TIME_NOT_FOUND,
|
||||
String.format("[reservationTimeId: %d]", id), HttpStatus.BAD_REQUEST));
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class ReservationTimeService {
|
||||
reservationTimeRequest.startAt());
|
||||
|
||||
if (!duplicateReservationTimes.isEmpty()) {
|
||||
throw new RoomEscapeException(ErrorType.TIME_DUPLICATED,
|
||||
throw new RoomescapeException(ErrorType.TIME_DUPLICATED,
|
||||
String.format("[startAt: %s]", reservationTimeRequest.startAt()), HttpStatus.CONFLICT);
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class ReservationTimeService {
|
||||
List<Reservation> usingTimeReservations = reservationRepository.findByReservationTime(reservationTime);
|
||||
|
||||
if (!usingTimeReservations.isEmpty()) {
|
||||
throw new RoomEscapeException(ErrorType.TIME_IS_USED_CONFLICT, String.format("[timeId: %d]", id),
|
||||
throw new RoomescapeException(ErrorType.TIME_IS_USED_CONFLICT, String.format("[timeId: %d]", id),
|
||||
HttpStatus.CONFLICT);
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import roomescape.reservation.domain.repository.ReservationRepository;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
import roomescape.theme.domain.repository.ThemeRepository;
|
||||
import roomescape.theme.dto.ThemeRequest;
|
||||
@ -31,7 +31,7 @@ public class ThemeService {
|
||||
@Transactional(readOnly = true)
|
||||
public Theme findThemeById(Long id) {
|
||||
return themeRepository.findById(id)
|
||||
.orElseThrow(() -> new RoomEscapeException(ErrorType.THEME_NOT_FOUND,
|
||||
.orElseThrow(() -> new RoomescapeException(ErrorType.THEME_NOT_FOUND,
|
||||
String.format("[themeId: %d]", id), HttpStatus.BAD_REQUEST));
|
||||
}
|
||||
|
||||
@ -69,14 +69,14 @@ public class ThemeService {
|
||||
|
||||
private void validateIsSameThemeNameExist(String name) {
|
||||
if (themeRepository.existsByName(name)) {
|
||||
throw new RoomEscapeException(ErrorType.THEME_DUPLICATED,
|
||||
throw new RoomescapeException(ErrorType.THEME_DUPLICATED,
|
||||
String.format("[name: %s]", name), HttpStatus.CONFLICT);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeThemeById(Long id) {
|
||||
if (themeRepository.isReservedTheme(id)) {
|
||||
throw new RoomEscapeException(ErrorType.THEME_IS_USED_CONFLICT,
|
||||
throw new RoomescapeException(ErrorType.THEME_IS_USED_CONFLICT,
|
||||
String.format("[themeId: %d]", id), HttpStatus.CONFLICT);
|
||||
}
|
||||
themeRepository.deleteById(id);
|
||||
|
||||
@ -15,7 +15,7 @@ import roomescape.member.infrastructure.persistence.MemberRepository
|
||||
import roomescape.auth.infrastructure.jwt.JwtHandler
|
||||
import roomescape.auth.service.AuthService
|
||||
import roomescape.common.exception.ErrorType
|
||||
import roomescape.common.exception.RoomEscapeException
|
||||
import roomescape.common.exception.RoomescapeException
|
||||
|
||||
|
||||
class AuthServiceTest : BehaviorSpec({
|
||||
@ -46,7 +46,7 @@ class AuthServiceTest : BehaviorSpec({
|
||||
memberRepository.findByEmailAndPassword(request.email, request.password)
|
||||
} returns null
|
||||
|
||||
val exception = shouldThrow<RoomEscapeException> {
|
||||
val exception = shouldThrow<RoomescapeException> {
|
||||
authService.login(request)
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class AuthServiceTest : BehaviorSpec({
|
||||
Then("회원이 없다면 예외를 던진다.") {
|
||||
every { memberRepository.findByIdOrNull(userId) } returns null
|
||||
|
||||
val exception = shouldThrow<RoomEscapeException> {
|
||||
val exception = shouldThrow<RoomescapeException> {
|
||||
authService.checkLogin(userId)
|
||||
}
|
||||
|
||||
|
||||
@ -5,10 +5,9 @@ import io.jsonwebtoken.SignatureAlgorithm
|
||||
import io.kotest.assertions.throwables.shouldThrow
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import roomescape.auth.infrastructure.jwt.JwtHandler
|
||||
import roomescape.util.JwtFixture
|
||||
import roomescape.common.exception.ErrorType
|
||||
import roomescape.common.exception.RoomEscapeException
|
||||
import roomescape.common.exception.RoomescapeException
|
||||
import java.util.*
|
||||
import kotlin.random.Random
|
||||
|
||||
@ -34,13 +33,13 @@ class JwtHandlerTest : FunSpec({
|
||||
Thread.sleep(expirationTime) // 만료 시간 이후로 대기
|
||||
|
||||
// when & then
|
||||
shouldThrow<RoomEscapeException> {
|
||||
shouldThrow<RoomescapeException> {
|
||||
shortExpirationTimeJwtHandler.getMemberIdFromToken(token)
|
||||
}.errorType shouldBe ErrorType.EXPIRED_TOKEN
|
||||
}
|
||||
|
||||
test("토큰이 빈 값이면 예외를 던진다.") {
|
||||
shouldThrow<RoomEscapeException> {
|
||||
shouldThrow<RoomescapeException> {
|
||||
jwtHandler.getMemberIdFromToken("")
|
||||
}.errorType shouldBe ErrorType.INVALID_TOKEN
|
||||
}
|
||||
@ -54,7 +53,7 @@ class JwtHandlerTest : FunSpec({
|
||||
.signWith(SignatureAlgorithm.HS256, JwtFixture.SECRET_KEY.substring(1).toByteArray())
|
||||
.compact()
|
||||
|
||||
shouldThrow<RoomEscapeException> {
|
||||
shouldThrow<RoomescapeException> {
|
||||
jwtHandler.getMemberIdFromToken(invalidSignatureToken)
|
||||
}.errorType shouldBe ErrorType.INVALID_SIGNATURE_TOKEN
|
||||
}
|
||||
|
||||
@ -5,8 +5,6 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
|
||||
import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
|
||||
import static org.springframework.test.web.client.response.MockRestResponseCreators.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -21,7 +19,7 @@ import roomescape.payment.dto.request.PaymentRequest;
|
||||
import roomescape.payment.dto.response.PaymentCancelResponse;
|
||||
import roomescape.payment.dto.response.PaymentResponse;
|
||||
import roomescape.common.exception.ErrorType;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
@RestClientTest(TossPaymentClient.class)
|
||||
class TossPaymentClientTest {
|
||||
@ -88,10 +86,10 @@ class TossPaymentClientTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> tossPaymentClient.confirmPayment(SampleTossPaymentConst.paymentRequest))
|
||||
.isInstanceOf(RoomEscapeException.class)
|
||||
.isInstanceOf(RoomescapeException.class)
|
||||
.hasFieldOrPropertyWithValue("errorType", ErrorType.PAYMENT_ERROR)
|
||||
.hasFieldOrPropertyWithValue("invalidValue",
|
||||
Optional.of("[ErrorCode = ERROR_CODE, ErrorMessage = Error message]"))
|
||||
"[ErrorCode = ERROR_CODE, ErrorMessage = Error message]")
|
||||
.hasFieldOrPropertyWithValue("httpStatus", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@ -109,10 +107,10 @@ class TossPaymentClientTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> tossPaymentClient.cancelPayment(SampleTossPaymentConst.cancelRequest))
|
||||
.isInstanceOf(RoomEscapeException.class)
|
||||
.isInstanceOf(RoomescapeException.class)
|
||||
.hasFieldOrPropertyWithValue("errorType", ErrorType.PAYMENT_SERVER_ERROR)
|
||||
.hasFieldOrPropertyWithValue("invalidValue",
|
||||
Optional.of("[ErrorCode = ERROR_CODE, ErrorMessage = Error message]"))
|
||||
"[ErrorCode = ERROR_CODE, ErrorMessage = Error message]")
|
||||
.hasFieldOrPropertyWithValue("httpStatus", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import java.time.OffsetDateTime;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
class CanceledPaymentTest {
|
||||
|
||||
@ -17,6 +17,6 @@ class CanceledPaymentTest {
|
||||
OffsetDateTime approvedAt = OffsetDateTime.now();
|
||||
OffsetDateTime canceledAt = approvedAt.minusMinutes(1L);
|
||||
assertThatThrownBy(() -> new CanceledPayment("payment-key", "reason", 10000L, approvedAt, canceledAt))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@ import roomescape.member.infrastructure.persistence.Role;
|
||||
import roomescape.reservation.domain.Reservation;
|
||||
import roomescape.reservation.domain.ReservationStatus;
|
||||
import roomescape.reservation.domain.ReservationTime;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
|
||||
class PaymentTest {
|
||||
@ -40,7 +40,7 @@ class PaymentTest {
|
||||
@NullAndEmptySource
|
||||
void invalidPaymentKey(String paymentKey) {
|
||||
assertThatThrownBy(() -> new Payment("order-id", paymentKey, 10000L, reservation, OffsetDateTime.now()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -48,7 +48,7 @@ class PaymentTest {
|
||||
@NullAndEmptySource
|
||||
void invalidOrderId(String orderId) {
|
||||
assertThatThrownBy(() -> new Payment(orderId, "payment-key", 10000L, reservation, OffsetDateTime.now()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -57,7 +57,7 @@ class PaymentTest {
|
||||
void invalidOrderId(Long totalAmount) {
|
||||
assertThatThrownBy(
|
||||
() -> new Payment("orderId", "payment-key", totalAmount, reservation, OffsetDateTime.now()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -65,7 +65,7 @@ class PaymentTest {
|
||||
@NullSource
|
||||
void invalidReservation(Reservation reservation) {
|
||||
assertThatThrownBy(() -> new Payment("orderId", "payment-key", 10000L, reservation, OffsetDateTime.now()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -73,6 +73,6 @@ class PaymentTest {
|
||||
@NullSource
|
||||
void invalidApprovedAt(OffsetDateTime approvedAt) {
|
||||
assertThatThrownBy(() -> new Payment("orderId", "payment-key", 10000L, reservation, approvedAt))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ import roomescape.reservation.domain.ReservationStatus;
|
||||
import roomescape.reservation.domain.ReservationTime;
|
||||
import roomescape.reservation.domain.repository.ReservationRepository;
|
||||
import roomescape.reservation.domain.repository.ReservationTimeRepository;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
import roomescape.theme.domain.repository.ThemeRepository;
|
||||
|
||||
@ -100,7 +100,7 @@ class PaymentServiceTest {
|
||||
|
||||
// when
|
||||
assertThatThrownBy(() -> paymentService.cancelPaymentByAdmin(nonExistentReservationId))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -136,6 +136,6 @@ class PaymentServiceTest {
|
||||
|
||||
// when
|
||||
assertThatThrownBy(() -> paymentService.updateCanceledTime("non-existent-payment-key", canceledAt))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import roomescape.member.infrastructure.persistence.Member;
|
||||
import roomescape.member.infrastructure.persistence.Role;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
|
||||
public class ReservationTest {
|
||||
@ -26,7 +26,7 @@ public class ReservationTest {
|
||||
// when & then
|
||||
Assertions.assertThatThrownBy(
|
||||
() -> new Reservation(date, reservationTime, theme, member, ReservationStatus.CONFIRMED))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
static Stream<Arguments> validateConstructorParameterBlankSource() {
|
||||
|
||||
@ -4,7 +4,7 @@ import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
|
||||
class ReservationTimeTest {
|
||||
|
||||
@ -14,6 +14,6 @@ class ReservationTimeTest {
|
||||
|
||||
// when & then
|
||||
Assertions.assertThatThrownBy(() -> new ReservationTime(null))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ import roomescape.reservation.domain.repository.ReservationTimeRepository;
|
||||
import roomescape.reservation.dto.request.ReservationRequest;
|
||||
import roomescape.reservation.dto.request.WaitingRequest;
|
||||
import roomescape.reservation.dto.response.ReservationResponse;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
import roomescape.theme.domain.repository.ThemeRepository;
|
||||
import roomescape.theme.service.ThemeService;
|
||||
@ -66,7 +66,7 @@ class ReservationServiceTest {
|
||||
assertThatThrownBy(() -> reservationService.addReservation(
|
||||
new ReservationRequest(date, reservationTime.getId(), theme.getId(), "paymentKey", "orderId",
|
||||
1000L, "paymentType"), member1.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -86,7 +86,7 @@ class ReservationServiceTest {
|
||||
// then
|
||||
assertThatThrownBy(() -> reservationService.addWaiting(
|
||||
new WaitingRequest(date, reservationTime.getId(), theme.getId()), member.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -110,7 +110,7 @@ class ReservationServiceTest {
|
||||
// then
|
||||
assertThatThrownBy(() -> reservationService.addWaiting(
|
||||
new WaitingRequest(date, reservationTime.getId(), theme.getId()), member1.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -126,7 +126,7 @@ class ReservationServiceTest {
|
||||
assertThatThrownBy(() -> reservationService.addReservation(
|
||||
new ReservationRequest(beforeDate, reservationTime.getId(), theme.getId(), "paymentKey", "orderId",
|
||||
1000L, "paymentType"), member.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -142,7 +142,7 @@ class ReservationServiceTest {
|
||||
assertThatThrownBy(() -> reservationService.addReservation(
|
||||
new ReservationRequest(beforeTime.toLocalDate(), reservationTime.getId(), theme.getId(), "paymentKey",
|
||||
"orderId", 1000L, "paymentType"), member.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -159,7 +159,7 @@ class ReservationServiceTest {
|
||||
new ReservationRequest(beforeTime.toLocalDate(), reservationTime.getId(), theme.getId(), "paymentKey",
|
||||
"orderId", 1000L, "paymentType"),
|
||||
NotExistMemberId))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -171,7 +171,7 @@ class ReservationServiceTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> reservationService.findFilteredReservations(null, null, dateFrom, dateTo))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -194,7 +194,7 @@ class ReservationServiceTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> reservationService.approveWaiting(waiting.id(), admin.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -22,7 +22,7 @@ import roomescape.reservation.domain.ReservationTime;
|
||||
import roomescape.reservation.domain.repository.ReservationRepository;
|
||||
import roomescape.reservation.domain.repository.ReservationTimeRepository;
|
||||
import roomescape.reservation.dto.request.ReservationTimeRequest;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
import roomescape.theme.domain.repository.ThemeRepository;
|
||||
|
||||
@ -50,7 +50,7 @@ class ReservationTimeServiceTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> reservationTimeService.addTime(new ReservationTimeRequest(LocalTime.of(12, 30))))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -64,7 +64,7 @@ class ReservationTimeServiceTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> reservationTimeService.findTimeById(invalidTimeId))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -83,6 +83,6 @@ class ReservationTimeServiceTest {
|
||||
|
||||
// then
|
||||
assertThatThrownBy(() -> reservationTimeService.removeTimeById(reservationTime.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import roomescape.reservation.dto.request.ReservationTimeRequest;
|
||||
import roomescape.reservation.dto.response.ReservationTimeResponse;
|
||||
import roomescape.reservation.service.ReservationService;
|
||||
import roomescape.reservation.service.ReservationTimeService;
|
||||
import roomescape.common.exception.RoomEscapeException;
|
||||
import roomescape.common.exception.RoomescapeException;
|
||||
import roomescape.theme.domain.Theme;
|
||||
import roomescape.theme.domain.repository.ThemeRepository;
|
||||
import roomescape.theme.dto.ThemeRequest;
|
||||
@ -73,7 +73,7 @@ class ThemeServiceTest {
|
||||
|
||||
// then
|
||||
assertThatThrownBy(() -> themeService.findThemeById(notExistId))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -128,7 +128,7 @@ class ThemeServiceTest {
|
||||
|
||||
// then
|
||||
assertThatThrownBy(() -> themeService.addTheme(invalidRequest))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -159,6 +159,6 @@ class ThemeServiceTest {
|
||||
|
||||
// when & then
|
||||
assertThatThrownBy(() -> themeService.removeThemeById(theme.getId()))
|
||||
.isInstanceOf(RoomEscapeException.class);
|
||||
.isInstanceOf(RoomescapeException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import roomescape.member.infrastructure.persistence.Member
|
||||
import roomescape.member.infrastructure.persistence.MemberRepository
|
||||
import roomescape.auth.infrastructure.jwt.JwtHandler
|
||||
import roomescape.common.exception.ErrorType
|
||||
import roomescape.common.exception.RoomEscapeException
|
||||
import roomescape.common.exception.RoomescapeException
|
||||
|
||||
const val NOT_LOGGED_IN_USERID: Long = 0;
|
||||
|
||||
@ -84,7 +84,7 @@ class RoomescapeApiTest(
|
||||
jwtHandler.getMemberIdFromToken(any())
|
||||
} returns NOT_LOGGED_IN_USERID
|
||||
|
||||
every { memberRepository.existsById(NOT_LOGGED_IN_USERID) } throws RoomEscapeException(
|
||||
every { memberRepository.existsById(NOT_LOGGED_IN_USERID) } throws RoomescapeException(
|
||||
ErrorType.LOGIN_REQUIRED,
|
||||
HttpStatus.FORBIDDEN
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user