When running Solr's tests with Java versions that are not supported by the Mockito mocking library, it fails with an error message.
We should disable the tests, if the underlying Mockito version does not allow to mock classes, because the Java version is too new. There is already and issue open at ByteBuddy that is the root cause: https://github.com/raphw/byte-buddy/issues/370 and https://github.com/mockito/mockito/issues/1243
The idea here is to use ByteBuddy's ClassFileVersion class to check if mocking is supported. This adds a new method to SolrTestCaseJ4: assumeWorkingMockito()
Tests that use the Mockito library should add this assume to their tests, to disable them if the mocking is not supported. Instead of using a Java version test, we do this with ByteBuddy, because this is more dynamic (if we update Mockito so it works with newer Java versions, it is automatically working).
At the same time, we should update Mockito/ByteBuddy ASAP when a new version is available.
Attachments
Read full article from [SOLR-11606] Mockito does not work with newer Java versions -> disable tests automatically when no working Mockito - ASF JIRA
No comments:
Post a Comment