|
| 1 | +package com.semosan.api.domain.hiking.dto.response; |
| 2 | + |
| 3 | +import com.semosan.api.domain.hiking.repository.projection.UserHikingRecordProjection; |
| 4 | +import org.junit.jupiter.api.Test; |
| 5 | + |
| 6 | +import java.time.LocalDate; |
| 7 | +import java.time.LocalDateTime; |
| 8 | + |
| 9 | +import static org.assertj.core.api.Assertions.assertThat; |
| 10 | + |
| 11 | +class GetUserHikingRecordResponseTest { |
| 12 | + |
| 13 | + @Test |
| 14 | + void fromMapsSessionId() { |
| 15 | + GetUserHikingRecordResponse response = GetUserHikingRecordResponse.from(projection()); |
| 16 | + |
| 17 | + assertThat(response.hikingRecordId()).isEqualTo(1L); |
| 18 | + assertThat(response.sessionId()).isEqualTo(10L); |
| 19 | + assertThat(response.hikedAt()).isEqualTo(LocalDate.of(2026, 5, 28)); |
| 20 | + } |
| 21 | + |
| 22 | + private UserHikingRecordProjection projection() { |
| 23 | + return new UserHikingRecordProjection() { |
| 24 | + @Override |
| 25 | + public Long getHikingRecordId() { |
| 26 | + return 1L; |
| 27 | + } |
| 28 | + |
| 29 | + @Override |
| 30 | + public Long getSessionId() { |
| 31 | + return 10L; |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + public Long getMountainId() { |
| 36 | + return 2L; |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public String getMountainName() { |
| 41 | + return "관악산"; |
| 42 | + } |
| 43 | + |
| 44 | + @Override |
| 45 | + public Long getCourseId() { |
| 46 | + return 3L; |
| 47 | + } |
| 48 | + |
| 49 | + @Override |
| 50 | + public String getCourseName() { |
| 51 | + return "연주대 코스"; |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public String getPhotoReportImageUrl() { |
| 56 | + return "photo-report"; |
| 57 | + } |
| 58 | + |
| 59 | + @Override |
| 60 | + public String getCliveImageUrl() { |
| 61 | + return "clive"; |
| 62 | + } |
| 63 | + |
| 64 | + @Override |
| 65 | + public Double getDistance() { |
| 66 | + return 6200.0; |
| 67 | + } |
| 68 | + |
| 69 | + @Override |
| 70 | + public Integer getDuration() { |
| 71 | + return 3600; |
| 72 | + } |
| 73 | + |
| 74 | + @Override |
| 75 | + public LocalDateTime getHikedAt() { |
| 76 | + return LocalDateTime.of(2026, 5, 28, 10, 0); |
| 77 | + } |
| 78 | + }; |
| 79 | + } |
| 80 | +} |
0 commit comments