https://github.com/herexu/NutzWk/blob/nutzboot-dubbo/wk-app/wk-nb-service-sys/src/test/java/cn/wizzer/test/SysTestDemo.java
在单元测试里面,这个NbJUnit4Runner是在哪边引的
/**
* Created by wizzer on 2018/3/31.
*/
@IocBean(create = "init")
@RunWith(NbJUnit4Runner.class)
public class SysTestDemo extends Assert {
@Inject
private SysConfigService sysConfigService;
public void init() {
System.out.println("say hi");
}
@Test
public void test_service_inject() {
assertNotNull(sysConfigService);
System.out.println("sys_config:::"+ Json.toJson(sysConfigService.getAllList()));
}
// 测试类可提供public的static的createNbApp方法,用于定制当前测试类所需要的NbApp对象.
// 测试类带@IocBean或不带@IocBean,本规则一样生效
// 若不提供,默认使用当前测试类作为MainLauncher.
// 也可以自定义NbJUnit4Runner, 继承NbJUnit4Runner并覆盖其createNbApp方法
public static NbApp createNbApp() {
NbApp nb = new NbApp().setMainClass(DubboRpcSysMainLauncher.class).setPrintProcDoc(false);
nb.getAppContext().setMainPackage("cn.wizzer");
return nb;
}
}