Skip to content

Commit 4dc9292

Browse files
committed
πŸ§ͺ Update: TestCode
#27
1 parent 96b4af3 commit 4dc9292

File tree

4 files changed

+43
-7
lines changed

4 files changed

+43
-7
lines changed

β€Žsrc/test/kotlin/nexters/weski/ski_resort/SkiResortControllerTest.ktβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class SkiResortControllerTest @Autowired constructor(
4343
)
4444
// Given
4545
val skiResorts = listOf(
46-
SkiResortResponseDto(1, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘.name, 3, currentWeather, weeklyWeather),
47-
SkiResortResponseDto(2, "μŠ€ν‚€μž₯ B", ResortStatus.μš΄μ˜μ€‘.name, 4, currentWeather, weeklyWeather),
46+
SkiResortResponseDto(1, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘.name, "λ―Έμ •", "λ―Έμ •", 3, currentWeather, weeklyWeather),
47+
SkiResortResponseDto(2, "μŠ€ν‚€μž₯ B", ResortStatus.μš΄μ˜μ€‘.name, "λ―Έμ •", "λ―Έμ •", 4, currentWeather, weeklyWeather),
4848
)
4949
every { skiResortService.getAllSkiResortsAndWeather() } returns skiResorts
5050

β€Žsrc/test/kotlin/nexters/weski/ski_resort/SkiResortServiceTest.ktβ€Ž

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,34 @@ class SkiResortServiceTest {
2222
fun `getAllSkiResorts should return list of SkiResortDto`() {
2323
// Given
2424
val skiResorts = listOf(
25-
SkiResort(1, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘, null, null, 5, 10),
26-
SkiResort(2, "μŠ€ν‚€μž₯ B", ResortStatus.μ˜ˆμ •, null, null, 0, 8)
25+
SkiResort(
26+
resortId = 1,
27+
name = "μŠ€ν‚€μž₯ A",
28+
status = ResortStatus.μš΄μ˜μ€‘,
29+
openingDate = null,
30+
closingDate = null,
31+
openSlopes = 3,
32+
totalSlopes = 8,
33+
xCoordinate = "12.0",
34+
yCoordinate = "34.0",
35+
detailedAreaCode = "11D20201",
36+
broadAreaCode = "11D20000"
37+
),
38+
SkiResort(
39+
resortId = 2,
40+
name = "μŠ€ν‚€μž₯ B",
41+
status = ResortStatus.μš΄μ˜μ€‘,
42+
openingDate = null,
43+
closingDate = null,
44+
openSlopes = 3,
45+
totalSlopes = 8,
46+
xCoordinate = "12.0",
47+
yCoordinate = "34.0",
48+
detailedAreaCode = "11D20201",
49+
broadAreaCode = "11D20000"
50+
)
2751
)
28-
every { skiResortRepository.findAll() } returns skiResorts
52+
every { skiResortRepository.findAllByOrderByOpeningDateAsc() } returns skiResorts
2953
every { currentWeatherRepository.findBySkiResortResortId(any()) } returns null
3054
every { dailyWeatherRepository.findAllBySkiResortResortId(any()) } returns emptyList()
3155

β€Žsrc/test/kotlin/nexters/weski/snow_maker/SnowMakerServiceTest.ktβ€Ž

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ class SnowMakerServiceTest {
3636
// Given
3737
val resortId = 1L
3838
val isPositive = true
39-
val skiResort = SkiResort(resortId, "μŠ€ν‚€μž₯ A", ResortStatus.μš΄μ˜μ€‘, null, null, 5, 10)
39+
val skiResort = SkiResort(
40+
resortId = 1,
41+
name = "μŠ€ν‚€μž₯ A",
42+
status = ResortStatus.μš΄μ˜μ€‘,
43+
openingDate = null,
44+
closingDate = null,
45+
openSlopes = 3,
46+
totalSlopes = 8,
47+
xCoordinate = "12.0",
48+
yCoordinate = "34.0",
49+
detailedAreaCode = "11D20201",
50+
broadAreaCode = "11D20000"
51+
)
4052
val snowMakerVote = SnowMakerVote(
4153
isPositive = isPositive,
4254
skiResort = skiResort

β€Žsrc/test/kotlin/nexters/weski/weather/WeatherServiceTest.ktβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class WeatherServiceTest {
2929
resortId, -5, -2, -8, -10, "눈이 내리고 μžˆμŠ΅λ‹ˆλ‹€.", "눈", skiResort
3030
)
3131
every { currentWeatherRepository.findBySkiResortResortId(resortId) } returns currentWeather
32-
every { hourlyWeatherRepository.findAll() } returns listOf()
32+
every { hourlyWeatherRepository.findBySkiResortResortId(resortId) } returns listOf()
3333
every { dailyWeatherRepository.findAllBySkiResortResortId(resortId) } returns listOf()
3434

3535
// When

0 commit comments

Comments
Β (0)