From 1570462ff8548b9c2b21751d4986093487f20441 Mon Sep 17 00:00:00 2001 From: 5ms <86279729+oms01@users.noreply.github.com> Date: Sun, 27 Oct 2024 03:02:18 +0900 Subject: [PATCH] [TEST] TimeTableService Test Coverage 100 (#34) --- .../catspot/service/TimeTableServiceTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/test/java/com/catspot/service/TimeTableServiceTest.java b/src/test/java/com/catspot/service/TimeTableServiceTest.java index bc1a011..2b7ba7e 100644 --- a/src/test/java/com/catspot/service/TimeTableServiceTest.java +++ b/src/test/java/com/catspot/service/TimeTableServiceTest.java @@ -1,6 +1,7 @@ package com.catspot.service; import com.catspot.dto.response.TimeTableGetResponse; +import com.catspot.exceptionhandler.CustomException; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -23,4 +24,26 @@ class TimeTableServiceTest { assertEquals("N113", response.getClassName()); System.out.println("response = " + response.getClassName()); } + + @Test + void testGetTimeTableList_InvalidBuildingName() { + String buildingName = ""; + int classroomNumber = 303; + String day = "Monday"; + + assertThrows(CustomException.class, () -> { + timeTableService.getTimeTableList(buildingName, classroomNumber, day); + }); + } + + @Test + void testGetTimeTableList_InvalidClassroomNumber() { + String buildingName = "A"; + int classroomNumber = -1; // 유효하지 않은 강의실 번호 + String day = "Monday"; + + assertThrows(CustomException.class, () -> { + timeTableService.getTimeTableList(buildingName, classroomNumber, day); + }); + } }