-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
사용자 가입 시 신뢰도를 null로 설정 #536
Changes from 5 commits
668ed15
88de52f
df6b52b
47620bd
1f66ba2
8a84619
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
@EqualsAndHashCode(of = "id") | ||
@EqualsAndHashCode(of = "id", callSuper = false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 칭찬경고 억제 👍 |
||
@ToString(of = {"id", "name", "reliability", "oauthId", "deleted"}) | ||
@Table(name = "users") | ||
public class User extends BaseTimeEntity { | ||
|
@@ -42,7 +42,7 @@ public class User extends BaseTimeEntity { | |
@JoinColumn(name = "profile_image_id", foreignKey = @ForeignKey(name = "fk_user_profile_image"), nullable = false) | ||
private ProfileImage profileImage; | ||
|
||
private double reliability; | ||
private Double reliability; | ||
|
||
private String oauthId; | ||
|
||
|
@@ -53,7 +53,7 @@ public class User extends BaseTimeEntity { | |
private User( | ||
final String name, | ||
final ProfileImage profileImage, | ||
final double reliability, | ||
final Double reliability, | ||
final String oauthId | ||
) { | ||
this.name = name; | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ public record SellerResponse( | |
Long id, | ||
String image, | ||
String nickname, | ||
double reliability | ||
Double reliability | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
package com.ddang.ddang.auction.application; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatCode; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.BDDMockito.given; | ||
|
||
import com.ddang.ddang.auction.application.dto.CreateInfoAuctionDto; | ||
import com.ddang.ddang.auction.application.dto.ReadAuctionDto; | ||
import com.ddang.ddang.auction.application.dto.ReadAuctionsDto; | ||
|
@@ -18,7 +12,6 @@ | |
import com.ddang.ddang.image.domain.StoreImageProcessor; | ||
import com.ddang.ddang.region.application.exception.RegionNotFoundException; | ||
import com.ddang.ddang.user.application.exception.UserNotFoundException; | ||
import java.util.List; | ||
import org.assertj.core.api.SoftAssertions; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
|
@@ -29,6 +22,14 @@ | |
import org.springframework.data.domain.Sort; | ||
import org.springframework.data.domain.Sort.Order; | ||
|
||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatCode; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.BDDMockito.given; | ||
|
||
@IsolateDatabase | ||
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) | ||
@SuppressWarnings("NonAsciiCharacters") | ||
|
@@ -195,6 +196,15 @@ class AuctionServiceTest extends AuctionServiceFixture { | |
.hasMessage("지정한 아이디에 대한 경매를 찾을 수 없습니다."); | ||
} | ||
|
||
@Test | ||
void 지정한_아이디에_해당하는_경매의_판매자_신뢰도가_null이라면_서비스에서_반환하는_dto에서_판매자_신뢰도를_나타내는_부분도_null이다() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 선택굉장히 자세한 메서드 네이밍이네요..! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시나 NPE가 발생하는지 궁금해서 개인적인 테스트를 해보았는데, 원래는 결과만 보고 롤백하려고 했는데 나중에 또 궁금할까 봐 있으면 좋을 것 같아서 커밋하였습니다. 처음 의도는 원래 커밋은 할 생각을 안 했고 그냥 개인적으로 확인차 테스트했던 거라 픽스처 클래스 만들고 하기 귀찮아서 있던 테스트에서 같이 했는데 커밋할 때는 또 생각 없이 해버렸네요ㅠ |
||
// when | ||
final ReadAuctionDto actual = auctionService.readByAuctionId(신뢰도가_null인_판매자의_경매.getId()); | ||
|
||
// then | ||
assertThat(actual.sellerReliability()).isNull(); | ||
} | ||
|
||
@Test | ||
void 첫번째_페이지의_경매_목록을_조회한다() { | ||
// when | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문
값 객체로 변경하게 된다면 null을 직접적으로 넣지 않고, 미리 null로 설정해 둔 값객체에 대한 static 필드를 사용하게 될까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 값객체 적용한 pr에서 User 생성 시 reliability가 null이면 static 필드를 사용하도록 구현되어 있습니다!