인프런 커뮤니티 질문&답변

김민국님의 프로필 이미지

작성한 질문수

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

주문 기능 테스트

상품주문 테스트 코드 질문드립니다.

작성

·

460

0

선생님 항상 좋은 강의 많은 도움이 되고있습니다.

감사합니다!!

우선 제 전체 코드는 다음주소에 (깃허브)에 올렸습니다.

https://github.com/minkook92/jpahsop/tree/master/src

제 나름대로 상품주문 test-code를 작성하였으나, 오류가 납니다.

혹시 어디서 잘못 되었는지 봐 주시면 감사하겠습니다!

package jpabook.jpashop.service;

import jpabook.jpashop.domain.*;

import jpabook.jpashop.domain.item.Book;

import jpabook.jpashop.domain.item.Item;

import jpabook.jpashop.repository.OrderRepository;

import org.assertj.core.api.Assertions;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.boot.test.context.SpringBootTest;

import org.springframework.test.context.junit4.SpringRunner;

import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;

import static org.junit.Assert.*;

@RunWith(SpringRunner.class)

@SpringBootTest

@Transactional

public class OrderServiceTest {

    @Autowired  MemberService memberService;

    @Autowired  ItemService itemService;

    @Autowired  OrderService orderService;

    @Test

    public void 상품주문() throws Exception {

        //given

        //멤버저장

        Member member = new Member();

        member.setName("kim");

        member.setAddress(new Address("city", "street", "zipcode"));

        memberService.join(member);

        //책 저장

        Book book = new Book();

        book.setIsbn("12345");

        book.setAuthor("kim");

        book.setStockQuantity(100);

        book.setPrice(10000);

        book.setName("바람과함께 사라지다.");

        itemService.saveItem(book);

        //when

        //멤버 찾기

        Member findMember = memberService.findOne(member.getId());

        //아이템 찾기

        Item findItem = itemService.findOne(book.getId());

        //배달 정보 저장

        Delivery delivery = new Delivery();

        delivery.setStatus(DeliveryStatus.READY);

        delivery.setAddress(member.getAddress());

        //주문 아이템 저장

        OrderItem orderItem = OrderItem.createOrderItem(findItem, findItem.getPrice(), 10);

        //주문 생성

        Order order = Order.createOrder(findMember, delivery, orderItem);

        //주문 찾기

        Long orderId = orderService.order(order.getMember().getId(), order.getOrderItems().get(0).getId(), order.getOrderItems().get(0).getCount());

        Order findOrder = orderService.findOne(orderId);

        //then

        //재고 수량 검증 , 100개의 stockQuantity에서 주문을 10개를 하였고, 이를 주문에 반영하였으니, 주문을 한다면 stockQuantity는 90개가 되어야 함.

        Assertions.assertThat(findOrder.getOrderItems().get(0).getCount()).isEqualTo(90);

    }

    @Test

    public void 주문취소() throws Exception {

        //given

        //when

        //then

    }

    @Test

    public void 상품주문_재고수량초과() throws Exception{

        //given

       //when

       //then

       }

}

오류 내용

2021-06-07 05:47:02.587  INFO 9712 --- [           main] o.s.t.c.transaction.TransactionContext   : Began transaction (1) for test context [DefaultTestContext@3f67593e testClass = OrderServiceTest, testInstance = jpabook.jpashop.service.OrderServiceTest@17541204, testMethod = 상품주문@OrderServiceTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@1ab06251 testClass = OrderServiceTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@394df057, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@6ab778a, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@58ea606c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@63070bab, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@3098cf3b, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@1189dd52], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@34001c5d]; rollback [true]

2021-06-07 05:47:03.188 DEBUG 9712 --- [           main] org.hibernate.SQL                        : select member0_.member_id as member_i1_2_, member0_.city as city2_2_, member0_.street as street3_2_, member0_.zipcode as zipcode4_2_, member0_.name as name5_2_ from member member0_ where member0_.name=?

2021-06-07 05:47:03.203  INFO 9712 --- [           main] p6spy                                    : #1623012423203 | took 4ms | statement | connection 4| url jdbc:h2:mem:787fed49-3533-4ca4-b5e2-6e76bef929f6

select member0_.member_id as member_i1_2_, member0_.city as city2_2_, member0_.street as street3_2_, member0_.zipcode as zipcode4_2_, member0_.name as name5_2_ from member member0_ where member0_.name=?

select member0_.member_id as member_i1_2_, member0_.city as city2_2_, member0_.street as street3_2_, member0_.zipcode as zipcode4_2_, member0_.name as name5_2_ from member member0_ where member0_.name='kim';

2021-06-07 05:47:03.219 DEBUG 9712 --- [           main] org.hibernate.SQL                        : call next value for hibernate_sequence

2021-06-07 05:47:03.220  INFO 9712 --- [           main] p6spy                                    : #1623012423220 | took 0ms | statement | connection 4| url jdbc:h2:mem:787fed49-3533-4ca4-b5e2-6e76bef929f6

call next value for hibernate_sequence

call next value for hibernate_sequence;

2021-06-07 05:47:03.281 DEBUG 9712 --- [           main] org.hibernate.SQL                        : call next value for hibernate_sequence

2021-06-07 05:47:03.282  INFO 9712 --- [           main] p6spy                                    : #1623012423282 | took 0ms | statement | connection 4| url jdbc:h2:mem:787fed49-3533-4ca4-b5e2-6e76bef929f6

call next value for hibernate_sequence

call next value for hibernate_sequence;

2021-06-07 05:47:03.365  INFO 9712 --- [           main] p6spy                                    : #1623012423365 | took 0ms | rollback | connection 4| url jdbc:h2:mem:787fed49-3533-4ca4-b5e2-6e76bef929f6

;

