-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from softeerbootcamp-2nd/dev
[FEAT] 8.18 (금) 데모 버전
- Loading branch information
Showing
23 changed files
with
479 additions
and
142 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
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
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
61 changes: 61 additions & 0 deletions
61
backend/src/test/java/autoever2/cartag/integration/ColorTest.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,61 @@ | ||
package autoever2.cartag.integration; | ||
|
||
import autoever2.cartag.controller.ColorController; | ||
import autoever2.cartag.domain.color.InnerColorPercentDto; | ||
import autoever2.cartag.domain.color.OuterColorPercentDto; | ||
import autoever2.cartag.exception.EmptyDataException; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
@SpringBootTest | ||
@Transactional | ||
@ActiveProfiles("test") | ||
@Sql(scripts = {"classpath:/insert/insertColor-h2.sql"}) | ||
public class ColorTest { | ||
|
||
@Autowired | ||
ColorController controller; | ||
|
||
@Test | ||
@DisplayName("선택한 car_id에 따라 외장 색상 리스트를 반환합니다.") | ||
void getOuterColorList() { | ||
List<OuterColorPercentDto> outerColors = controller.carOuterColorInfo(1); | ||
assertEquals("천연 퀄팅(블랙)", outerColors.get(0).getColorName()); | ||
assertEquals("image_2", outerColors.get(1).getColorImage()); | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.carOuterColorInfo(2); | ||
}); | ||
} | ||
|
||
@Test | ||
@DisplayName("선택한 car_id에 따라 내장 색상 리스트를 반환합니다.") | ||
void getInnerColorList() { | ||
List<InnerColorPercentDto> innerColors = controller.carInnerColorInfo(1); | ||
assertEquals("퍼플 그레이 펄", innerColors.get(0).getColorName()); | ||
assertEquals("image_3", innerColors.get(0).getColorImage()); | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.carInnerColorInfo(2); | ||
}); | ||
} | ||
|
||
@Test | ||
@DisplayName("선택 차량의 외장색상 이미지 리스트를 반환합니다") | ||
void getOuterColorImageList() { | ||
List<String> images = controller.carOuterColorImageInfo(1); | ||
assertEquals(60, images.size()); | ||
assertEquals("red_image_30.jpg", images.get(29)); | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.carOuterColorImageInfo(3); | ||
}); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
backend/src/test/java/autoever2/cartag/integration/ModelTest.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,68 @@ | ||
package autoever2.cartag.integration; | ||
|
||
import autoever2.cartag.controller.ModelController; | ||
import autoever2.cartag.domain.model.ModelDetailMappedDto; | ||
import autoever2.cartag.domain.model.ModelEfficiencyDataDto; | ||
import autoever2.cartag.domain.model.ModelShortDataDto; | ||
import autoever2.cartag.domain.model.PowerTrainDataDto; | ||
import autoever2.cartag.exception.EmptyDataException; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
@SpringBootTest | ||
@ActiveProfiles("test") | ||
@Transactional | ||
@Sql({"classpath:insert/insert-model-h2.sql"}) | ||
public class ModelTest { | ||
|
||
@Autowired | ||
ModelController controller; | ||
|
||
@Test | ||
@DisplayName("차량 모델 페이지에서 하단의 리스트(파워트레인 등)를 반환하는 api 테스트") | ||
void getModelList() { | ||
List<ModelShortDataDto> trimModels = controller.getTrimModelType(1); | ||
assertEquals("디젤2.2", trimModels.get(0).getModelName()); | ||
assertEquals(0, trimModels.get(1).getModelPrice()); | ||
assertEquals("구동방식", trimModels.get(2).getModelTypeName()); | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.getTrimModelType(9); | ||
}); | ||
|
||
PowerTrainDataDto hmgData = trimModels.get(0).getHmgData(); | ||
assertEquals("45.0/1750~2750", hmgData.getMaxKgfm()); | ||
assertEquals(1.0, hmgData.getRatioKgfm()); | ||
} | ||
|
||
@Test | ||
@DisplayName("모델명과 설명, 이미지 반환하는 api 테스트") | ||
void getModelDescriptionAndImage() { | ||
ModelDetailMappedDto modelDetail = controller.getModelDetail(1); | ||
assertEquals("디젤2.2", modelDetail.getModelName()); | ||
assertEquals("/model/diesel2-2.jpg", modelDetail.getModelImage()); | ||
assertEquals("파워트레인", modelDetail.getModelTypeName()); | ||
assertEquals("높은 토크로 파워풀한 드라이빙이 가능하며, 차급대비 연비 효율이 우수합니다", modelDetail.getOptionDescription()); | ||
} | ||
|
||
@Test | ||
@DisplayName("파워트레인과 구동방식의 조합으로 나온 효츌 HMG값 반환") | ||
void getHmgData() { | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.getPowerTrainData(1, 1); | ||
}); | ||
|
||
ModelEfficiencyDataDto powerTrainData = controller.getPowerTrainData(1, 3); | ||
assertEquals("2,199cc", powerTrainData.getDisplacement()); | ||
assertEquals("12.16km/s", powerTrainData.getAverageFuel()); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
backend/src/test/java/autoever2/cartag/integration/OptionTest.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,80 @@ | ||
package autoever2.cartag.integration; | ||
|
||
import autoever2.cartag.controller.OptionController; | ||
import autoever2.cartag.domain.option.DefaultOptionDto; | ||
import autoever2.cartag.domain.option.OptionDetailDto; | ||
import autoever2.cartag.domain.option.OptionHmgDataVo; | ||
import autoever2.cartag.domain.option.SubOptionDto; | ||
import autoever2.cartag.exception.EmptyDataException; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
@SpringBootTest | ||
@Transactional | ||
@ActiveProfiles("test") | ||
@Sql({"classpath:insert/insert-suboption-h2.sql"}) | ||
public class OptionTest { | ||
@Autowired | ||
OptionController controller; | ||
|
||
@Test | ||
@DisplayName("추가 옵션 데이터와 선택 비율(%) 및 HMG 데이터 존재 여부 List 제공 테스트") | ||
void getOptionDataAndHmgDataList() { | ||
List<SubOptionDto> subOptionList = controller.getSubOptionList(1); | ||
assertEquals(6, subOptionList.size()); | ||
assertEquals("2열 통풍 시트", subOptionList.get(0).getOptionName()); | ||
assertEquals("/images/options/sub/2seats.jpg", subOptionList.get(0).getOptionImage()); | ||
assertEquals(100000, subOptionList.get(0).getOptionPrice()); | ||
assertEquals("상세품목", subOptionList.get(0).getOptionCategoryName()); | ||
} | ||
|
||
@Test | ||
@DisplayName("추가옵션 데이터 상세정보 및 이미지, HMG가 존재한다면(비어있다면 비어있는 부분을 Null) 태스트") | ||
void getOptionDetail() { | ||
OptionDetailDto subOptionDetail = controller.getSubOptionDetail(1, 1); | ||
assertEquals("2열 통풍 시트", subOptionDetail.getOptionName()); | ||
assertEquals("시동이 걸린 상태에서 해당 좌석의 통풍 스위치를 누르면 표시등이 켜지면서 해당 좌석에 바람이 나오는 편의장치입니다.", subOptionDetail.getOptionDescription()); | ||
|
||
OptionDetailDto subOptionDto = controller.getSubOptionDetail(1, 69); | ||
assertEquals("컴포트2", subOptionDto.getOptionName()); | ||
|
||
List<OptionDetailDto> subOptionList = subOptionDto.getSubOptionList(); | ||
assertEquals(2, subOptionList.size()); | ||
} | ||
|
||
@Test | ||
@DisplayName("기본옵션 데이터 상세정보 및 이미지, HMG가 존재한다면(비어있다면 비어있는 부분을 Null) 보냄 테스트") | ||
void getDataAndImage() { | ||
OptionDetailDto defaultOptionDetail = controller.getDefaultOptionDetail(1, 1); | ||
assertEquals("상세품목", defaultOptionDetail.getCategoryName()); | ||
assertEquals("2열 통풍 시트", defaultOptionDetail.getOptionName()); | ||
assertEquals("시동이 걸린 상태에서 해당 좌석의 통풍 스위치를 누르면 표시등이 켜지면서 해당 좌석에 바람이 나오는 편의장치입니다.", defaultOptionDetail.getOptionDescription()); | ||
assertFalse(defaultOptionDetail.isPackage()); | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.getDefaultOptionDetail(2, 1); | ||
}); | ||
|
||
OptionHmgDataVo hmgData = defaultOptionDetail.getHmgData(); | ||
assertEquals(38.0, hmgData.getOptionUsedCount()); | ||
} | ||
|
||
@Test | ||
@DisplayName("기본 옵션 데이터와 및 HMG 데이터 존재 여부 List 제공 테스트") | ||
void getOptionAndData(){ | ||
List<DefaultOptionDto> defaultOptionList = controller.getDefaultOptionList(1); | ||
assertEquals(3, defaultOptionList.size()); | ||
|
||
DefaultOptionDto defaultOptionDto = defaultOptionList.get(1); | ||
assertEquals("적외선 무릎 워머", defaultOptionDto.getOptionName()); | ||
assertEquals("악세사리", defaultOptionDto.getOptionCategoryName()); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
backend/src/test/java/autoever2/cartag/integration/TrimTest.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,39 @@ | ||
package autoever2.cartag.integration; | ||
|
||
import autoever2.cartag.controller.TrimController; | ||
import autoever2.cartag.domain.car.CarDto; | ||
import autoever2.cartag.exception.EmptyDataException; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
@SpringBootTest | ||
@Transactional | ||
@ActiveProfiles("test") | ||
@Sql(scripts = {"classpath:/insert/insertCar-h2.sql"}) | ||
public class TrimTest { | ||
@Autowired | ||
TrimController controller; | ||
|
||
@Test | ||
@DisplayName("cartype에 종속적인 차량 리스트 반환 api를 테스트 합니다.") | ||
void testCarController() { | ||
List<CarDto> cars = controller.carTrimInfo(1); | ||
assertEquals("Le Blanc", cars.get(0).getTrim()); | ||
assertEquals(40000000, cars.get(1).getCarDefaultPrice()); | ||
assertEquals("image_1", cars.get(2).getOuterImage()); | ||
assertEquals("image_2", cars.get(3).getInnerImage()); | ||
assertThrows(EmptyDataException.class, () -> { | ||
controller.carTrimInfo(2); | ||
}); | ||
} | ||
} |
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
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
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
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
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
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
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
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.