Skip to content

Commit

Permalink
test : 지하철 노선 초기화
Browse files Browse the repository at this point in the history
지하철 노선 초기화 시 기본적인 역 목록을 설정하는 기능
  • Loading branch information
heondong9265 committed May 22, 2024
1 parent cfd12c4 commit cd4ecdd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ dependencies {
test {
useJUnitPlatform()
}
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
4 changes: 4 additions & 0 deletions src/main/java/subway/SubwayService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package subway;

public class SubwayService {
}
37 changes: 37 additions & 0 deletions src/test/java/subway/SubwayServiceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package subway;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

public class SubwayServiceTest {

@Nested
@DisplayName("SubwayService Initialization")
class SubwayService_Init {
SubwayService subwayService;

@BeforeEach
void setUp() {
subwayService = new SubwayService();
}

@Test
@DisplayName("지하철 노선도 초기화")
void initSubwayLine() {
subwayService.initSubwayLine();

assertAll(
() -> assertEquals(Arrays.asList("교대역", "강남역", "역삼역"), subwayService.getStations("2호선")),
() -> assertEquals(Arrays.asList("교대역", "남부터미널역", "양재역", "매봉역"), subwayService.getStations("3호선")),
() -> assertEquals(Arrays.asList("강남역", "양재역", "양재시민의숲역"), subwayService.getStations("신분당선"))
);
}
}
}

0 comments on commit cd4ecdd

Please sign in to comment.