2021-06-07 05:47:03.377  INFO 9712 --- [           main] o.s.t.c.transaction.TransactionContext   : Rolled back transaction for test: [DefaultTestContext@3f67593e testClass = OrderServiceTest, testInstance = jpabook.jpashop.service.OrderServiceTest@17541204, testMethod = 상품주문@OrderServiceTest, testException = org.springframework.dao.InvalidDataAccessApiUsageException: id to load is required for loading; nested exception is java.lang.IllegalArgumentException: id to load is required for loading, mergedContextConfiguration = [WebMergedContextConfiguration@1ab06251 testClass = OrderServiceTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@394df057, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@6ab778a, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@58ea606c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@63070bab, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@3098cf3b, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@1189dd52], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]

org.springframework.dao.InvalidDataAccessApiUsageException: id to load is required for loading; nested exception is java.lang.IllegalArgumentException: id to load is required for loading

at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:374)

at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:235)

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)

at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)

at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)

at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)

at jpabook.jpashop.repository.ItemRepository$$EnhancerBySpringCGLIB$$18b1a0a2.findOne(<generated>)

at jpabook.jpashop.service.OrderService.order(OrderService.java:32)

at jpabook.jpashop.service.OrderService$$FastClassBySpringCGLIB$$ad373727.invoke(<generated>)

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)

at jpabook.jpashop.service.OrderService$$EnhancerBySpringCGLIB$$da7a4323.order(<generated>)

at jpabook.jpashop.service.OrderServiceTest.상품주문(OrderServiceTest.java:64)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)

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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

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.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)

at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)

at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)

at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

Caused by: java.lang.IllegalArgumentException: id to load is required for loading

at org.hibernate.event.spi.LoadEvent.<init>(LoadEvent.java:96)

at org.hibernate.event.spi.LoadEvent.<init>(LoadEvent.java:64)

at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.doLoad(SessionImpl.java:2783)

at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.lambda$load$1(SessionImpl.java:2767)

at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.perform(SessionImpl.java:2723)

at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2767)

at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3322)

at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3284)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:311)

at com.sun.proxy.$Proxy96.find(Unknown Source)

at jpabook.jpashop.repository.ItemRepository.findOne(ItemRepository.java:26)

at jpabook.jpashop.repository.ItemRepository$$FastClassBySpringCGLIB$$dc3fed7a.invoke(<generated>)

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)

... 48 more

답변 1

1

orderItem 이 아직 저장되지 않은 상태에서 ID를 참조하기에 발생하는 오류입니다.

같은 증상에 대한 질문과 답변은 아래 링크를 참조하시기 바랍니다.

테스트 exception 관련 질문 입니다. - 인프런 | 질문 & 답변 (inflearn.com)

 OrderItem orderItem = OrderItem.createOrderItem(findItem, findItem.getPrice(), 10);
// 이 코드가 실행되고 난 후 orderItem은 아직 영속성 관리상태가 아닙니다. 즉 ID가 할당되지 않았습니다.

Long orderId = orderService.order(order.getMember().getId(), order.getOrderItems().get(0).getId(), order.getOrderItems().get(0).getCount());
// 그러나 이 코드에서 
// order.getOrderItems().get(0).getId()
// 생성되지 않은 아이디를 요청하고 있습니다.
// 이 부분에서 오류가 발생하고 있습니다.
김민국님의 프로필 이미지
김민국
질문자

오... 언제쯤 저도 이런 실력을 가질수 있을지.. 부럽고도 감사합니다!

다만, 답변 확인 후에 orderItem에 대해서 영속성 관리를 위해 em.persist(orderItem)을 했고, orderItem에 id가 생성되었을거라는 기대를 가지고 잘 실행될 것이라고 생각했는데,

 nullPointerException이 나옵니다ㅠ.ㅜ 

첫번째는 TestCode를, 두번째는 오류내용을, 세번째는 OrderItem.java 파일입니다.

@Test
public void 상품주문1() throws Exception{
//given

//멤버저장

Member member = new Member();

member.setName("kim");

member.setAddress(new Address("city", "street", "zipcode"));

memberService.join(member);

//책 저장

Book book = new Book();

book.setIsbn("12345");

book.setAuthor("kim");

book.setStockQuantity(100);

book.setPrice(10000);

book.setName("바람과함께 사라지다.");

itemService.saveItem(book);

//when

//멤버 찾기

Member findMember = memberService.findOne(member.getId());

//아이템 찾기

Item findItem = itemService.findOne(book.getId());

//배달 정보 저장

Delivery delivery = new Delivery();

delivery.setStatus(DeliveryStatus.READY);

delivery.setAddress(member.getAddress());

//주문 아이템 저장

OrderItem orderItem = OrderItem.createOrderItem(findItem, findItem.getPrice(), 10);
//orderItem을 영속성 관리상태로 만들어줌
em.persist(orderItem);

//주문 생성

Order order = Order.createOrder(findMember, delivery, orderItem);
//주문 찾기

Long orderId = orderService.order(order.getMember().getId(), order.getOrderItems().get(0).getId(), order.getOrderItems().get(0).getCount());

Order findOrder = orderService.findOne(orderId);

//then

//재고 수량 검증 , 100개의 stockQuantity에서 주문을 10개를 하였고, 이를 주문에 반영하였으니, 주문을 한다면 stockQuantity 90개가 되어야 함.

Assertions.assertThat(findOrder.getOrderItems().get(0).getCount()).isEqualTo(90);

}

오류입니다.

