-
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.
merge : #130-행사 목록 조회에서 Status 필터링 시 발생하는 500 오류 해결
- Loading branch information
Showing
5 changed files
with
149 additions
and
38 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
40 changes: 40 additions & 0 deletions
40
backend/emm-sale/src/test/java/com/emmsale/event/domain/EventStatusTest.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,40 @@ | ||
package com.emmsale.event.domain; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
import com.emmsale.event.exception.EventException; | ||
import com.emmsale.event.exception.EventExceptionType; | ||
import org.assertj.core.api.ThrowableAssert.ThrowingCallable; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
class EventStatusTest { | ||
|
||
@ParameterizedTest | ||
@CsvSource(value = {"진행 중,IN_PROGRESS", "진행 예정,UPCOMING", "종료된 행사,ENDED"}, delimiter = ',') | ||
@DisplayName("동일한 문자 값을 갖는 EventStatus가 존재하면 해당 enum 객체를 반환한다.") | ||
void from_success(String input, EventStatus expected) { | ||
// given, when | ||
final EventStatus actual = EventStatus.from(input); | ||
|
||
// then | ||
assertThat(actual).isEqualTo(expected); | ||
|
||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"진행중", "진행예정", "아마란스", "진행 중 "}) | ||
@DisplayName("동일한 문자 값을 갖는 EventStatus가 존재하지 않으면 예외를 반환한다.") | ||
void from_fail(String input) { | ||
// given, when | ||
final ThrowingCallable actual = () -> EventStatus.from(input); | ||
|
||
// then | ||
assertThatThrownBy(actual) | ||
.isInstanceOf(EventException.class) | ||
.hasMessage(EventExceptionType.INVALID_STATUS.errorMessage()); | ||
} | ||
} |
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