开发者

Can mockito or easymock replace rmock

开发者 https://www.devze.com 2023-01-15 10:40 出处:网络
I\'m sitting with a legacy project, and we\'re starting to replace some old legacycode. As Rmock don\'t have sup开发者_开发问答port for junit4, we would like to replace it. One thing i was wondering i

I'm sitting with a legacy project, and we're starting to replace some old legacycode. As Rmock don't have sup开发者_开发问答port for junit4, we would like to replace it. One thing i was wondering is - how could i replace the dynamictestsuite feature of rmock. This is a good feature where you create a dynamic testsuite for each run, and can do stuff like.

@Override
protected void setupSuite() {
        forEach(is.clazz.assignableTo(TestCase.class).and(is.not(is.clazz.name(is.endingWith("oldTest")))).perform(addAllToSuite);

}

that would get all testclasses not ending with oldTest and create a dynamictestsuite. And so on, you get the point.


ClasspathSuite can define a suite by searching for JUnit test classes in the class path, with a filter on the test class names to include or exclude.

import org.junit.extensions.cpsuite.ClasspathSuite.*;
import org.junit.runner.RunWith;

@RunWith(ClasspathSuite.class)
@ClassnameFilters({"!.*oldTest"})
public class MySuite {}
0

精彩评论

暂无评论...
验证码 换一张
取 消