"C:\Program Files\Java\jdk-11.0.9\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3\lib\idea_rt.jar=58293:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2020.3\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.3\plugins\junit\lib\junit5-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.3\plugins\junit\lib\junit-rt.jar;C:\Users\김민국\study\jpashop\jpashop\out\test\classes;C:\Users\김민국\study\jpashop\jpashop\out\test\resources;C:\Users\김민국\study\jpashop\jpashop\out\production\classes;C:\Users\김민국\study\jpashop\jpashop\out\production\resources;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\2.5.0\84f42b4c2b85d59070d1b67c7e5b35a1f62c3e82\spring-boot-starter-data-jpa-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-thymeleaf\2.5.0\ccadc87ba8e5e522104799ec02fda0958b644b4d\spring-boot-starter-thymeleaf-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.5.0\3103486844ed786b6ba420971ad137658a2da803\spring-boot-starter-web-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\com.github.gavlyukovskiy\p6spy-spring-boot-starter\1.6.2\f4ded0820bc8abbac3b3a19cc3c3bc715d23cc24\p6spy-spring-boot-starter-1.6.2.jar;D:\intelliJ\caches\modules-2\files-2.1\junit\junit\4.12\2973d150c0dc1fefe998f834810d68f278ea58ec\junit-4.12.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-test\2.5.0\e87ef5d8917500b489ebd1d76f01f9f859dd143e\spring-boot-starter-test-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\2.5.0\7296891fa9032f7ac267da19732c043966216636\spring-boot-starter-aop-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\2.5.0\850bf7c3dacf3d610bb9e7dca3685621539c7099\spring-boot-starter-jdbc-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\1.3.3\c4179d48720a1e87202115fbed6089bdc4195405\jakarta.transaction-api-1.3.3.jar;D:\intelliJ\caches\modules-2\files-2.1\jakarta.persistence\jakarta.persistence-api\2.2.3\8f6ea5daedc614f07a3654a455660145286f024e\jakarta.persistence-api-2.2.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.4.31.Final\b0cd5c1d0dbaed84573203fd348a7e64f94d33cb\hibernate-core-5.4.31.Final.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\2.5.1\881f7ae140f424b3bdb1b0c27a61b93e0bee9fa5\spring-data-jpa-2.5.1.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-aspects\5.3.7\632156b7ae401aba21246a88604f9fbb42f18881\spring-aspects-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.5.0\a910887c01efcc7d12f3f89a7604d436f26eeb90\spring-boot-starter-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf-spring5\3.0.12.RELEASE\aa640b214411978a23cbe271c3fb9569d1bda608\thymeleaf-spring5-3.0.12.RELEASE.jar;D:\intelliJ\caches\modules-2\files-2.1\org.thymeleaf.extras\thymeleaf-extras-java8time\3.0.4.RELEASE\36e7175ddce36c486fff4578b5af7bb32f54f5df\thymeleaf-extras-java8time-3.0.4.RELEASE.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.5.0\3823529849c1b848e9623bbccc7c2dc7c3d51f93\spring-boot-starter-json-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.5.0\3b93aeb708d3319522fb21409ec314ad4d2ef9b3\spring-boot-starter-tomcat-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.3.7\8437c7a572177a34607abdaef2f6b8088488f5c0\spring-webmvc-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-web\5.3.7\49e6a8f45e77f14ef16f82c0413254ef493b785f\spring-web-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\com.github.gavlyukovskiy\datasource-decorator-spring-boot-autoconfigure\1.6.2\445139fd7cb853bb8270a1877c0373df8c7bd2a\datasource-decorator-spring-boot-autoconfigure-1.6.2.jar;D:\intelliJ\caches\modules-2\files-2.1\p6spy\p6spy\3.9.0\7fedf78cc1e53a623a7b36d1f2705790836400aa\p6spy-3.9.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\2.2\3f2bd07716a31c395e2837254f37f21f0f0ab24b\hamcrest-core-2.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test-autoconfigure\2.5.0\70ea0e9925c3b300fb4509c425d53d477a033e57\spring-boot-test-autoconfigure-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-test\2.5.0\53ecfc751fd08d6dab2301c06e8e3de74d85185a\spring-boot-test-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\com.jayway.jsonpath\json-path\2.5.0\c35ef29095125b51638d19120f63e2b56eff20e9\json-path-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\jakarta.xml.bind\jakarta.xml.bind-api\2.3.3\48e3b9cfc10752fba3521d6511f4165bea951801\jakarta.xml.bind-api-2.3.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.assertj\assertj-core\3.19.0\f64cb5690b85e68d5e1e6c6152bfb6e3840a452d\assertj-core-3.19.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.hamcrest\hamcrest\2.2\1820c0968dba3a11a1b30669bb1f01978a91dedc\hamcrest-2.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter\5.7.2\62faa742964a9d8dab8fdb4a0eab7b01441c171f\junit-jupiter-5.7.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.mockito\mockito-junit-jupiter\3.9.0\871745ab6af5a269411ea3c1f99ced82ed079436\mockito-junit-jupiter-3.9.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.mockito\mockito-core\3.9.0\b7573430aea743b26434b44f4f46272af613e660\mockito-core-3.9.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.skyscreamer\jsonassert\1.5.0\6c9d5fe2f59da598d9aefc1cfc6528ff3cf32df3\jsonassert-1.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-test\5.3.7\e23e2a03e95237c48b0db4f399099cc9eac1480c\spring-test-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-core\5.3.7\4aad1b62bd347a806fe693c9d67b376a3ad8151c\spring-core-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.xmlunit\xmlunit-core\2.8.2\8e4e46b87afaaf9b6cfb8de778e473cf7aeb087f\xmlunit-core-2.8.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-aop\5.3.7\b86edd2455f8c4399068c999beb9ea2a9e7f2047\spring-aop-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.6\ee3b73aa16df35179255f17354d9dfd8e7822835\aspectjweaver-1.9.6.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-jdbc\5.3.7\5caf72035a9b8a3a09ef82322cd2497aedddc487\spring-jdbc-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\com.zaxxer\HikariCP\4.0.3\107cbdf0db6780a065f895ae9d8fbf3bb0e1c21f\HikariCP-4.0.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\2.3.4\5f3828d3a345ff3d8acb83f07ba04eccf59e15bb\jaxb-runtime-2.3.4.jar;D:\intelliJ\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.1.2.Final\e59ffdbc6ad09eeb33507b39ffcf287679a498c8\hibernate-commons-annotations-5.1.2.Final.jar;D:\intelliJ\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.4.1.Final\40fd4d696c55793e996d1ff3c475833f836c2498\jboss-logging-3.4.1.Final.jar;D:\intelliJ\caches\modules-2\files-2.1\org.javassist\javassist\3.27.0-GA\f63e6aa899e15eca8fdaa402a79af4c417252213\javassist-3.27.0-GA.jar;D:\intelliJ\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.10.22\ef45d7e2cd1c600d279704f492ed5ce2ceb6cdb5\byte-buddy-1.10.22.jar;D:\intelliJ\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.jboss\jandex\2.2.3.Final\d3865101f0666b63586683bd811d754517f331ab\jandex-2.2.3.Final.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;D:\intelliJ\caches\modules-2\files-2.1\org.dom4j\dom4j\2.1.3\a75914155a9f5808963170ec20653668a2ffd2fd\dom4j-2.1.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-context\5.3.7\330b3957efdcdebe3550b8e2c5d45a4c25496626\spring-context-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-orm\5.3.7\f1892fe7a6671348d6546facbd40159b7e6f64a2\spring-orm-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.5.1\c950ca1a05e928e9fb75420b4ac07713428e9969\spring-data-commons-2.5.1.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-tx\5.3.7\98be572c2bf3bd08724363b0bba71bcef59c4739\spring-tx-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-beans\5.3.7\8b1eacd7aaa12f7d173a2f0836d28bd0c1b098fe\spring-beans-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.30\b5a4b6d16ab13e34a88fae84c35cd5d68cac922c\slf4j-api-1.7.30.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.5.0\64c7bbc941c70895621ed613f38dc66b73ea9341\spring-boot-autoconfigure-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.5.0\b07513e04ad906ea69ef84293a123cdb83828f06\spring-boot-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.5.0\22401482ba1c5a1dcd3d33e47295779211b913d8\spring-boot-starter-logging-2.5.0.jar;D:\intelliJ\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;D:\intelliJ\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.28\7cae037c3014350c923776548e71c9feb7a69259\snakeyaml-1.28.jar;D:\intelliJ\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf\3.0.12.RELEASE\de1865b0d58590a50c33900115a293335dd8ef25\thymeleaf-3.0.12.RELEASE.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.12.3\77424ea087313312e308dae5ff8445608aabb5e1\jackson-datatype-jdk8-2.12.3.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.12.3\f69c636438dcf19c49960c1fe8901320ab85f989\jackson-datatype-jsr310-2.12.3.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.12.3\592a882beaf1bd57b8fe960b937a2706b090b4d7\jackson-module-parameter-names-2.12.3.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.12.3\d6153f8fc60c479ab0f9efb35c034526436a4953\jackson-databind-2.12.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.46\e85e7c3df9353cf7f6b9e766ac61c0c313f9a57f\tomcat-embed-websocket-9.0.46.jar;D:\intelliJ\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.46\aa1d93f2e508b6a1001bba9ad2a570a574f6ed64\tomcat-embed-core-9.0.46.jar;D:\intelliJ\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\9.0.46\69a1e4fb339b8f4020481d68067114976e3a8515\tomcat-embed-el-9.0.46.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-expression\5.3.7\13351fce0a604957cd6a41478ebb54a953a0245e\spring-expression-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\net.minidev\json-smart\2.4.7\8d7f4c1530c07c54930935f3da85f48b83b3c109\json-smart-2.4.7.jar;D:\intelliJ\caches\modules-2\files-2.1\jakarta.activation\jakarta.activation-api\1.2.2\99f53adba383cb1bf7c3862844488574b559621f\jakarta.activation-api-1.2.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-params\5.7.2\685f832f8c54dd40100f646d61aca88ed9545421\junit-jupiter-params-5.7.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-api\5.7.2\f4b4079732a9c537983324cfa4e46655f21d2c56\junit-jupiter-api-5.7.2.jar;D:\intelliJ\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.10.22\b01df6b71a882b9fde5a608a26e641cd399a4d83\byte-buddy-agent-1.10.22.jar;D:\intelliJ\caches\modules-2\files-2.1\org.objenesis\objenesis\3.2\7fadf57620c8b8abdf7519533e5527367cb51f09\objenesis-3.2.jar;D:\intelliJ\caches\modules-2\files-2.1\com.vaadin.external.google\android-json\0.0.20131108.vaadin1\fa26d351fe62a6a17f5cda1287c1c6110dec413f\android-json-0.0.20131108.vaadin1.jar;D:\intelliJ\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.3.7\ccd8bde38bad689737295fa220e1c70680676d72\spring-jcl-5.3.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\2.3.4\257fa649d3137a1060d222aefb96b7d1dd5f1286\txw2-2.3.4.jar;D:\intelliJ\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\3.0.12\cbbe1a62b0cc6c85972e99d52aaee350153dc530\istack-commons-runtime-3.0.12.jar;D:\intelliJ\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.14.1\ce8a86a3f50a4304749828ce68e7478cafbc8039\log4j-to-slf4j-2.14.1.jar;D:\intelliJ\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.30\d58bebff8cbf70ff52b59208586095f467656c30\jul-to-slf4j-1.7.30.jar;D:\intelliJ\caches\modules-2\files-2.1\org.attoparser\attoparser\2.0.5.RELEASE\a93ad36df9560de3a5312c1d14f69d938099fa64\attoparser-2.0.5.RELEASE.jar;D:\intelliJ\caches\modules-2\files-2.1\org.unbescape\unbescape\1.1.6.RELEASE\7b90360afb2b860e09e8347112800d12c12b2a13\unbescape-1.1.6.RELEASE.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.12.3\deb23fe2a7f2b773e18ced2b50d4acc1df8fa366\jackson-core-2.12.3.jar;D:\intelliJ\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.12.3\7275513412694a1aafd08c0287f48469fa0e6e17\jackson-annotations-2.12.3.jar;D:\intelliJ\caches\modules-2\files-2.1\net.minidev\accessors-smart\2.4.7\3970cfc505e6657ca60f3aa57c849f6043000d7a\accessors-smart-2.4.7.jar;D:\intelliJ\caches\modules-2\files-2.1\org.apiguardian\apiguardian-api\1.1.0\fc9dff4bb36d627bdc553de77e1f17efd790876c\apiguardian-api-1.1.0.jar;D:\intelliJ\caches\modules-2\files-2.1\org.junit.platform\junit-platform-commons\1.7.2\34adfea6c13fc4a996cf38cdad80800ce850d198\junit-platform-commons-1.7.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.opentest4j\opentest4j\1.2.0\28c11eb91f9b6d8e200631d46e20a7f407f2a046\opentest4j-1.2.0.jar;D:\intelliJ\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;D:\intelliJ\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.14.1\cd8858fbbde69f46bce8db1152c18a43328aae78\log4j-api-2.14.1.jar;D:\intelliJ\caches\modules-2\files-2.1\org.ow2.asm\asm\9.1\a99500cf6eea30535eeac6be73899d048f8d12a8\asm-9.1.jar;D:\intelliJ\caches\modules-2\files-2.1\com.h2database\h2\1.4.200\f7533fe7cb8e99c87a43d325a77b4b678ad9031a\h2-1.4.200.jar;D:\intelliJ\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-engine\5.7.2\9415680a889f00b8205a094c5c487bc69dc7077d\junit-jupiter-engine-5.7.2.jar;D:\intelliJ\caches\modules-2\files-2.1\com.sun.activation\jakarta.activation\1.2.2\74548703f9851017ce2f556066659438019e7eb5\jakarta.activation-1.2.2.jar;D:\intelliJ\caches\modules-2\files-2.1\org.junit.platform\junit-platform-engine\1.7.2\2573770b46b8a199ed5f6b0f96fb99e468bfe891\junit-platform-engine-1.7.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 jpabook.jpashop.service.OrderServiceTest,상품주문1

