-
Notifications
You must be signed in to change notification settings - Fork 3
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
[HIMIN-209] test: 배달 서비스 테스트 추가 #115
Conversation
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.
코드 하나씩 읽어 봤는데 딱히 잘 못된점이 안 보이네요!
클래스별로 개행 부탁 드립니다!
assertThat(result).isTrue(); | ||
} | ||
} | ||
} |
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.
클래스 마다 맨 끝줄에 엔터 있는지 확인하면 좋을 것 같아요!
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.
기본적인 실수를 했네요ㅜㅜ 개행 추가했습니다!
public record HistoryInfo( | ||
DeliveryStatus deliveryStatus, | ||
LocalDateTime createdAt | ||
) { |
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.
p5
해당 클래스는 제가 HistoryResponse 레코드 내에서 쓸 이너클래스 용도로, private으로 닫아주었었는데요 !
혹시 public으로 열어두신 이유가 있을까요 ??
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.
배달 테스트를 작성할 때, 모든 성공 메소드에서 응답에 있는 DeliveryStatus
를 검증할 필요성을 느꼈습니다! (제대로 응답이 내려가는지 확인하기 위함)
하지만 DeliveryStatus
를 필드로 가지고 있는 HistoryInfo
는 private으로 되어있어서 DeliveryStatus
에 접근하지 못하였는데요. 저는 아래 두 가지 선택지 중 배달 상태에 대한 검증이 필수하고 생각하여 1번을 선택하였고 그에 맞춰 Public으로 변경하였습니다!
1. `HistoryInfo`를 public으로 열고 `DeliveryStatus`를 검증하기
2. `DeliveryStatus`를 검증하지 않기
혹시 HistoryInfo
를 public으로 열지 않고, 배달 상태를 검증할 수 있는 방법으로 1번밖에 생각하지 못하였는데, 다른 방법 있다면 알려주시면 감사하겠습니다!
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.
단순히 DeliveryStatus를 빼내오고 싶다면,
public DeliveryStatus deliveryStatus() {
return this.historyInfo.deliveryStatus();
}
위와 같은 코드를 HistoryResponse클래스에 넣어줄 수 있겠네요 !
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.
헉 범모님 최고... 반환 메서드를 만들어주면 되는군요 ,,,?
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.
Delivery delivery, | ||
DeliveryHistory deliveryHistory | ||
) { | ||
public static DeliveryResponse of(DeliveryHistory deliveryHistory) { |
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.
p1
매개변수가 하나로 줄어듦에 따라 from
으로 메서드명 수정이 필요할 것 같습니다 !
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.
헉 인지 못하고 있었네요! 바로 수정하겠습니다. 감사합니다😊
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.
@BeforeEach | ||
void setDeliveryHistory() { | ||
deliveryService.allocateRider(delivery.getDeliveryId(), rider.getRiderId()); | ||
deliveryService.startDelivery(delivery.getDeliveryId(), rider.getRiderId()); | ||
} |
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 확인 항목
PR 보내기전에 아래 항목들을 만족 하였는지 체크 해주세요
PR 종류
어떤 종류의 PR인지 아래 항목중에 체크 해주세요
어떤 기능이 추가 되었나요?
Issue Number: HIMIN-209
기존에 있던 기능에 영향을 주나요?
기타