Skip to content

Commit

Permalink
[NAYB-8] test: Item 소프트 딜리트와 충돌하는 통합 테스트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hseong3243 committed Sep 15, 2023
1 parent 8e0a737 commit f968fbe
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import com.prgrms.nabmart.domain.user.User;
import com.prgrms.nabmart.domain.user.repository.UserRepository;
import com.prgrms.nabmart.domain.user.support.UserFixture;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.EntityTransaction;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -66,6 +69,9 @@ public class DeliveryIntegrationTest {
@Autowired
RiderRepository riderRepository;

@Autowired
EntityManagerFactory emf;

@BeforeAll
static void beforeAll() {
Properties properties = System.getProperties();
Expand Down Expand Up @@ -140,7 +146,11 @@ void tearDown() {
deliveryRepository.deleteAll();
riderRepository.deleteAll();
orderRepository.deleteAll();
itemRepository.deleteAll();
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
em.createQuery("delete from Item").executeUpdate(); // 소프트 딜리트 아이템 강제 삭제
tx.commit();
subCategoryRepository.deleteAll();
mainCategoryRepository.deleteAll();
}
Expand Down

0 comments on commit f968fbe

Please sign in to comment.