04:14:24.542 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class jpabook.jpashop.service.OrderServiceTest]

04:14:24.557 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]

04:14:24.590 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]

04:14:24.750 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [jpabook.jpashop.service.OrderServiceTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]

04:14:24.793 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [jpabook.jpashop.service.OrderServiceTest], using SpringBootContextLoader

04:14:24.805 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [jpabook.jpashop.service.OrderServiceTest]: class path resource [jpabook/jpashop/service/OrderServiceTest-context.xml] does not exist

04:14:24.806 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [jpabook.jpashop.service.OrderServiceTest]: class path resource [jpabook/jpashop/service/OrderServiceTestContext.groovy] does not exist

04:14:24.807 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [jpabook.jpashop.service.OrderServiceTest]: no resource found for suffixes {-context.xml, Context.groovy}.

04:14:24.808 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [jpabook.jpashop.service.OrderServiceTest]: OrderServiceTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.

04:14:24.984 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.205 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\Users\김민국\study\jpashop\jpashop\out\production\classes\jpabook\jpashop\JpashopApplication.class]

04:14:25.210 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration jpabook.jpashop.JpashopApplication for test class jpabook.jpashop.service.OrderServiceTest

04:14:25.616 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [jpabook.jpashop.service.OrderServiceTest]: using defaults.

