#33 tdd(order-service): update product - springboot test
This commit is contained in:
@@ -32,4 +32,20 @@ class ProductServiceTest {
|
||||
assertThat(response).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void 상품수정() {
|
||||
// 상품등록
|
||||
productService.addProduct(ProductSteps.상품등록요청_생성());
|
||||
|
||||
final Long productId = 1L;
|
||||
final UpdateProductRequest request = ProductSteps.상품수정요청();
|
||||
|
||||
productService.updateProduct(productId, request);
|
||||
|
||||
GetProductResponse response = productService.getProduct(productId);
|
||||
|
||||
assertThat(response.name()).isEqualTo("상품수정");
|
||||
assertThat(response.price()).isEqualTo(2000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ public class ProductSteps {
|
||||
final int price = 1000;
|
||||
final DiscountPolicy discountPolicy = DiscountPolicy.NONE;
|
||||
|
||||
final AddProductRequest request = new AddProductRequest(name, price, discountPolicy);
|
||||
return request;
|
||||
return new AddProductRequest(name, price, discountPolicy);
|
||||
}
|
||||
|
||||
public static ExtractableResponse<Response> 상품조회요청(Long productId) {
|
||||
@@ -33,4 +32,8 @@ public class ProductSteps {
|
||||
.then().log().all()
|
||||
.extract();
|
||||
}
|
||||
|
||||
public static UpdateProductRequest 상품수정요청() {
|
||||
return new UpdateProductRequest("상품수정", 2000, DiscountPolicy.NONE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user