Skip to content

Commit 88c95fd

Browse files
committed
refactor: 메서드 이름 수정 및 테스트들 오타 수정
1 parent 523054f commit 88c95fd

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

apps/commerce-api/src/main/java/com/loopers/application/like/LikeFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class LikeFacade {
1616
private final LikeService likeService;
1717

1818
public LikeInfo like(long userId, long productId) {
19-
Like like = likeService.Like(userId, productId);
19+
Like like = likeService.like(userId, productId);
2020
long totalLikes = likeService.countLikesByProductId(productId);
2121
return LikeInfo.from(like, totalLikes);
2222
}

apps/commerce-api/src/main/java/com/loopers/domain/like/LikeService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class LikeService {
99

1010
private final LikeRepository likeRepository;
1111

12-
public Like Like(long userId, long productId) {
12+
public Like like(long userId, long productId) {
1313
return likeRepository.findByUserIdAndProductId(userId, productId)
1414
.orElseGet(() -> likeRepository.save(new Like(userId, productId)));
1515
}

apps/commerce-api/src/main/java/com/loopers/interfaces/order/OrderV1Dto.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.loopers.interfaces.order;
22

3+
import jakarta.validation.constraints.NotNull;
4+
import jakarta.validation.constraints.Positive;
35
import java.util.List;
46

57
public class OrderV1Dto {
@@ -8,8 +10,8 @@ public record OrderRequest(List<OrderItemRequest> items) {
810

911
}
1012

11-
public record OrderItemRequest(Long productId,
12-
int quantity
13+
public record OrderItemRequest(@NotNull Long productId,
14+
@Positive int quantity
1315
) {
1416

1517
}

apps/commerce-api/src/test/java/com/loopers/application/like/LikeFacadeIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void like_success_whenFirstLike() {
6767
);
6868
}
6969

70-
@DisplayName("두 번째 사용자가 좋아요 요청 시, 갱신 전 카운트(1)가 반환된다.")
70+
@DisplayName("두 번째 사용자가 좋아요 요청 시, 갱신 전 카운트(2)가 반환된다.")
7171
@Test
7272
void like_success_whenSecondLike() {
7373
// arrange

apps/commerce-api/src/test/java/com/loopers/domain/like/LikeServiceIntegrationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void like_success_whenValidRequest() {
5656
Product product = productRepository.save(new Product(1L, "상품A", "설명", new Money(10000L), 100));
5757

5858
// act
59-
Like like = likeService.Like(user.getId(), product.getId());
59+
Like like = likeService.like(user.getId(), product.getId());
6060

6161
// assert
6262
assertAll(
@@ -74,8 +74,8 @@ void createLike_returnsExisting_whenAlreadyLiked() {
7474
Product product = productRepository.save(new Product(1L, "상품A", "설명", new Money(10000L), 100));
7575

7676
// act
77-
Like firstLike = likeService.Like(user.getId(), product.getId());
78-
Like secondLike = likeService.Like(user.getId(), product.getId());
77+
Like firstLike = likeService.like(user.getId(), product.getId());
78+
Like secondLike = likeService.like(user.getId(), product.getId());
7979

8080
// assert
8181
assertAll(

apps/commerce-api/src/test/java/com/loopers/domain/product/ProductTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void shouldThrowException_whenBrandIdIsNull() {
4242
assertThat(result.getErrorType()).isEqualTo(ErrorType.BAD_REQUEST);
4343
}
4444
@Test
45-
@DisplayName("제품 이름(description)이 없거나(null) 공백이면, Product 객체 생성은 실패한다.")
45+
@DisplayName("제품 이름(name)이 없거나(null) 공백이면, Product 객체 생성은 실패한다.")
4646
void shouldThrowException_whenNameIsBlank() {
4747
// act
4848
CoreException result = assertThrows(CoreException.class, () -> {
@@ -82,7 +82,7 @@ void shouldThrowException_whenPriceIsNegative() {
8282
void shouldThrowException_whenStockIsNegative() {
8383
// act
8484
CoreException result = assertThrows(CoreException.class, () -> {
85-
new Product(1L, "name", "", new Money(1000L), -1);
85+
new Product(1L, "name", "description", new Money(1000L), -1);
8686
});
8787

8888
// assert

0 commit comments

Comments
 (0)