一 单元测试
https://gitee.com/cakin24/code/tree/master/07/UnitTestDemoJpaTest
二 创建数据库book
三 运行程序,数据表自动生成
1 在数据表中加入几条测试数据
四 测试代码
package com.example.demo.repository;
import com.example.demo.entity.Card;
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 java.util.List;
@RunWith(SpringRunner.class)
// SpringJUnit支持,由此引入Sprin