작성
·
27
0
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.
1. 강의 내용과 관련된 질문을 남겨주세요.
2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.
(자주 하는 질문 링크: https://bit.ly/3fX6ygx)
3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.
(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)
질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.
=========================================
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예/아니오)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)
[질문 내용]
여기에 질문 내용을 남겨주세요.
강의에서 나오는데로 orderCount를 11로 하면 need more stock
jpabook.jpashop.exception.NotEnoughStockException: need more stock
at jpabook.jpashop.domain.item.Item.removeStock(Item.java:43)
at jpabook.jpashop.domain.OrderItem.createOrderItem(OrderItem.java:44)
at jpabook.jpashop.service.OrderService.order(OrderService.java:38)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:380)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:727)
at jpabook.jpashop.service.OrderService$$SpringCGLIB$$0.order(<generated>)
at jpabook.jpashop.service.OrderServiceTest.상품주문_재고수량초과(OrderServiceTest.java:56)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:76)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2024-12-22T17:33:07.127+09:00 INFO 5250 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2024-12-22T17:33:07.128+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists category cascade
2024-12-22T17:33:07.129+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387129 | took 1ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists category cascade
drop table if exists category cascade ;
2024-12-22T17:33:07.129+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists category_item cascade
2024-12-22T17:33:07.130+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387130 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists category_item cascade
drop table if exists category_item cascade ;
2024-12-22T17:33:07.130+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists delivery cascade
2024-12-22T17:33:07.130+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387130 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists delivery cascade
drop table if exists delivery cascade ;
2024-12-22T17:33:07.130+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists item cascade
2024-12-22T17:33:07.131+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387131 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists item cascade
drop table if exists item cascade ;
2024-12-22T17:33:07.131+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists member cascade
2024-12-22T17:33:07.131+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387131 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists member cascade
drop table if exists member cascade ;
2024-12-22T17:33:07.131+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists order_item cascade
2024-12-22T17:33:07.131+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387131 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists order_item cascade
drop table if exists order_item cascade ;
2024-12-22T17:33:07.131+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop table if exists orders cascade
2024-12-22T17:33:07.132+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387132 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop table if exists orders cascade
drop table if exists orders cascade ;
2024-12-22T17:33:07.132+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop sequence if exists category_seq
2024-12-22T17:33:07.132+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387132 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop sequence if exists category_seq
drop sequence if exists category_seq;
2024-12-22T17:33:07.132+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop sequence if exists delivery_seq
2024-12-22T17:33:07.132+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387132 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop sequence if exists delivery_seq
drop sequence if exists delivery_seq;
2024-12-22T17:33:07.132+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop sequence if exists item_seq
2024-12-22T17:33:07.133+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387133 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop sequence if exists item_seq
drop sequence if exists item_seq;
2024-12-22T17:33:07.133+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop sequence if exists member_seq
2024-12-22T17:33:07.133+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387133 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop sequence if exists member_seq
drop sequence if exists member_seq;
2024-12-22T17:33:07.133+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop sequence if exists order_item_seq
2024-12-22T17:33:07.133+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387133 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop sequence if exists order_item_seq
drop sequence if exists order_item_seq;
2024-12-22T17:33:07.133+09:00 DEBUG 5250 --- [ionShutdownHook] org.hibernate.SQL : drop sequence if exists orders_seq
2024-12-22T17:33:07.133+09:00 INFO 5250 --- [ionShutdownHook] p6spy : #1734856387133 | took 0ms | statement | connection 14| url jdbc:h2:mem:3e9d99ac-3e6a-493e-ba08-cc03d272eaed
drop sequence if exists orders_seq
drop sequence if exists orders_seq;
2024-12-22T17:33:07.135+09:00 INFO 5250 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2024-12-22T17:33:07.137+09:00 INFO 5250 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
> Task :test FAILED
OrderServiceTest > 상품주문_재고수량초과 FAILED
jpabook.jpashop.exception.NotEnoughStockException at OrderServiceTest.java:56
1 test completed, 1 failed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///Users/iyeonseo/Downloads/jpashop/build/reports/tests/test/index.html
* Try:
> Run with --scan to get full insights.
BUILD FAILED in 4s
5 actionable tasks: 2 executed, 3 up-to-date
이런 에러가 뜹니다. 강의에서는 성공이 뜨는데 왜 이렇게 뜨는건가요
답변 1