Skip to content

Commit

Permalink
[BUG FIX] #273: 메인 버그 수정 및 테스트 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
tank3a committed Aug 16, 2023
1 parent 099df82 commit 8fc64e0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ModelShortMappedDto that = (ModelShortMappedDto) o;
return modelId == that.modelId && isDefaultModel == that.isDefaultModel && modelTypeId == that.modelTypeId && Objects.equals(modelName, that.modelName) && Objects.equals(modelTypeName, that.modelTypeName) && Objects.equals(modelPrice, that.modelPrice) && Objects.equals(modelBoughtCount, that.modelBoughtCount);
return modelId == that.modelId && isDefaultModel == that.isDefaultModel && modelTypeId == that.modelTypeId && Objects.equals(modelName, that.modelName) && Objects.equals(modelTypeName, that.modelTypeName) && Objects.equals(modelPrice, that.modelPrice) && Objects.equals(modelBoughtCount, that.modelBoughtCount) && Objects.equals(maxPs, that.maxPs) && Objects.equals(maxKgfm, that.maxKgfm);
}

public void setIsDefaultModel(int isDefaultModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ModelRepository(DataSource dataSource) {
}

public List<ModelShortMappedDto> findAllModelTypeData(int carId) {
String sql = "select m.model_id, m.model_name, t.model_type_id, t.model_type_name, m.model_price, mm.model_bought_count, mm.is_default_model " +
String sql = "select m.model_id, m.model_name, t.model_type_id, t.model_type_name, m.model_price, mm.model_bought_count, mm.is_default_model, pd.max_ps, pd.max_kgfm " +
"from ModelCarMapper mm " +
"inner join Model m " +
"on mm.model_id = m.model_id " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ void getOptionDetail() throws Exception {
given(optionService.getOptionDetailData(carId, optionWithHmg, false)).willReturn(expected1);
given(optionService.getOptionDetailData(carId, optionPackage, false)).willReturn(expected2);

ResultActions singleOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/optiondetail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionWithHmg)));
ResultActions packageOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/optiondetail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionPackage)));
ResultActions singleOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/sub/detail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionWithHmg)));
ResultActions packageOption = mockMvc.perform(MockMvcRequestBuilders.get("/api/options/sub/detail").param("carid", String.valueOf(carId)).param("optionid", String.valueOf(optionPackage)));

singleOption.andExpect(status().isOk())
.andExpect(jsonPath("$.categoryName").value("휠"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void getModelTypeData() {
.modelBoughtCount(200L)
.build());


int carId = 1;
Long boughtCount = 2000L;
when(modelRepository.findAllModelTypeData(carId)).thenReturn(trimModelList);
Expand All @@ -127,6 +128,7 @@ void getModelTypeData() {
assertEquals("바디타입", result.get(2).getModelTypeName());
assertEquals(130000L, result.get(3).getModelPrice());
assertEquals(10, result.get(5).getPercentage());
softAssertions.assertThat(result.get(0).getHmgData()).isNotNull();
}

@Test
Expand Down

0 comments on commit 8fc64e0

Please sign in to comment.