Bladex-boot
按照手册,配置了单元测试,运行报错。
测试代码如下:
package org.springblade.modules.demo.service.impl;
import org.junit.runner.RunWith;
import org.springblade.Application;
import org.springblade.core.test.BladeBootTest;
import org.springblade.core.test.BladeSpringRunner;
import org.springblade.modules.demo.entity.Blog;
import org.springblade.modules.demo.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.Date;
@RunWith(BladeSpringRunner.class)
@SpringBootTest(classes = Application.class)
@BladeBootTest(appName = "test", profile = "dev", enableLoader = true)
public class BlogServiceImplTest {
@Autowired
private BlogService blogService;
public void testSave() {
Blog blog = new Blog();
blog.setBlogContent("teststtstst");
blog.setBlogTitle("title-test");
blog.setBlogDate(new Date());
boolean save = blogService.save(blog);
}
}
扫一扫访问 Blade技术社区 移动端