我们已经迁移到Java 1.7,现在不推荐使用Jmock.class。还有其他选择吗?似乎该网站已被废弃......
答案 0 :(得分:2)
您可能需要JUnitRuleMockery
规则。
public class TestSomething {
@Rule
public final JUnitRuleMockery context = new JUnitRuleMockery();
@Mock
private MyInterface interface;
@Test
public void testTheThing() {
context.checking(new Expectations{{
}});
// etc.
}
您需要对类路径的jmock-junit4依赖...
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.8.1</version>
<scope>test</scope>
</dependency>