From 8ff26ff435022cf1c16f9820f1c32f21e0084338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=90=91=E5=AE=87?= Date: Mon, 14 Oct 2024 14:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20junit4=20=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++ .../rabbiter/em/mapper/CartMapperTest.java | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/test/java/com/rabbiter/em/mapper/CartMapperTest.java diff --git a/pom.xml b/pom.xml index 1798805..2305d8e 100644 --- a/pom.xml +++ b/pom.xml @@ -103,6 +103,11 @@ FastInfoset 1.2.18 + + junit + junit + test + diff --git a/src/test/java/com/rabbiter/em/mapper/CartMapperTest.java b/src/test/java/com/rabbiter/em/mapper/CartMapperTest.java new file mode 100644 index 0000000..0ff161d --- /dev/null +++ b/src/test/java/com/rabbiter/em/mapper/CartMapperTest.java @@ -0,0 +1,32 @@ +package com.rabbiter.em.mapper; + +import com.rabbiter.em.entity.Cart; +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 javax.annotation.Resource; + +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.*; +@RunWith(SpringRunner.class) +@SpringBootTest +public class CartMapperTest { + @Autowired + private CartMapper cartMapper; + + @Test + public void selectByUserId() { + List> list = cartMapper.selectByUserId(2L); + System.out.println(list); + } + + @Test + public void selectAll() { + cartMapper.selectList(null).forEach(System.out::println); + } +} \ No newline at end of file