04:14:25.618 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]

04:14:25.689 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@3c01cfa1, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@45d2ade3, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@727eb8cb, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@39d9314d, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@b978d10, org.springframework.test.context.support.DirtiesContextTestExecutionListener@5b7a8434, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5c45d770, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@2ce6c6ec, org.springframework.test.context.event.EventPublishingTestExecutionListener@1bae316d, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@147a5d08, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@6676f6a0, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@7cbd9d24, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@1672fe87, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@5026735c, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@1b45c0e]

04:14:25.695 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.699 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.752 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.752 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.758 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.758 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.760 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.760 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.775 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@3af0a9da testClass = OrderServiceTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@43b9fd5 testClass = OrderServiceTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1190200a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@38e79ae3, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@762ef0ea, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@10d68fcd, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@17a7f733, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@223d2c72], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].

04:14:25.780 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.781 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.service.OrderServiceTest]

04:14:25.874 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v2.5.0)

2021-06-08 04:14:27.273  INFO 14348 --- [           main] j.jpashop.service.OrderServiceTest       : Starting OrderServiceTest using Java 11.0.9 on MINKOOK with PID 14348 (started by 김민국 in C:\Users\김민국\study\jpashop\jpashop)

2021-06-08 04:14:27.278  INFO 14348 --- [           main] j.jpashop.service.OrderServiceTest       : No active profile set, falling back to default profiles: default

2021-06-08 04:14:29.817  INFO 14348 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.

2021-06-08 04:14:29.865  INFO 14348 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 28 ms. Found 0 JPA repository interfaces.

2021-06-08 04:14:32.500  INFO 14348 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2021-06-08 04:14:33.008  INFO 14348 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2021-06-08 04:14:33.253  INFO 14348 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]

2021-06-08 04:14:33.410  INFO 14348 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.31.Final

2021-06-08 04:14:33.824  INFO 14348 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}

2021-06-08 04:14:34.295  INFO 14348 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

2021-06-08 04:14:36.198 DEBUG 14348 --- [           main] org.hibernate.SQL                        : drop table if exists delivery CASCADE 

2021-06-08 04:14:36.201  INFO 14348 --- [           main] p6spy                                    : #1623093276201 | took 1ms | statement | connection 2| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

drop table if exists delivery CASCADE 

