You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some Mockito tests are failing under Java 17 with the following error:
[INFO] Running net.logstash.logback.appender.destination.RandomDestinationConnectionStrategyTest
Error: Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.034 s <<< FAILURE! - in net.logstash.logback.appender.destination.RandomDestinationConnectionStrategyTest
Error: testConnectionTtl_success Time elapsed: 0.011 s <<< ERROR!
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class java.util.Random.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.
Java : 17
JVM vendor name : Eclipse Adoptium
JVM vendor version : 17+35
JVM name : OpenJDK 64-Bit Server VM
JVM version : 17+35
JVM info : mixed mode, sharing
OS name : Linux
OS version : 5.8.0-1041-azure
Underlying exception : java.lang.IllegalStateException: Cannot access annotation property public abstract java.lang.String jdk.internal.util.random.RandomSupport$RandomGeneratorProperties.name()
Caused by: java.lang.IllegalStateException: Cannot access annotation property public abstract java.lang.String jdk.internal.util.random.RandomSupport$RandomGeneratorProperties.name()
Caused by: java.lang.IllegalAccessException: class net.bytebuddy.description.annotation.AnnotationDescription$ForLoadedAnnotation cannot access interface jdk.internal.util.random.RandomSupport$RandomGeneratorProperties (in module java.base) because module java.base does not export jdk.internal.util.random to unnamed module @1ea0fbbc
The text was updated successfully, but these errors were encountered:
…sues during test
Cfr Issue #664
Instead of exposing and mocking the Random used by the strategy, hide it behind a `nextInt()` member method that can safely by intercepted by Mockito during tests.
Some Mockito tests are failing under Java 17 with the following error:
The text was updated successfully, but these errors were encountered: