Android-Extensions
Android-Extensions copied to clipboard
Bump mockito-android from 2.23.0 to 5.0.0
Bumps mockito-android from 2.23.0 to 5.0.0.
Release notes
Sourced from mockito-android's releases.
v5.0.0
Mockito 5: prepare for future JDK versions
For a while now, we have seen an increase in problems/incompatibilities with recent versions of the JDK due to our usage of JVM-internal API. Most notably, JDK 17 made some changes which are incompatible with the current subclass mockmaker. Therefore, to prepare for the future of JDK, we are making some core changes to ensure Mockito keeps on working.
Switch the default mockmaker to
mockito-inlineBack in Mockito 2.7.6, we published a new mockmaker based on the "inline bytecode" principle. This mockmaker creates mocks manipulating bytecode equivalent within the original class such that its method implementations hook into the normal Mockito machinery. As a comparison, the subclass mockmaker generates "real" subclasses for mocks, to mimic the same behavior. While the approaches are similar, the inline mockmaker avoids certain restrictions that the JDK imposes. For example, it does not violate module boundaries (introduced in JDK 9, but more heavily used in JDK 17) and avoids the leaking of the creation of the subclass.
Massive thanks to community member
@retawho implemented this change.When should I still be using the subclass mockmaker?
There are legitimate remaining use cases for the subclass mockmaker. For example, on the Graal VM's native image, the inline mockmaker will not work and the subclass mockmaker is the appropriate choice. Additionally, if you would like to avoid mocking final classes, using the subclass mockmaker is a possibibility. Note however that if you solely want to use the subclass mockmaker to avoid mocking final, you will run into the above mentioned issues on JDK 17+. We want to leave this choice up to our users, which is why we will keep on supporting the subclass mockmaker.
If you want to use the subclass mockmaker instead, you can use the new
mockito-subclassartifact (published on Maven Central along with all our other artifacts).Update the minimum supported Java version to 11
Mockito 4 supports Java 8 and above. Similar to other open source projects, we are moving away from JDK 8 and to newer versions. The primary reason for moving away from JDK 8 is the increasing maintenance costs with keeping our own infrastructure working. Lately we have been running into more and more JDK 8 breakages. Additionally, while we want to support the newest JDK API's, our current solution to support both JDK 8 and newer versions causes issues with the
SecurityManager. Since we want Mockito to work on the newest version and more and more businesses adopting JDK 11, we have decided to make the switch as well.Massive thanks to community member
@retawho implemented this change.What should I do if I still run JDK 8?
For JDK 8 and below, you can keep on using Mockito 4. This is similar to if you are using JDK 6, for which you can keep on using Mockito 2. The changes in Mockito 5 (for now) are primarily focused on the latest JDK versions, which means the API differences between Mockito 4 and 5 are minimal. However, over time this will most likely widen, so we do recommend adopting JDK 11 in the future.
New
type()method onArgumentMatcherOne of our most used public API's for customizing Mockito is the
ArgumentMatcherinterface. The interface allows you to define a custom matcher, which you can pass into method arguments to provide more targeted matches. One major shortcoming of theArgumentMatcherwas the lack of varargs support.
... (truncated)
Commits
adf528dBump versions.bytebuddy from 1.12.21 to 1.12.22 (#2864)2418419Bump versions.junitJupiter from 5.9.1 to 5.9.2 (#2858)3d40cd5Bump junit-platform-launcher from 1.9.1 to 1.9.2 (#2859)9bec8e3Bump versions.errorprone from 2.17.0 to 2.18.0 (#2857)a9595f5Switch the default mockmaker to the inline mockmaker on JDK 17+ (#2834)c5d7fbcBump assertj-core from 3.23.1 to 3.24.1 (#2854)dbd7f2fBump versions.bytebuddy from 1.12.20 to 1.12.21 (#2852)4d62fa7Bump junit from 1.1.4 to 1.1.5 (#2850)b1b6d6aBump espresso-core from 3.5.0 to 3.5.1 (#2849)7b5b8ddRemove use case for non-existent method VerificationWithTimeout#never (#2848)- Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)