drop table if exists delivery CASCADE ;

2021-06-08 04:14:36.202 DEBUG 14348 --- [           main] org.hibernate.SQL                        : drop table if exists item CASCADE 

2021-06-08 04:14:36.202  INFO 14348 --- [           main] p6spy                                    : #1623093276202 | took 0ms | statement | connection 2| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

drop table if exists item CASCADE 

drop table if exists item CASCADE ;

2021-06-08 04:14:36.202 DEBUG 14348 --- [           main] org.hibernate.SQL                        : drop table if exists member CASCADE 

2021-06-08 04:14:36.203  INFO 14348 --- [           main] p6spy                                    : #1623093276203 | took 0ms | statement | connection 2| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

drop table if exists member CASCADE 

drop table if exists member CASCADE ;

2021-06-08 04:14:36.203 DEBUG 14348 --- [           main] org.hibernate.SQL                        : drop table if exists order_item CASCADE 

2021-06-08 04:14:36.203  INFO 14348 --- [           main] p6spy                                    : #1623093276203 | took 0ms | statement | connection 2| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

drop table if exists order_item CASCADE 

drop table if exists order_item CASCADE ;

2021-06-08 04:14:36.203 DEBUG 14348 --- [           main] org.hibernate.SQL                        : drop table if exists orders CASCADE 

2021-06-08 04:14:36.203  INFO 14348 --- [           main] p6spy                                    : #1623093276203 | took 0ms | statement | connection 2| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

drop table if exists orders CASCADE 

drop table if exists orders CASCADE ;

2021-06-08 04:14:36.204 DEBUG 14348 --- [           main] org.hibernate.SQL                        : drop sequence if exists hibernate_sequence

2021-06-08 04:14:36.204  INFO 14348 --- [           main] p6spy                                    : #1623093276204 | took 0ms | statement | connection 2| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

drop sequence if exists hibernate_sequence

drop sequence if exists hibernate_sequence;

2021-06-08 04:14:36.209 DEBUG 14348 --- [           main] org.hibernate.SQL                        : create sequence hibernate_sequence start with 1 increment by 1

2021-06-08 04:14:36.211  INFO 14348 --- [           main] p6spy                                    : #1623093276211 | took 2ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

create sequence hibernate_sequence start with 1 increment by 1

create sequence hibernate_sequence start with 1 increment by 1;

2021-06-08 04:14:36.212 DEBUG 14348 --- [           main] org.hibernate.SQL                        : create table delivery (delivery_id bigint not null, city varchar(255), street varchar(255), zipcode varchar(255), status varchar(255), primary key (delivery_id))

2021-06-08 04:14:36.223  INFO 14348 --- [           main] p6spy                                    : #1623093276223 | took 10ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

create table delivery (delivery_id bigint not null, city varchar(255), street varchar(255), zipcode varchar(255), status varchar(255), primary key (delivery_id))

create table delivery (delivery_id bigint not null, city varchar(255), street varchar(255), zipcode varchar(255), status varchar(255), primary key (delivery_id));

2021-06-08 04:14:36.223 DEBUG 14348 --- [           main] org.hibernate.SQL                        : create table item (dtype varchar(31) not null, item_id bigint not null, name varchar(255), price integer not null, stock_quantity integer not null, artist varchar(255), etc varchar(255), author varchar(255), isbn varchar(255), actor varchar(255), director varchar(255), primary key (item_id))

2021-06-08 04:14:36.225  INFO 14348 --- [           main] p6spy                                    : #1623093276225 | took 1ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

create table item (dtype varchar(31) not null, item_id bigint not null, name varchar(255), price integer not null, stock_quantity integer not null, artist varchar(255), etc varchar(255), author varchar(255), isbn varchar(255), actor varchar(255), director varchar(255), primary key (item_id))

create table item (dtype varchar(31) not null, item_id bigint not null, name varchar(255), price integer not null, stock_quantity integer not null, artist varchar(255), etc varchar(255), author varchar(255), isbn varchar(255), actor varchar(255), director varchar(255), primary key (item_id));

2021-06-08 04:14:36.226 DEBUG 14348 --- [           main] org.hibernate.SQL                        : create table member (member_id bigint not null, city varchar(255), street varchar(255), zipcode varchar(255), name varchar(255), primary key (member_id))

2021-06-08 04:14:36.227  INFO 14348 --- [           main] p6spy                                    : #1623093276227 | took 0ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

create table member (member_id bigint not null, city varchar(255), street varchar(255), zipcode varchar(255), name varchar(255), primary key (member_id))

create table member (member_id bigint not null, city varchar(255), street varchar(255), zipcode varchar(255), name varchar(255), primary key (member_id));

2021-06-08 04:14:36.227 DEBUG 14348 --- [           main] org.hibernate.SQL                        : create table order_item (order_item_id bigint not null, count integer not null, order_price integer not null, item_id bigint, order_id bigint, primary key (order_item_id))

2021-06-08 04:14:36.229  INFO 14348 --- [           main] p6spy                                    : #1623093276228 | took 1ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

create table order_item (order_item_id bigint not null, count integer not null, order_price integer not null, item_id bigint, order_id bigint, primary key (order_item_id))

create table order_item (order_item_id bigint not null, count integer not null, order_price integer not null, item_id bigint, order_id bigint, primary key (order_item_id));

2021-06-08 04:14:36.229 DEBUG 14348 --- [           main] org.hibernate.SQL                        : create table orders (order_id bigint not null, order_date timestamp, status varchar(255), delivery_id bigint, member_id bigint, primary key (order_id))

2021-06-08 04:14:36.230  INFO 14348 --- [           main] p6spy                                    : #1623093276230 | took 1ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

create table orders (order_id bigint not null, order_date timestamp, status varchar(255), delivery_id bigint, member_id bigint, primary key (order_id))

