Skip to content

Commit

Permalink
[TEST] TimeTableService Test Coverage 100 (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
oms01 authored Oct 26, 2024
1 parent f55ecfb commit 1570462
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/java/com/catspot/service/TimeTableServiceTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
});
}
}

0 comments on commit 1570462

Please sign in to comment.