Conversation
…core) ## What changes were proposed in this pull request? mockito-all:1.10.19 is an uber-jar that bundles Hamcrest 1.x which conflicts with the Hamcrest 2.x pulled in by the ScalaTest 3.2.9 / scalatestplus mockito-3-4 upgrade: the bundled LocalizedMatcher does not implement Matcher.describeMismatch(Object, Description) and fails to compile. This switches to mockito-core (which does not bundle Hamcrest) and aligns the version with the mockito-3-4_2.13:3.2.9.0 binding. - pom.xml: mockito-all -> mockito-core, version 1.10.19 -> 3.4.6 - Replace removed org.mockito.Matchers with org.mockito.ArgumentMatchers - Replace removed anyObject() with any() - Rewrite the custom ArgumentMatcher[Path] to the Mockito 2+ shape (matches(T) instead of matches(Object); drop the removed describeTo), dropping the now-unused Hamcrest Description and internal Equals imports Note: in Mockito 3.4.6 org.mockito.Matchers still exists only as a deprecated subclass of ArgumentMatchers and declares no members of its own, so Scala cannot import its inherited statics (e.g. "import org.mockito.Matchers.any" fails to compile). All Scala specs must import from org.mockito.ArgumentMatchers directly. Updated specs: HttpClientSpec, ScalaJobHandleTest, BatchSessionSpec, InteractiveSessionServletSpec, InteractiveSessionSpec, FileSystemStateStoreSpec, SparkYarnAppSpec. JIRA: https://issues.apache.org/jira/browse/LIVY-1089 ## How was this patch tested? Compiled the server module and its reactor dependencies with `mvn -pl server -am test-compile`, which succeeds (exit 0) and confirms all migrated specs now compile under Mockito 3.4.6 - including SparkYarnAppSpec, whose `import org.mockito.Matchers.any` would otherwise fail to compile. Also compiled the thriftserver modules with the profile enabled via `mvn -Pthriftserver -pl thriftserver/server,thriftserver/session,thriftserver/client -am test-compile`, which succeeds (exit 0) - its tests use org.mockito.Mockito mock/when, which are unaffected by the migration. Existing unit tests exercise the migrated mocks. ## Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Hi @gyogal, This is a follow-up to LIVY-1066. In certain cases compilation errors may occur due to the older version of Mockito. Example error message: The Difference Between mockito-core and mockito-all: https://www.baeldung.com/mockito-core-vs-mockito-all The solution is to upgrade Mockito and replace mockito-all with mockito-core. Please approve this change. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
mockito-all:1.10.19 is an uber-jar that bundles Hamcrest 1.x which conflicts with the Hamcrest 2.x pulled in by the ScalaTest 3.2.9 / scalatestplus mockito-3-4 upgrade: the bundled LocalizedMatcher does not implement Matcher.describeMismatch(Object, Description) and fails to compile. This switches to mockito-core (which does not bundle Hamcrest) and aligns the version with the mockito-3-4_2.13:3.2.9.0 binding.
Note: in Mockito 3.4.6 org.mockito.Matchers still exists only as a deprecated subclass of ArgumentMatchers and declares no members of its own, so Scala cannot import its inherited statics (e.g. "import org.mockito.Matchers.any" fails to compile). All Scala specs must import from org.mockito.ArgumentMatchers directly.
Updated specs: HttpClientSpec, ScalaJobHandleTest, BatchSessionSpec, InteractiveSessionServletSpec, InteractiveSessionSpec, FileSystemStateStoreSpec, SparkYarnAppSpec.
JIRA: https://issues.apache.org/jira/browse/LIVY-1089
How was this patch tested?
Compiled the server module and its reactor dependencies with
mvn -pl server -am test-compile, which succeeds (exit 0) and confirms all migrated specs now compile under Mockito 3.4.6 - including SparkYarnAppSpec, whoseimport org.mockito.Matchers.anywould otherwise fail to compile.Also compiled the thriftserver modules with the profile enabled via
mvn -Pthriftserver -pl thriftserver/server,thriftserver/session,thriftserver/client -am test-compile, which succeeds (exit 0) - its tests use org.mockito.Mockito mock/when, which are unaffected by the migration.Existing unit tests exercise the migrated mocks.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)