LuciferYang opened a new pull request #34991:
URL: https://github.com/apache/spark/pull/34991


   ### What changes were proposed in this pull request?
   In order to enable the UTs in `mllib-local` and `mllib` to use `mockito` to 
mock `j.u.Random`, 
`-add-exports=java.base/jdk.internal.util.random=ALL-UNNAMED` compile option is 
added for Java 17  in SPARK-37070 . 
   
   This pr do the following change to remove the `-add-exports` option:
   1. Introduce test dependence of mockito-inline, the new test dependence used 
to specify the configuration of `mockito-extensions`
   2. Upgrade org.scalatestplus:mockito from 3-4 to 3-12 and upgrade mockito 
from 3.4.x to 3.12.x
   
   ### Why are the changes needed?
   Find a way to let `mockito` can mock `j.u.Random` directly and remove 
`-add-exports` compile option for Java 17.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   
   ### How was this patch tested?
   
   - Pass the Jenkins or GitHub Action
   
   - Manual test with Java 17
   
   Use maven
   ```
   mvn clean install -pl mllib-local -am -DskipTests
   mvn test -pl mllib-local 
   
   mvn clean install -pl mllib -am -DskipTests
   mvn test -pl mllib
   ```
   
   Use sbt
   ```
   sbt mllib-local/test
   sbt mllib/test
   ```
   
   There are no test failed related to ` 
org.mockito.exceptions.base.MockitoException: Mockito cannot mock this class: 
class java.util.Random.` without 
`-add-exports=java.base/jdk.internal.util.random=ALL-UNNAMED`, all test can be 
successful.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to