After doing further research, it seems that mockito 5.17.0 uses bytebuddy 1.15.11 that supports up to Java 23
Caused by: java.lang.IllegalArgumentException: Java 24 (68) is not supported by the current version of Byte Buddy which officially supports Java 23 (67) - update Byte Buddy or set net.bytebuddy.experimental as a VM property
bytebuddy only supports Java 25 ( including Java 24 ) from 1.17.5. The current workaround is to configure net.bytebuddy.experimental as suggested by this link also - https://github.com/raphw/byte-buddy/issues/1396
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dnet.bytebuddy.experimental=true -javaagent:${mockito.core.jar} </argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>