-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] 버스 노선, 정류장, 노선정류장 서비스 테스트 추가 (#50)
- BusRouteServiceTest 작성 - BusStationServiceTest 작성 - BusRouteStationServiceTest 작성 - 테스트를 위한 entity, dto factory : BusFactory 추가 --------- Co-authored-by: Photogrammer <[email protected]>
- Loading branch information
1 parent
0f67b83
commit fd089c2
Showing
5 changed files
with
517 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
server/src/test/java/com/talkka/server/bus/service/BusFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
package com.talkka.server.bus.service; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import com.talkka.server.bus.dao.BusRouteEntity; | ||
import com.talkka.server.bus.dao.BusRouteStationEntity; | ||
import com.talkka.server.bus.dao.BusStationEntity; | ||
import com.talkka.server.bus.dto.BusRouteCreateDto; | ||
import com.talkka.server.bus.dto.BusRouteRespDto; | ||
import com.talkka.server.bus.dto.BusRouteStationCreateDto; | ||
import com.talkka.server.bus.dto.BusRouteStationRespDto; | ||
import com.talkka.server.bus.dto.BusStationCreateDto; | ||
import com.talkka.server.bus.dto.BusStationRespDto; | ||
import com.talkka.server.bus.enums.BusRouteType; | ||
import com.talkka.server.bus.enums.CenterStation; | ||
import com.talkka.server.bus.enums.DistrictCode; | ||
import com.talkka.server.bus.enums.TurnStation; | ||
|
||
public class BusFactory { | ||
|
||
protected static BusRouteEntity getBusRouteEntity(Long id) { | ||
return BusRouteEntity.builder() | ||
.id(id) | ||
.apiRouteId("BRT" + id) | ||
.routeName("7800" + id) | ||
.routeTypeCd(BusRouteType.DIRECT_SEAT_CITY_BUS) | ||
.routeTypeName(BusRouteType.DIRECT_SEAT_CITY_BUS.getName()) | ||
.companyId("COMP123") | ||
.companyName("수형운수") | ||
.companyTel("02-123-4567") | ||
.districtCd(DistrictCode.DONGDUCHEON) | ||
.upFirstTime("05:30") | ||
.upLastTime("23:00") | ||
.downFirstTime("06:00") | ||
.downLastTime("00:35") | ||
.startMobileNo("101") | ||
.startStationId(1001L) | ||
.startStationName("기점 정류소") | ||
.endStationId(2002L) | ||
.endMobileNo("202") | ||
.endStationName("종점 정류소") | ||
.regionName("서울") | ||
.peekAlloc(15) | ||
.nPeekAlloc(25) | ||
.build(); | ||
} | ||
|
||
protected static BusRouteCreateDto getBusRouteCreateDto(Long id) { | ||
|
||
return BusRouteCreateDto.builder() | ||
.apiRouteId("BRT" + id) | ||
.routeName("7800") | ||
.routeTypeCd(BusRouteType.DIRECT_SEAT_CITY_BUS) | ||
.routeTypeName(BusRouteType.DIRECT_SEAT_CITY_BUS.getName()) | ||
.companyId("COMP123") | ||
.companyName("수형운수") | ||
.companyTel("02-123-4567") | ||
.districtCd(DistrictCode.DONGDUCHEON) | ||
.upFirstTime("05:30") | ||
.upLastTime("23:00") | ||
.downFirstTime("06:00") | ||
.downLastTime("00:35") | ||
.startMobileNo("101") | ||
.startStationId(1001L) | ||
.startStationName("기점 정류소") | ||
.endStationId(2002L) | ||
.endMobileNo("202") | ||
.endStationName("종점 정류소") | ||
.regionName("서울") | ||
.peekAlloc(15) | ||
.nPeekAlloc(25) | ||
.build(); | ||
} | ||
|
||
protected static BusRouteRespDto getBusRouteRespDto(Long id) { | ||
return BusRouteRespDto.builder() | ||
.routeId(id) | ||
.routeName("7800" + id) | ||
.routeTypeCd(BusRouteType.DIRECT_SEAT_CITY_BUS) | ||
.routeTypeName(BusRouteType.DIRECT_SEAT_CITY_BUS.getName()) | ||
.districtCd(DistrictCode.DONGDUCHEON) | ||
.upFirstTime("05:30") | ||
.upLastTime("23:00") | ||
.downFirstTime("06:00") | ||
.downLastTime("00:35") | ||
.startMobileNo("101") | ||
.startStationId(1001L) | ||
.startStationName("기점 정류소") | ||
.endStationId(2002L) | ||
.endMobileNo("202") | ||
.endStationName("종점 정류소") | ||
.regionName("서울") | ||
.peekAlloc(15) | ||
.nPeekAlloc(25) | ||
.build(); | ||
} | ||
|
||
protected static BusStationEntity getBusStationEntity(Long id) { | ||
return BusStationEntity.builder() | ||
.id(id) | ||
.apiStationId("BST" + id) | ||
.stationName("정거장" + id) | ||
.regionName("서울") | ||
.districtCd(DistrictCode.DONGDUCHEON) | ||
.centerYn(CenterStation.CENTER_STATION) | ||
.turnYn(TurnStation.TURN_STATION) | ||
.longitude(BigDecimal.valueOf(127.123456)) | ||
.latitude(BigDecimal.valueOf(37.123456)) | ||
.build(); | ||
} | ||
|
||
protected static BusStationCreateDto getBusStationCreateDto(Long id) { | ||
return BusStationCreateDto.builder() | ||
.apiStationId("BST" + id) | ||
.stationName("정거장" + id) | ||
.regionName("서울") | ||
.districtCd(DistrictCode.DONGDUCHEON) | ||
.centerYn(CenterStation.CENTER_STATION) | ||
.turnYn(TurnStation.TURN_STATION) | ||
.longitude(BigDecimal.valueOf(127.123456)) | ||
.latitude(BigDecimal.valueOf(37.123456)) | ||
.build(); | ||
} | ||
|
||
protected static BusStationRespDto getBusStationRespDto(Long id) { | ||
return BusStationRespDto.builder() | ||
.stationId(id) | ||
.stationName("정거장" + id) | ||
.regionName("서울") | ||
.districtCd(DistrictCode.DONGDUCHEON) | ||
.centerYn(CenterStation.CENTER_STATION) | ||
.turnYn(TurnStation.TURN_STATION) | ||
.longitude(BigDecimal.valueOf(127.123456)) | ||
.latitude(BigDecimal.valueOf(37.123456)) | ||
.build(); | ||
} | ||
|
||
protected static BusRouteStationEntity getBusRouteStationEntity(Long id, BusRouteEntity routeEntity, | ||
BusStationEntity stationEntity) { | ||
return BusRouteStationEntity.builder() | ||
.id(id) | ||
.route(routeEntity) | ||
.station(stationEntity) | ||
.stationName("정거장" + id) | ||
.stationSeq(Short.valueOf(String.valueOf(id))) | ||
.build(); | ||
} | ||
|
||
protected static BusRouteStationCreateDto getBusRouteStationCreateDto(Long id) { | ||
return BusRouteStationCreateDto.builder() | ||
.apiRouteId("BRT" + id) | ||
.apiStationId("BST" + id) | ||
.stationName("정거장" + id) | ||
.stationSeq(Short.valueOf(String.valueOf(id))) | ||
.build(); | ||
} | ||
|
||
protected static BusRouteStationRespDto getBusRouteStationRespDto(Long id, BusRouteRespDto routeRespDto, | ||
BusStationRespDto stationRespDto) { | ||
return BusRouteStationRespDto.builder() | ||
.busRouteStationId(id) | ||
.route(routeRespDto) | ||
.station(stationRespDto) | ||
.stationName("정거장" + id) | ||
.stationSeq(Short.valueOf(String.valueOf(id))) | ||
.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.