From 35bc9f71c7243943c0fba6d9f59051e4007da3fb Mon Sep 17 00:00:00 2001 From: JaeUk Jeong Date: Wed, 13 Mar 2024 12:37:03 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#80=20=EC=95=85=EA=B8=B0=20DTO=EC=97=90?= =?UTF-8?q?=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/InstrumentCategory.java | 11 +++++ .../dto/AcousticAndClassicGuitarDto.java | 36 +++++++--------- .../domain/instrument/dto/AmplifierDto.java | 30 +++++-------- .../instrument/dto/AudioEquipmentDto.java | 28 +++++------- .../domain/instrument/dto/BassGuitarDto.java | 32 ++++++-------- .../domain/instrument/dto/EffectorDto.java | 28 +++++------- .../instrument/dto/ElectricGuitarDto.java | 38 +++++++--------- .../domain/instrument/dto/InstrumentDto.java | 43 +++++++++++++++++++ .../service/InstrumentQueryServiceTest.java | 30 +++++++++---- .../com/ajou/hertz/util/ReflectionUtils.java | 15 ++++--- 10 files changed, 157 insertions(+), 134 deletions(-) create mode 100644 src/main/java/com/ajou/hertz/domain/instrument/constant/InstrumentCategory.java diff --git a/src/main/java/com/ajou/hertz/domain/instrument/constant/InstrumentCategory.java b/src/main/java/com/ajou/hertz/domain/instrument/constant/InstrumentCategory.java new file mode 100644 index 0000000..beafae3 --- /dev/null +++ b/src/main/java/com/ajou/hertz/domain/instrument/constant/InstrumentCategory.java @@ -0,0 +1,11 @@ +package com.ajou.hertz.domain.instrument.constant; + +public enum InstrumentCategory { + + ELECTRIC_GUITAR, + BASS_GUITAR, + ACOUSTIC_AND_CLASSIC_GUITAR, + EFFECTOR, + AMPLIFIER, + AUDIO_EQUIPMENT +} diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/AcousticAndClassicGuitarDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/AcousticAndClassicGuitarDto.java index 0df4349..a7bbae7 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/AcousticAndClassicGuitarDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/AcousticAndClassicGuitarDto.java @@ -7,6 +7,7 @@ import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarModel; import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarPickUp; import com.ajou.hertz.domain.instrument.constant.AcousticAndClassicGuitarWood; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.entity.AcousticAndClassicGuitar; import com.ajou.hertz.domain.user.dto.UserDto; @@ -24,7 +25,7 @@ public class AcousticAndClassicGuitarDto extends InstrumentDto { private AcousticAndClassicGuitarWood wood; private AcousticAndClassicGuitarPickUp pickUp; - private AcousticAndClassicGuitarDto( + public AcousticAndClassicGuitarDto( Long id, UserDto seller, String title, @@ -42,8 +43,8 @@ private AcousticAndClassicGuitarDto( AcousticAndClassicGuitarPickUp pickUp ) { super( - id, seller, title, progressStatus, tradeAddress, qualityStatus, - price, hasAnomaly, description, images, hashtags + id, seller, InstrumentCategory.ACOUSTIC_AND_CLASSIC_GUITAR, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags ); this.brand = brand; this.model = model; @@ -51,24 +52,17 @@ private AcousticAndClassicGuitarDto( this.pickUp = pickUp; } - public static AcousticAndClassicGuitarDto from(AcousticAndClassicGuitar acousticAndClassicGuitar) { - InstrumentDto instrumentDto = InstrumentDto.from(acousticAndClassicGuitar); - return new AcousticAndClassicGuitarDto( - instrumentDto.getId(), - instrumentDto.getSeller(), - instrumentDto.getTitle(), - instrumentDto.getProgressStatus(), - instrumentDto.getTradeAddress(), - instrumentDto.getQualityStatus(), - instrumentDto.getPrice(), - instrumentDto.getHasAnomaly(), - instrumentDto.getDescription(), - instrumentDto.getImages(), - instrumentDto.getHashtags(), - acousticAndClassicGuitar.getBrand(), - acousticAndClassicGuitar.getModel(), - acousticAndClassicGuitar.getWood(), - acousticAndClassicGuitar.getPickUp() + private AcousticAndClassicGuitarDto(AcousticAndClassicGuitar acousticAndClassicGuitar) { + super( + acousticAndClassicGuitar ); + this.brand = acousticAndClassicGuitar.getBrand(); + this.model = acousticAndClassicGuitar.getModel(); + this.wood = acousticAndClassicGuitar.getWood(); + this.pickUp = acousticAndClassicGuitar.getPickUp(); + } + + public static AcousticAndClassicGuitarDto from(AcousticAndClassicGuitar acousticAndClassicGuitar) { + return new AcousticAndClassicGuitarDto(acousticAndClassicGuitar); } } diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/AmplifierDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/AmplifierDto.java index 38c5499..5e5f5d0 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/AmplifierDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/AmplifierDto.java @@ -6,6 +6,7 @@ import com.ajou.hertz.domain.instrument.constant.AmplifierBrand; import com.ajou.hertz.domain.instrument.constant.AmplifierType; import com.ajou.hertz.domain.instrument.constant.AmplifierUsage; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.entity.Amplifier; import com.ajou.hertz.domain.user.dto.UserDto; @@ -39,31 +40,22 @@ private AmplifierDto( AmplifierUsage usage ) { super( - id, seller, title, progressStatus, tradeAddress, qualityStatus, - price, hasAnomaly, description, images, hashtags + id, seller, InstrumentCategory.AMPLIFIER, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags ); this.type = type; this.brand = brand; this.usage = usage; } + private AmplifierDto(Amplifier amplifier) { + super(amplifier); + this.type = amplifier.getType(); + this.brand = amplifier.getBrand(); + this.usage = amplifier.getUsage(); + } + public static AmplifierDto from(Amplifier amplifier) { - InstrumentDto instrumentDto = InstrumentDto.from(amplifier); - return new AmplifierDto( - instrumentDto.getId(), - instrumentDto.getSeller(), - instrumentDto.getTitle(), - instrumentDto.getProgressStatus(), - instrumentDto.getTradeAddress(), - instrumentDto.getQualityStatus(), - instrumentDto.getPrice(), - instrumentDto.getHasAnomaly(), - instrumentDto.getDescription(), - instrumentDto.getImages(), - instrumentDto.getHashtags(), - amplifier.getType(), - amplifier.getBrand(), - amplifier.getUsage() - ); + return new AmplifierDto(amplifier); } } diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/AudioEquipmentDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/AudioEquipmentDto.java index 4c58843..bf8b89b 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/AudioEquipmentDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/AudioEquipmentDto.java @@ -4,6 +4,7 @@ import com.ajou.hertz.common.dto.AddressDto; import com.ajou.hertz.domain.instrument.constant.AudioEquipmentType; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.entity.AudioEquipment; import com.ajou.hertz.domain.user.dto.UserDto; @@ -18,7 +19,7 @@ public class AudioEquipmentDto extends InstrumentDto { private AudioEquipmentType type; - private AudioEquipmentDto( + public AudioEquipmentDto( Long id, UserDto seller, String title, @@ -33,27 +34,18 @@ private AudioEquipmentDto( AudioEquipmentType type ) { super( - id, seller, title, progressStatus, tradeAddress, qualityStatus, - price, hasAnomaly, description, images, hashtags + id, seller, InstrumentCategory.AUDIO_EQUIPMENT, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags ); this.type = type; } + private AudioEquipmentDto(AudioEquipment audioEquipment) { + super(audioEquipment); + this.type = audioEquipment.getType(); + } + public static AudioEquipmentDto from(AudioEquipment audioEquipment) { - InstrumentDto instrumentDto = InstrumentDto.from(audioEquipment); - return new AudioEquipmentDto( - instrumentDto.getId(), - instrumentDto.getSeller(), - instrumentDto.getTitle(), - instrumentDto.getProgressStatus(), - instrumentDto.getTradeAddress(), - instrumentDto.getQualityStatus(), - instrumentDto.getPrice(), - instrumentDto.getHasAnomaly(), - instrumentDto.getDescription(), - instrumentDto.getImages(), - instrumentDto.getHashtags(), - audioEquipment.getType() - ); + return new AudioEquipmentDto(audioEquipment); } } diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/BassGuitarDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/BassGuitarDto.java index 4794e68..a11a8e1 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/BassGuitarDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/BassGuitarDto.java @@ -7,6 +7,7 @@ import com.ajou.hertz.domain.instrument.constant.BassGuitarPickUp; import com.ajou.hertz.domain.instrument.constant.BassGuitarPreAmplifier; import com.ajou.hertz.domain.instrument.constant.GuitarColor; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.entity.BassGuitar; import com.ajou.hertz.domain.user.dto.UserDto; @@ -42,8 +43,8 @@ private BassGuitarDto( GuitarColor color ) { super( - id, seller, title, progressStatus, tradeAddress, qualityStatus, - price, hasAnomaly, description, images, hashtags + id, seller, InstrumentCategory.BASS_GUITAR, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags ); this.brand = brand; this.pickUp = pickUp; @@ -51,24 +52,15 @@ private BassGuitarDto( this.color = color; } + private BassGuitarDto(BassGuitar bassGuitar) { + super(bassGuitar); + this.brand = bassGuitar.getBrand(); + this.pickUp = bassGuitar.getPickUp(); + this.preAmplifier = bassGuitar.getPreAmplifier(); + this.color = bassGuitar.getColor(); + } + public static BassGuitarDto from(BassGuitar bassGuitar) { - InstrumentDto instrumentDto = InstrumentDto.from(bassGuitar); - return new BassGuitarDto( - instrumentDto.getId(), - instrumentDto.getSeller(), - instrumentDto.getTitle(), - instrumentDto.getProgressStatus(), - instrumentDto.getTradeAddress(), - instrumentDto.getQualityStatus(), - instrumentDto.getPrice(), - instrumentDto.getHasAnomaly(), - instrumentDto.getDescription(), - instrumentDto.getImages(), - instrumentDto.getHashtags(), - bassGuitar.getBrand(), - bassGuitar.getPickUp(), - bassGuitar.getPreAmplifier(), - bassGuitar.getColor() - ); + return new BassGuitarDto(bassGuitar); } } diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/EffectorDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/EffectorDto.java index 636aa12..912ef5c 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/EffectorDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/EffectorDto.java @@ -5,6 +5,7 @@ import com.ajou.hertz.common.dto.AddressDto; import com.ajou.hertz.domain.instrument.constant.EffectorFeature; import com.ajou.hertz.domain.instrument.constant.EffectorType; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.entity.Effector; import com.ajou.hertz.domain.user.dto.UserDto; @@ -36,29 +37,20 @@ private EffectorDto( EffectorFeature feature ) { super( - id, seller, title, progressStatus, tradeAddress, qualityStatus, - price, hasAnomaly, description, images, hashtags + id, seller, InstrumentCategory.EFFECTOR, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags ); this.type = type; this.feature = feature; } + private EffectorDto(Effector effector) { + super(effector); + this.type = effector.getType(); + this.feature = effector.getFeature(); + } + public static EffectorDto from(Effector effector) { - InstrumentDto instrumentDto = InstrumentDto.from(effector); - return new EffectorDto( - instrumentDto.getId(), - instrumentDto.getSeller(), - instrumentDto.getTitle(), - instrumentDto.getProgressStatus(), - instrumentDto.getTradeAddress(), - instrumentDto.getQualityStatus(), - instrumentDto.getPrice(), - instrumentDto.getHasAnomaly(), - instrumentDto.getDescription(), - instrumentDto.getImages(), - instrumentDto.getHashtags(), - effector.getType(), - effector.getFeature() - ); + return new EffectorDto(effector); } } diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/ElectricGuitarDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/ElectricGuitarDto.java index 865bdbd..019f1e4 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/ElectricGuitarDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/ElectricGuitarDto.java @@ -6,6 +6,7 @@ import com.ajou.hertz.domain.instrument.constant.ElectricGuitarBrand; import com.ajou.hertz.domain.instrument.constant.ElectricGuitarModel; import com.ajou.hertz.domain.instrument.constant.GuitarColor; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.entity.ElectricGuitar; import com.ajou.hertz.domain.user.dto.UserDto; @@ -33,16 +34,16 @@ private ElectricGuitarDto( Integer price, Boolean hasAnomaly, String description, + List images, + List hashtags, ElectricGuitarBrand brand, ElectricGuitarModel model, Short productionYear, - GuitarColor color, - List images, - List hashtags + GuitarColor color ) { super( - id, seller, title, progressStatus, tradeAddress, qualityStatus, - price, hasAnomaly, description, images, hashtags + id, seller, InstrumentCategory.ELECTRIC_GUITAR, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags ); this.brand = brand; this.model = model; @@ -50,24 +51,15 @@ private ElectricGuitarDto( this.color = color; } + private ElectricGuitarDto(ElectricGuitar electricGuitar) { + super(electricGuitar); + this.brand = electricGuitar.getBrand(); + this.model = electricGuitar.getModel(); + this.productionYear = electricGuitar.getProductionYear(); + this.color = electricGuitar.getColor(); + } + public static ElectricGuitarDto from(ElectricGuitar electricGuitar) { - InstrumentDto instrumentDto = InstrumentDto.from(electricGuitar); - return new ElectricGuitarDto( - instrumentDto.getId(), - instrumentDto.getSeller(), - instrumentDto.getTitle(), - instrumentDto.getProgressStatus(), - instrumentDto.getTradeAddress(), - instrumentDto.getQualityStatus(), - instrumentDto.getPrice(), - instrumentDto.getHasAnomaly(), - instrumentDto.getDescription(), - electricGuitar.getBrand(), - electricGuitar.getModel(), - electricGuitar.getProductionYear(), - electricGuitar.getColor(), - instrumentDto.getImages(), - instrumentDto.getHashtags() - ); + return new ElectricGuitarDto(electricGuitar); } } diff --git a/src/main/java/com/ajou/hertz/domain/instrument/dto/InstrumentDto.java b/src/main/java/com/ajou/hertz/domain/instrument/dto/InstrumentDto.java index 126daa7..1a3e682 100644 --- a/src/main/java/com/ajou/hertz/domain/instrument/dto/InstrumentDto.java +++ b/src/main/java/com/ajou/hertz/domain/instrument/dto/InstrumentDto.java @@ -1,9 +1,17 @@ package com.ajou.hertz.domain.instrument.dto; import java.util.List; +import java.util.Map; import com.ajou.hertz.common.dto.AddressDto; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; +import com.ajou.hertz.domain.instrument.entity.AcousticAndClassicGuitar; +import com.ajou.hertz.domain.instrument.entity.Amplifier; +import com.ajou.hertz.domain.instrument.entity.AudioEquipment; +import com.ajou.hertz.domain.instrument.entity.BassGuitar; +import com.ajou.hertz.domain.instrument.entity.Effector; +import com.ajou.hertz.domain.instrument.entity.ElectricGuitar; import com.ajou.hertz.domain.instrument.entity.Instrument; import com.ajou.hertz.domain.user.dto.UserDto; @@ -17,8 +25,18 @@ @Getter public class InstrumentDto { + private static final Map, InstrumentCategory> instrumentCategoryMap = Map.of( + ElectricGuitar.class, InstrumentCategory.ELECTRIC_GUITAR, + BassGuitar.class, InstrumentCategory.BASS_GUITAR, + AcousticAndClassicGuitar.class, InstrumentCategory.ACOUSTIC_AND_CLASSIC_GUITAR, + Effector.class, InstrumentCategory.EFFECTOR, + Amplifier.class, InstrumentCategory.AMPLIFIER, + AudioEquipment.class, InstrumentCategory.AUDIO_EQUIPMENT + ); + private Long id; private UserDto seller; + private InstrumentCategory category; private String title; private InstrumentProgressStatus progressStatus; private AddressDto tradeAddress; @@ -29,10 +47,28 @@ public class InstrumentDto { private List images; private List hashtags; + protected InstrumentDto(Instrument instrument) { + this( + instrument.getId(), + UserDto.from(instrument.getSeller()), + getInstrumentCategory(instrument.getClass()), + instrument.getTitle(), + instrument.getProgressStatus(), + AddressDto.from(instrument.getTradeAddress()), + instrument.getQualityStatus(), + instrument.getPrice(), + instrument.getHasAnomaly(), + instrument.getDescription(), + instrument.getImages().toDtos(), + instrument.getHashtags().toStrings() + ); + } + public static InstrumentDto from(Instrument instrument) { return new InstrumentDto( instrument.getId(), UserDto.from(instrument.getSeller()), + getInstrumentCategory(instrument.getClass()), instrument.getTitle(), instrument.getProgressStatus(), AddressDto.from(instrument.getTradeAddress()), @@ -44,4 +80,11 @@ public static InstrumentDto from(Instrument instrument) { instrument.getHashtags().toStrings() ); } + + private static InstrumentCategory getInstrumentCategory(Class instrumentClassType) { + if (!instrumentCategoryMap.containsKey(instrumentClassType)) { + throw new IllegalArgumentException("Unsupported instrument class: " + instrumentClassType.getName()); + } + return instrumentCategoryMap.get(instrumentClassType); + } } diff --git a/src/test/java/com/ajou/hertz/unit/domain/instrument/service/InstrumentQueryServiceTest.java b/src/test/java/com/ajou/hertz/unit/domain/instrument/service/InstrumentQueryServiceTest.java index 4f02794..1a3ab3b 100644 --- a/src/test/java/com/ajou/hertz/unit/domain/instrument/service/InstrumentQueryServiceTest.java +++ b/src/test/java/com/ajou/hertz/unit/domain/instrument/service/InstrumentQueryServiceTest.java @@ -35,6 +35,7 @@ import com.ajou.hertz.domain.instrument.constant.ElectricGuitarBrand; import com.ajou.hertz.domain.instrument.constant.ElectricGuitarModel; import com.ajou.hertz.domain.instrument.constant.GuitarColor; +import com.ajou.hertz.domain.instrument.constant.InstrumentCategory; import com.ajou.hertz.domain.instrument.constant.InstrumentProgressStatus; import com.ajou.hertz.domain.instrument.constant.InstrumentSortOption; import com.ajou.hertz.domain.instrument.dto.AcousticAndClassicGuitarDto; @@ -50,7 +51,6 @@ import com.ajou.hertz.domain.instrument.dto.request.BassGuitarFilterConditions; import com.ajou.hertz.domain.instrument.dto.request.EffectorFilterConditions; import com.ajou.hertz.domain.instrument.dto.request.ElectricGuitarFilterConditions; -import com.ajou.hertz.domain.instrument.dto.request.InstrumentFilterConditions; import com.ajou.hertz.domain.instrument.entity.AcousticAndClassicGuitar; import com.ajou.hertz.domain.instrument.entity.Amplifier; import com.ajou.hertz.domain.instrument.entity.AudioEquipment; @@ -83,9 +83,9 @@ class InstrumentQueryServiceTest { InstrumentSortOption sort = InstrumentSortOption.CREATED_BY_DESC; User user = createUser(); Page expectedResult = new PageImpl<>(List.of( - createInstrument(1L, user), - createInstrument(2L, user), - createInstrument(3L, user) + createElectricGuitar(1L, user), + createElectricGuitar(2L, user), + createBassGuitar(3L, user) )); given(instrumentRepository.findAll(any(Pageable.class))).willReturn(expectedResult); @@ -96,6 +96,24 @@ class InstrumentQueryServiceTest { then(instrumentRepository).should().findAll(any(Pageable.class)); verifyEveryMocksShouldHaveNoMoreInteractions(); assertThat(actualResult.getNumberOfElements()).isEqualTo(actualResult.getNumberOfElements()); + assertThat(actualResult.stream() + .filter(instrumentDto -> instrumentDto.getCategory().equals(InstrumentCategory.ELECTRIC_GUITAR)) + .count()).isEqualTo(2); + assertThat(actualResult.stream() + .filter(instrumentDto -> instrumentDto.getCategory().equals(InstrumentCategory.BASS_GUITAR)) + .count()).isEqualTo(1); + assertThat(actualResult.stream() + .filter(instrumentDto -> instrumentDto.getCategory().equals(InstrumentCategory.ACOUSTIC_AND_CLASSIC_GUITAR)) + .count()).isEqualTo(0); + assertThat(actualResult.stream() + .filter(instrumentDto -> instrumentDto.getCategory().equals(InstrumentCategory.EFFECTOR)) + .count()).isEqualTo(0); + assertThat(actualResult.stream() + .filter(instrumentDto -> instrumentDto.getCategory().equals(InstrumentCategory.AMPLIFIER)) + .count()).isEqualTo(0); + assertThat(actualResult.stream() + .filter(instrumentDto -> instrumentDto.getCategory().equals(InstrumentCategory.AUDIO_EQUIPMENT)) + .count()).isEqualTo(0); assertIterableEquals( expectedResult.getContent().stream().map(Instrument::getId).toList(), actualResult.getContent().stream().map(InstrumentDto::getId).toList() @@ -422,10 +440,6 @@ private User createUser() throws Exception { return createUser(1L); } - private InstrumentFilterConditions createEmptyInstrumentFilterConditions() throws Exception { - return ReflectionUtils.createInstrumentFilterConditions(null, null, null); - } - private ElectricGuitarFilterConditions createElectricGuitarFilterConditions() throws Exception { return ReflectionUtils.createElectricGuitarFilterConditions( InstrumentProgressStatus.SELLING, diff --git a/src/test/java/com/ajou/hertz/util/ReflectionUtils.java b/src/test/java/com/ajou/hertz/util/ReflectionUtils.java index b4a9268..0dc8ca6 100644 --- a/src/test/java/com/ajou/hertz/util/ReflectionUtils.java +++ b/src/test/java/com/ajou/hertz/util/ReflectionUtils.java @@ -373,14 +373,15 @@ public static ElectricGuitarDto createElectricGuitarDto( GuitarColor color ) throws Exception { Constructor constructor = ElectricGuitarDto.class.getDeclaredConstructor( - Long.class, UserDto.class, String.class, InstrumentProgressStatus.class, AddressDto.class, Short.class, - Integer.class, Boolean.class, String.class, ElectricGuitarBrand.class, ElectricGuitarModel.class, - Short.class, GuitarColor.class, List.class, List.class + Long.class, UserDto.class, String.class, InstrumentProgressStatus.class, AddressDto.class, + Short.class, Integer.class, Boolean.class, String.class, List.class, List.class, + ElectricGuitarBrand.class, ElectricGuitarModel.class, Short.class, GuitarColor.class ); constructor.setAccessible(true); return constructor.newInstance( - id, seller, title, progressStatus, tradeAddress, qualityStatus, price, hasAnomaly, description, - brand, model, productionYear, color, images, hashtags + id, seller, title, progressStatus, tradeAddress, + qualityStatus, price, hasAnomaly, description, images, hashtags, + brand, model, productionYear, color ); } @@ -459,8 +460,8 @@ public static EffectorDto createEffectorDto( EffectorFeature feature ) throws Exception { Constructor constructor = EffectorDto.class.getDeclaredConstructor( - Long.class, UserDto.class, String.class, InstrumentProgressStatus.class, AddressDto.class, Short.class, - Integer.class, Boolean.class, String.class, List.class, List.class, + Long.class, UserDto.class, String.class, InstrumentProgressStatus.class, AddressDto.class, + Short.class, Integer.class, Boolean.class, String.class, List.class, List.class, EffectorType.class, EffectorFeature.class ); constructor.setAccessible(true);