1.用MockBean和assert,而不是输出
import org.springframework.boot.test.mock.mockito.MockBean;
MockBean
import static org.junit.Assert.assertEquals;
assertEquals(expected,actual);
2.涉及到对数据库的修改
测试数据回滚要加@Transactional
(import org.springframework.transaction.annotation.Transactional;)
而不是@RollBack
(import org.springframework.test.annotation.Rollback;)