NutzCN Logo
问答 Nutz测试用例问题
发布于 2668天前 作者 KevinLiu2333 2011 次浏览 复制 上一个帖子 下一个帖子
标签:
java.lang.NoSuchMethodError: org.nutz.mock.NutTestRunner.isIgnored(Lorg/junit/runners/model/FrameworkMethod;)Z

	at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:26)
	at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:14)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

public MyNutTestRunner(Class<?> klass) throws InitializationError {
    super(klass);
}

public Class<?> getMainModule() {
    return MainModule.class;
}

@Override
protected String[] getIocArgs() {
    return super.getIocArgs();
}

// /**
// * 可覆盖createIoc,实现参数覆盖, bean替换,等定制.
// */
// protected Ioc createIoc() {
// Ioc ioc = super.createIoc();
// PropertiesProxy conf = ioc.get(PropertiesProxy.class, "conf");
// conf.put("db.url", "jdbc:h2:~/test");
// return ioc;
// }
}
package com.wonders.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.nutz.dao.Dao;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

/**
* Created with IntelliJ IDEA.
* User: Administrator
* Date: 2017/7/27 0027
* Time: 16:00
*/
@RunWith(MyNutTestRunner.class)
@IocBean // 必须有
public class SimpleTest {
//private static final Log log = Logs.get();

// 跟通常的@Inject完全一样.
@Inject("refer:$ioc")
protected Ioc ioc;

@Inject
protected Dao dao;

@Test
public void test_user_service_create_user() {
    System.out.println(123);
}

}
package com.wonders;

import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.annotation.SetupBy;
import org.nutz.mvc.ioc.provider.ComboIocProvider;

import com.wonders.wddc.config.ConfigSetup;
import com.wonders.wddc.config.OpFilter;
import com.wonders.wddc.tiles.adaptor.SearchTableAdaptor;

@IocBy(type=ComboIocProvider.class,args={"*org.nutz.ioc.loader.json.JsonLoader","ioc/",
"*org.nutz.ioc.loader.annotation.AnnotationIocLoader","com.wonders"})
@Modules(scanPackage=true)
@AdaptBy(type = SearchTableAdaptor.class)
@Filters({@By(type = OpFilter.class)})
@SetupBy(ConfigSetup.class)
public class MainModule {

}

1 回复

junit版本太低

添加回复
请先登陆
回到顶部