备案/许可证编号:粤ICP备17106855号,工信部网站(http://www.beian.miit.gov.cn)
1234567891011121314151617181920212223242526272829303132333435
import com.jeesite.common.tests.BaseInitDataTests;import com.jeesite.modules.Application;import com.jeesite.modules.test.entity.TestEmployees;import com.jeesite.modules.test.service.TestEmployeesService;import org.junit.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringBootTest;import org.springframework.test.annotation.Rollback;import org.springframework.test.context.ActiveProfiles;@ActiveProfiles("test")@SpringBootTest(classes=Application.class)@Rollback(false)public class TestPageTest extends BaseInitDataTests { /** * java.lang.RuntimeException: 为了防止误操作,请运行时增加 -Djeesite.initdata=true 参数。 */ public TestPageTest() {} @Autowired private TestEmployeesService testEmployeesService; @Test public void initCoreData() throws Exception{ TestEmployees testEmployees = new TestEmployees(); testEmployees.setName("20190709"); testEmployeesService.save(testEmployees); System.out.println(testEmployees.getId()); }}