添加 junit4 单元测试
parent
3fe45e561e
commit
8ff26ff435
5
pom.xml
5
pom.xml
|
@ -103,6 +103,11 @@
|
||||||
<artifactId>FastInfoset</artifactId>
|
<artifactId>FastInfoset</artifactId>
|
||||||
<version>1.2.18</version>
|
<version>1.2.18</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
|
@ -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<Map<String, Object>> list = cartMapper.selectByUserId(2L);
|
||||||
|
System.out.println(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void selectAll() {
|
||||||
|
cartMapper.selectList(null).forEach(System.out::println);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue