在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jmock-developers/jmock-library开源软件地址(OpenSource Url):https://github.com/jmock-developers/jmock-library开源编程语言(OpenSource Language):Java 99.0%开源软件介绍(OpenSource Introduction):JMock LibraryMaven <dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit5</artifactId>
<version>2.12.0</version>
<scope>test</scope>
</dependency> Gradle
Recent Changes2.10.0JUnit 5 Support
import org.jmock.Expectations;
import org.jmock.junit5.JUnit5Mockery;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
public class JUnit5TestThatDoesSatisfyExpectations {
@RegisterExtension
JUnit5Mockery context = new JUnit5Mockery();
private Runnable runnable = context.mock(Runnable.class);
@Test
public void doesSatisfyExpectations() {
context.checking(new Expectations() {{
oneOf (runnable).run();
}});
runnable.run();
}
} JUnit 4 moved to provided scope in org.jmock:jmock
Java7 Support will be dropped next release2.9.0
Upgrading to 2.8.XAre you seeing NPEs? We have had to make a breaking change to You should change
to the following
This is due to a compiler change in Java 1.7. The 2.6.0 release was compiled with Java 1.6 so it did not suffer this problem. Advantages of jMock 2 over jMock 1
Package StructurejMock 2 is organised into published and internal packages. We guarantee backwards compatability of types in published packages within the same major version of jMock. There are no guarantees about backward compatability for types in internal packages. Types defined in published packages may themselves define public methods that accept or return types from internal packages or inherit methods from types in internal packages. Such methods have no compatability guarantees and should not be considered as part of the published interface. Published packagesorg.jmockDSL-style API org.jmock.apiorg.jmock.libConvenient classes that implement the APIs in the core, are used by the DSL-style API, and can be used in user-defined APIs org.jmock.integrationClasses integrating jMock with different testing APIs, such as JUnit 3.x, JUnit 4.x and TestNG. Packages of example codeorg.jmock.lib.nonstdLib classes that rely on clever hacks or otherwise cannot be guaranteed to always work in all JVMs. There are no compatability guarantees with these classes. Use at your own risk. Internal packagesorg.jmock.internalInternal implementation details org.jmock.testTests for jMock itself Plug-in PointsMatcherControls the matching of invocations to expectations ActionPerforms an action in response to an invocation ImposteriserWraps mock objects in an adapter of the correct type ExpectationMatches an invocation and fakes its behaviour ExpectationErrorTranslatorTranslates expectation errors into error type used by a specific testing framework. MockObjectNamingSchemeCreates names for mock objects based on the mocked type. ContributingIf you'd like to contribute, then do the following:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论