Upgrade java mockito from version 1.x to version 5 (#2781)

* use mockito 5

* remove unnecessary flag

* fix java annotation test file name
diff --git a/lib/java/gradle/environment.gradle b/lib/java/gradle/environment.gradle
index f25f3e6..cb61c05 100644
--- a/lib/java/gradle/environment.gradle
+++ b/lib/java/gradle/environment.gradle
@@ -68,6 +68,6 @@
     implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
 
     testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
-    testImplementation "org.mockito:mockito-all:${mockitoVersion}"
+    testImplementation "org.mockito:mockito-core:${mockitoVersion}"
     testRuntimeOnly "org.slf4j:slf4j-log4j12:${slf4jVersion}"
 }
diff --git a/lib/java/gradle/generateTestThrift.gradle b/lib/java/gradle/generateTestThrift.gradle
index 0506aa6..301812f 100644
--- a/lib/java/gradle/generateTestThrift.gradle
+++ b/lib/java/gradle/generateTestThrift.gradle
@@ -88,7 +88,7 @@
     thriftCompile(it, 'EnumContainersTest.thrift')
     thriftCompile(it, 'JavaBinaryDefault.thrift')
     thriftCompile(it, 'VoidMethExceptionsTest.thrift')
-    thriftCompile(it, 'AnnotationTest.thrift')
+    thriftCompile(it, 'JavaAnnotationTest.thrift')
     thriftCompile(it, 'partial/thrift_test_schema.thrift')
 }
 
diff --git a/lib/java/gradle/unitTests.gradle b/lib/java/gradle/unitTests.gradle
index 1e7481b..4f06fcf 100644
--- a/lib/java/gradle/unitTests.gradle
+++ b/lib/java/gradle/unitTests.gradle
@@ -65,8 +65,6 @@
         outputs.upToDateWhen { false }
     }
 
-    // This is required for Mockito to run under Java 17
-    jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED'
     include '**/Test*.class'
     exclude '**/Test*\$*.class'