diff --git a/src/test/java/com/moabam/api/domain/entity/BugTest.java b/src/test/java/com/moabam/api/domain/entity/BugTest.java index a72744f1..c356fd58 100644 --- a/src/test/java/com/moabam/api/domain/entity/BugTest.java +++ b/src/test/java/com/moabam/api/domain/entity/BugTest.java @@ -3,19 +3,25 @@ import static org.assertj.core.api.Assertions.*; import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import com.moabam.global.error.exception.BadRequestException; class BugTest { @DisplayName("벌레 개수가 음수이면 예외가 발생한다.") - @Test - void negative_bug_count_throws_exception() { + @ParameterizedTest + @CsvSource({ + "-10, 10, 10", + "10, -10, 10", + "10, 10, -10", + }) + void validate_bug_count_exception(int morningBug, int nightBug, int goldenBug) { Bug.BugBuilder bugBuilder = Bug.builder() - .morningBug(10) - .nightBug(10) - .goldenBug(-10); + .morningBug(morningBug) + .nightBug(nightBug) + .goldenBug(goldenBug); assertThatThrownBy(bugBuilder::build) .isInstanceOf(BadRequestException.class) diff --git a/src/test/java/com/moabam/api/presentation/BugControllerTest.java b/src/test/java/com/moabam/api/presentation/BugControllerTest.java index 1b003fc7..4bfedb04 100644 --- a/src/test/java/com/moabam/api/presentation/BugControllerTest.java +++ b/src/test/java/com/moabam/api/presentation/BugControllerTest.java @@ -42,7 +42,7 @@ void get_bug_success() throws Exception { BugResponse expected = BugMapper.toBugResponse(BugFixture.bug()); given(bugService.getBug(memberId)).willReturn(expected); - // when & then + // expected String content = mockMvc.perform(get("/bugs")) .andDo(print()) .andExpect(status().isOk())