JMockit An automated testing toolkit for Java

Development history

Current release

Version 1.49 (Dec 29, 2019):

Previous releases

Version 1.48 (Aug 31, 2019):

Version 1.47 (Jun 30, 2019):

Version 1.46 (Mar 31, 2019):

Version 1.45 (Jan 27, 2019):

Version 1.44 (Nov 25, 2018):

Version 1.43 (Sep 30, 2018):

Version 1.42 (Aug 26, 2018):

Version 1.41 (Jul 29, 2018):

Version 1.40 (Jun 24, 2018):

Version 1.39 (Mar 25, 2018):

Version 1.38 (Dec 31, 2017):

Version 1.37 (Nov 26, 2017):

Version 1.36 (Oct 29, 2017):

Version 1.35 (Sep 24, 2017):

Version 1.34 (Aug 27, 2017):

Version 1.33 (Jun 25, 2017):

Version 1.32 (May 28, 2017):

Version 1.31 (Mar 26, 2017):

Version 1.30 (Dec 18, 2016):

Version 1.29 (Oct 30, 2016):

Version 1.28 (Sep 25, 2016):

Version 1.27 (Aug 28, 2016):

Version 1.26 (Jul 31, 2016):

Version 1.25 (Jun 26, 2016):

Version 1.24 (May 29, 2016):

Version 1.23 (Apr 24, 2016):

Version 1.22 (Feb 28, 2016):

Version 1.21 (Dec 29, 2015):

Version 1.20 (Oct 25, 2015):

Version 1.19 (Aug 23, 2015):

Version 1.18 (Jun 20, 2015):

Version 1.17 (Apr 26, 2015):

Version 1.16 (Mar 15, 2015):

Version 1.15 (Feb 15, 2015):

Version 1.14 (Dec 19, 2014):

Version 1.13 (Oct 26, 2014):

Version 1.12 (Sep 21, 2014):

Version 1.11 (Aug 24, 2014):

Version 1.10 (Jul 27, 2014):

Version 1.9 (Jun 22, 2014):

Version 1.8 (Apr 27, 2014):

Version 1.7 (Mar 9, 2014):

Version 1.6 (Dec 23, 2013):

Version 1.5 (Oct 20, 2013):

Version 1.4 (Aug 21, 2013):

Version 1.3 (Jun 23, 2013):

Version 1.2 (Apr 21, 2013):

Version 1.1 (Feb 25, 2013):

Version 1.0 (Dec 20, 2012):

Version 0.999.19 (Nov 19, 2012):

Version 0.999.18 (Oct 18, 2012):

Version 0.999.17 (Sep 17, 2012):

Version 0.999.16 (Jul 30, 2012):

Version 0.999.15 (Apr 30, 2012):

Version 0.999.14 (Mar 30, 2012):

Version 0.999.13 (Feb 23, 2012):

Version 0.999.12 (Dec 22, 2011):

Version 0.999.11 (Oct 21, 2011):

From this version on, JMockit artifacts are deployed to the Maven Central repository, under a different "<groupId>" of "com.googlecode.jmockit". Therefore, Maven users should change JMockit dependencies in their pom.xml files accordingly.

Version 0.999.10 (Jun 16, 2011):

Version 0.999.9 (May 17, 2011):

Version 0.999.8 (March 11, 2011):

Version 0.999.7 (February 13, 2011):

Version 0.999.6 (January 30, 2011):

Version 0.999.5 (December 28, 2010):

From this version on, the Java.net Maven 2 repository is no longer used. Project artifacts are now deployed here. Therefore, Maven users should configure the new repository in their pom.xml files.

Version 0.999.4 (December 5, 2010):

Version 0.999.3 (October 3, 2010):

Version 0.999.2 (August 22, 2010):

Version 0.999.1 (July 25, 2010):

Version 0.999 (July 15, 2010):

Version 0.998 (April 21, 2010):

Version 0.997 (March 3, 2010):

Version 0.996 (January 24, 2010):

Version 0.995 (December 20, 2009):

Version 0.994 (December 6, 2009):

Version 0.993 (November 15, 2009):

Version 0.992 (November 8, 2009):

Version 0.991 (October 25, 2009):

Version 0.990 (October 4/6, 2009):

Version 0.989 (September 20, 2009):

Version 0.988 (September 6, 2009):

Version 0.987 (August 17, 2009):

Version 0.986 (July 27, 2009):

Version 0.985 (July 12, 2009):

Version 0.984 (July 5, 2009):

Version 0.983 (June 29/30, 2009):

Version 0.982 (June 19, 2009):

Version 0.981 (June 14, 2009):

Migrating from a previous release

The following changes need to be made to existing JUnit test suites, when migrating from JMockit release 0.97 (or older) to newer releases.

  1. First of all, recompile all test sources with the new jmockit.jar in the classpath.
  2. Any test classes that extended junit.framework.TestCase now need to extend mockit.integration.junit3.JMockitTestCase, unless the test suite is always run with "-javaagent:jmockit.jar". Alternatively, the test class can be converted to JUnit 4, with the addition of @RunWith(JMockit.class) to the class and of @Test to its test methods.
  3. In any test class which itself extends mockit.Expectations, if there is any initialization of instance fields outside of a @Before/setUp method, then a JUnit fixture setup method will have to be created to perform the initialization. This is necessary because now any mock fields of the test class will only be assigned after the test class instance is created (but before any setup or test methods are executed).
  4. If an Expectations subclass (which can be a test class, an anonymous inner class inside a test method, and so on) declares two or more mock fields of the same type or with a common base type, then these fields must mock exactly the same set of methods and constructors belonging to the common class types. By default, all methods and constructors are mocked, so this issue can only happen when (static) partial mocking is used, through the methods or value attribute of the MockField/Mocked annotation. So, if that's the case, simply copy the mock filters specified in one mock field to the others.
  5. JMockit now restores mocked classes automatically both for test-scoped and test class-scoped mocks. Consequently, none of the methods Mockit.tearDownMocks(), Mockit.restoreAllOriginalDefinitions(), or Mockit.restoreOriginalDefinition(...) need to be explicitly called anymore, unless a given test method really needs to restore some mocked class before the test completes its execution. This also means that classes that remained mocked between tests or from one test class to the next in the suite, will not remain mocked as before, but will be restored automatically either between individual tests, or from one test class to the next. Therefore, it will be necessary to set up the mocks again at the appropriate point (for example, in a @Before or @BeforeClass method when using JUnit 4).

It should be easy enough to adapt existing tests according to the incompatibilities listed above. If after making such changes some tests remain broken that weren't before, please let me know.

Version 0.98 (June 7, 2009):

Version 0.97 (May 10, 2009):

Version 0.96 (April 21, 2009):

Version 0.95 (October 19, 2008):

Version 0.94/b/c (January 30/February 14/March 29, 2008):

Version 0.93 (January 14, 2008):

Version 0.92/0.91 (January 4, 2008):

Version 0.90 (November 11, 2007):

Version 0.86 (September 13, 2007):

Version 0.85 (May 20, 2007)

Version 0.84 (March 9, 2007)

Version 0.83 (November 26, 2006)

Version 0.81 (June 2, 2006)