Skip to content

Commit

Permalink
[BUG FIX] #419: 모델 관련 테스트 코드 builder 패턴 부재로인한 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
tank3a committed Aug 23, 2023
1 parent 24dbe3d commit ba2f454
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package autoever2.cartag.models.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -19,4 +20,12 @@ public class ModelDetailMappedDto {
private String optionDescription;
@Schema(description = "이미지 저장 주소", example = "/model/1234.jpg")
private String modelImage;

@Builder
public ModelDetailMappedDto(String modelTypeName, String modelName, String optionDescription, String modelImage) {
this.modelTypeName = modelTypeName;
this.modelName = modelName;
this.optionDescription = optionDescription;
this.modelImage = modelImage;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package autoever2.cartag.models.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -15,4 +16,10 @@ public class ModelEfficiencyDataDto {
private String averageFuel;
@Schema(description = "배기량", example = "2,199cc")
private String displacement;

@Builder
public ModelEfficiencyDataDto(String averageFuel, String displacement) {
this.averageFuel = averageFuel;
this.displacement = displacement;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ public class ModelShortMappedDto {
private String maxPs;
private String maxKgfm;

@Builder
public ModelShortMappedDto(int modelId, String modelName, String modelTypeName, Long modelPrice, Long modelBoughtCount, boolean isDefaultModel, String modelImage, int modelTypeId, String maxPs, String maxKgfm) {
this.modelId = modelId;
this.modelName = modelName;
this.modelTypeName = modelTypeName;
this.modelPrice = modelPrice;
this.modelBoughtCount = modelBoughtCount;
this.isDefaultModel = isDefaultModel;
this.modelImage = modelImage;
this.modelTypeId = modelTypeId;
this.maxPs = maxPs;
this.maxKgfm = maxKgfm;
}

public void setIsDefaultModel(int isDefaultModel) {
this.isDefaultModel = isDefaultModel > 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package autoever2.cartag.models;

import autoever2.cartag.models.ModelRepository;
import autoever2.cartag.models.dto.ModelDefaultDto;
import autoever2.cartag.models.dto.ModelDetailMappedDto;
import autoever2.cartag.models.dto.ModelEfficiencyDataDto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package autoever2.cartag.models;

import autoever2.cartag.models.ModelService;
import autoever2.cartag.models.dto.ModelDetailMappedDto;
import autoever2.cartag.models.dto.ModelEfficiencyDataDto;
import autoever2.cartag.models.dto.ModelShortDataDto;
import autoever2.cartag.models.dto.ModelShortMappedDto;
import autoever2.cartag.exception.EmptyDataException;
import autoever2.cartag.cars.CarRepository;
import autoever2.cartag.models.ModelRepository;
import org.assertj.core.api.SoftAssertions;
import org.assertj.core.api.junit.jupiter.InjectSoftAssertions;
import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension;
Expand Down

0 comments on commit ba2f454

Please sign in to comment.