create table orders (order_id bigint not null, order_date timestamp, status varchar(255), delivery_id bigint, member_id bigint, primary key (order_id));

2021-06-08 04:14:36.231 DEBUG 14348 --- [           main] org.hibernate.SQL                        : alter table order_item add constraint FKija6hjjiit8dprnmvtvgdp6ru foreign key (item_id) references item

2021-06-08 04:14:36.246  INFO 14348 --- [           main] p6spy                                    : #1623093276246 | took 15ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

alter table order_item add constraint FKija6hjjiit8dprnmvtvgdp6ru foreign key (item_id) references item

alter table order_item add constraint FKija6hjjiit8dprnmvtvgdp6ru foreign key (item_id) references item;

2021-06-08 04:14:36.246 DEBUG 14348 --- [           main] org.hibernate.SQL                        : alter table order_item add constraint FKt4dc2r9nbvbujrljv3e23iibt foreign key (order_id) references orders

2021-06-08 04:14:36.249  INFO 14348 --- [           main] p6spy                                    : #1623093276249 | took 2ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

alter table order_item add constraint FKt4dc2r9nbvbujrljv3e23iibt foreign key (order_id) references orders

alter table order_item add constraint FKt4dc2r9nbvbujrljv3e23iibt foreign key (order_id) references orders;

2021-06-08 04:14:36.249 DEBUG 14348 --- [           main] org.hibernate.SQL                        : alter table orders add constraint FKtkrur7wg4d8ax0pwgo0vmy20c foreign key (delivery_id) references delivery

2021-06-08 04:14:36.252  INFO 14348 --- [           main] p6spy                                    : #1623093276251 | took 2ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

alter table orders add constraint FKtkrur7wg4d8ax0pwgo0vmy20c foreign key (delivery_id) references delivery

alter table orders add constraint FKtkrur7wg4d8ax0pwgo0vmy20c foreign key (delivery_id) references delivery;

2021-06-08 04:14:36.252 DEBUG 14348 --- [           main] org.hibernate.SQL                        : alter table orders add constraint FKpktxwhj3x9m4gth5ff6bkqgeb foreign key (member_id) references member

2021-06-08 04:14:36.256  INFO 14348 --- [           main] p6spy                                    : #1623093276256 | took 3ms | statement | connection 3| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

alter table orders add constraint FKpktxwhj3x9m4gth5ff6bkqgeb foreign key (member_id) references member

alter table orders add constraint FKpktxwhj3x9m4gth5ff6bkqgeb foreign key (member_id) references member;

2021-06-08 04:14:36.261  INFO 14348 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]

2021-06-08 04:14:36.282  INFO 14348 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2021-06-08 04:14:37.066  WARN 14348 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

2021-06-08 04:14:38.921  INFO 14348 --- [           main] j.jpashop.service.OrderServiceTest       : Started OrderServiceTest in 13.024 seconds (JVM running for 16.072)

2021-06-08 04:14:38.923  INFO 14348 --- [           main] o.s.b.a.ApplicationAvailabilityBean      : Application availability state LivenessState changed to CORRECT

2021-06-08 04:14:38.926  INFO 14348 --- [           main] o.s.b.a.ApplicationAvailabilityBean      : Application availability state ReadinessState changed to ACCEPTING_TRAFFIC

2021-06-08 04:14:39.159  INFO 14348 --- [           main] o.s.t.c.transaction.TransactionContext   : Began transaction (1) for test context [DefaultTestContext@3af0a9da testClass = OrderServiceTest, testInstance = jpabook.jpashop.service.OrderServiceTest@67376bae, testMethod = 상품주문1@OrderServiceTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@43b9fd5 testClass = OrderServiceTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1190200a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@38e79ae3, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@762ef0ea, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@10d68fcd, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@17a7f733, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@223d2c72], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@34f8ce89]; rollback [true]

2021-06-08 04:14:39.643 DEBUG 14348 --- [           main] org.hibernate.SQL                        : select member0_.member_id as member_i1_2_, member0_.city as city2_2_, member0_.street as street3_2_, member0_.zipcode as zipcode4_2_, member0_.name as name5_2_ from member member0_ where member0_.name=?

2021-06-08 04:14:39.658  INFO 14348 --- [           main] p6spy                                    : #1623093279658 | took 6ms | statement | connection 4| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

select member0_.member_id as member_i1_2_, member0_.city as city2_2_, member0_.street as street3_2_, member0_.zipcode as zipcode4_2_, member0_.name as name5_2_ from member member0_ where member0_.name=?

select member0_.member_id as member_i1_2_, member0_.city as city2_2_, member0_.street as street3_2_, member0_.zipcode as zipcode4_2_, member0_.name as name5_2_ from member member0_ where member0_.name='kim';

2021-06-08 04:14:39.673 DEBUG 14348 --- [           main] org.hibernate.SQL                        : call next value for hibernate_sequence

2021-06-08 04:14:39.674  INFO 14348 --- [           main] p6spy                                    : #1623093279674 | took 0ms | statement | connection 4| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

call next value for hibernate_sequence

call next value for hibernate_sequence;

2021-06-08 04:14:39.738 DEBUG 14348 --- [           main] org.hibernate.SQL                        : call next value for hibernate_sequence

2021-06-08 04:14:39.738  INFO 14348 --- [           main] p6spy                                    : #1623093279738 | took 0ms | statement | connection 4| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

call next value for hibernate_sequence

call next value for hibernate_sequence;

2021-06-08 04:14:39.751 DEBUG 14348 --- [           main] org.hibernate.SQL                        : call next value for hibernate_sequence

2021-06-08 04:14:39.753  INFO 14348 --- [           main] p6spy                                    : #1623093279753 | took 0ms | statement | connection 4| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

call next value for hibernate_sequence

call next value for hibernate_sequence;

2021-06-08 04:14:39.769 DEBUG 14348 --- [           main] org.hibernate.SQL                        : select item0_.item_id as item_id2_1_0_, item0_.name as name3_1_0_, item0_.price as price4_1_0_, item0_.stock_quantity as stock_qu5_1_0_, item0_.artist as artist6_1_0_, item0_.etc as etc7_1_0_, item0_.author as author8_1_0_, item0_.isbn as isbn9_1_0_, item0_.actor as actor10_1_0_, item0_.director as directo11_1_0_, item0_.dtype as dtype1_1_0_ from item item0_ where item0_.item_id=?

2021-06-08 04:14:39.772  INFO 14348 --- [           main] p6spy                                    : #1623093279772 | took 0ms | statement | connection 4| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

select item0_.item_id as item_id2_1_0_, item0_.name as name3_1_0_, item0_.price as price4_1_0_, item0_.stock_quantity as stock_qu5_1_0_, item0_.artist as artist6_1_0_, item0_.etc as etc7_1_0_, item0_.author as author8_1_0_, item0_.isbn as isbn9_1_0_, item0_.actor as actor10_1_0_, item0_.director as directo11_1_0_, item0_.dtype as dtype1_1_0_ from item item0_ where item0_.item_id=?

select item0_.item_id as item_id2_1_0_, item0_.name as name3_1_0_, item0_.price as price4_1_0_, item0_.stock_quantity as stock_qu5_1_0_, item0_.artist as artist6_1_0_, item0_.etc as etc7_1_0_, item0_.author as author8_1_0_, item0_.isbn as isbn9_1_0_, item0_.actor as actor10_1_0_, item0_.director as directo11_1_0_, item0_.dtype as dtype1_1_0_ from item item0_ where item0_.item_id=3;

2021-06-08 04:14:39.789  INFO 14348 --- [           main] p6spy                                    : #1623093279789 | took 0ms | rollback | connection 4| url jdbc:h2:mem:99a45f58-bed4-4148-93f4-a66ad4e834f3

;

2021-06-08 04:14:39.795  INFO 14348 --- [           main] o.s.t.c.transaction.TransactionContext   : Rolled back transaction for test: [DefaultTestContext@3af0a9da testClass = OrderServiceTest, testInstance = jpabook.jpashop.service.OrderServiceTest@67376bae, testMethod = 상품주문1@OrderServiceTest, testException = java.lang.NullPointerException, mergedContextConfiguration = [WebMergedContextConfiguration@43b9fd5 testClass = OrderServiceTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@1190200a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@38e79ae3, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@762ef0ea, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@10d68fcd, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@17a7f733, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@223d2c72], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]

java.lang.NullPointerException

at jpabook.jpashop.service.OrderService.order(OrderService.java:39)

at jpabook.jpashop.service.OrderService$$FastClassBySpringCGLIB$$ad373727.invoke(<generated>)

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)

at jpabook.jpashop.service.OrderService$$EnhancerBySpringCGLIB$$11cca1f8.order(<generated>)

at jpabook.jpashop.service.OrderServiceTest.상품주문1(OrderServiceTest.java:170)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)

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.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

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.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)

at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)

at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)

at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

Process finished with exit code -1

<orderItem.java>

package jpabook.jpashop.domain;

import jpabook.jpashop.domain.item.Item;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class OrderItem {

@Id
@GeneratedValue
@Column(name = "order_item_id")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "item_id")
private Item item;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "order_id")
private Order order;


private int orderPrice; //주문 가격
private int count; //주문 수량


public void setOrderItem(Order order) {
this.order = order;
order.getOrderItems().add(this);
}

//==생성 메서드 ==//
public static OrderItem createOrderItem(Item item, int orderPrice, int count) {

OrderItem orderItem = new OrderItem();
orderItem.setItem(item);
orderItem.setOrderPrice(orderPrice);
orderItem.setCount(count);

//주문을 하면 재고가 줄음
item.removeStock(count);
return orderItem;
}



//==비지니스 로직==//
public void cancel() {
getItem().addStock(count);
}

//== 조회 로직==//

/**
* 주문상품 전체 가격 조회
*/
public int getTotalPrice() {
return getOrderPrice() * getCount();
}
}

안녕하세요! 소스 코드 확인해보니

orderService.order 메서드가 두번째 파라미터로 Item의 아이디를 받게 되어있는데

OrderItem의 아이디를 넘겨줘서 오류가 발생하는것 같습니다.

orderService의 order 호출 시 Item의 아이디를 넘기시거나

orderService의 order에서 OrderItem의 아이디를 가지고 처리하도록 수정하시면 될것 같습니다.

Long orderId = orderService.order(order.getMember().getId(), order.getOrderItems().get(0).getId(), order.getOrderItems().get(0).getCount());

김영한님의 프로필 이미지
김영한
지식공유자

크! codesweaver님 고맙습니다^^!

김민국님의 프로필 이미지
김민국
질문자

제 코드에 문제가 많았습니다.

1.orderItem은 Order 클래스에서 CasecadeType.All상태라서  order 생성후 em.persist(order)로 orderItem 및 order이 영속성 관리상태에 들어가는것 같습니다.

2. codesweaver님 말씀대로 orderService.order 메서드의 두번째 파라미터값이 itemId였습니다.

   

3.검증 코드 역시 문제가 있었습니다. 주문의 수량을 조회해버렸습니다.. 재고의 수량이 아니라..

Assertions.assertThat(findOrder.getOrderItems().get(0).getCount()).isEqualTo(90);

재고의 수량을 조회하려면 다음과 같이 조회해야 하는것 같습니다

Assertions.assertThat(findBook.getStockQuantity()).isEqualTo(90);

완벽하게 이해했는지는 알 수 없으나, 궁금증을 해결하는 과정에서 많이 배운 것 같습니다!

codesweaver님 큰 도움 되었습니다!! 너무 감사합니다!!!

영한선생님 좋은강의 항상 감사합니다!!!