diff --git a/functional/MockitoTests/README.md b/functional/MockitoTests/README.md new file mode 100644 index 0000000000..e997f1b9ac --- /dev/null +++ b/functional/MockitoTests/README.md @@ -0,0 +1,24 @@ +# Mockito Tests +There are two OpenJ9 user issues where a crash with Mockito is reported: + + - Issue: https://github.com/eclipse-openj9/openj9/issues/18750 and + + - Issue: https://github.com/eclipse-openj9/openj9/issues/18781 + + - Crash with Java 21 0.42, and set testing jdk version to 17+ as required for now + + - Segmentation error when using Mockito with Java 21 + + - More Testcases would be added later as required + +# This Mockito test cases will help identify the above crashes in our builds. +Test case added: test.java.MockitoMockTest + +# Next test case to be added +Test case: test.java.MockitoJunitTest(TBD) + +# Dependencies Required: + - mockito-core + - byte-buddy + - byte-buddy-agent + - objenesis diff --git a/functional/MockitoTests/build.xml b/functional/MockitoTests/build.xml new file mode 100644 index 0000000000..6125f000fe --- /dev/null +++ b/functional/MockitoTests/build.xml @@ -0,0 +1,71 @@ + + + + + + + Mockito Tests + + + + + + + + + + + + + + + + + + + Ant version is ${ant.version} + ============COMPILER SETTINGS============ + ===fork: yes + ===executable: ${compiler.javac} + ===debug: on + ===destdir: ${DEST} + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/functional/MockitoTests/playlist.xml b/functional/MockitoTests/playlist.xml new file mode 100644 index 0000000000..3f87117af2 --- /dev/null +++ b/functional/MockitoTests/playlist.xml @@ -0,0 +1,38 @@ + + + + + + MockitoMockTest + + + https://github.com/eclipse-openj9/openj9/issues/19331 + .*zos.* + + + + $(JAVA_COMMAND) $(JVM_OPTIONS) -cp $(Q)$(RESOURCES_DIR)$(P)$(TEST_RESROOT)$(D)MockitoTests.jar$(P)$(LIB_DIR)$(D)mockito-core.jar$(P)$(LIB_DIR)$(D)byte-buddy.jar$(P)$(LIB_DIR)$(D)byte-buddy-agent.jar$(P)$(LIB_DIR)$(D)objenesis.jar$(Q) test.java.MockitoMockTest ; \ + $(TEST_STATUS) + + extended + + + functional + + + 11+ + + + \ No newline at end of file diff --git a/functional/MockitoTests/src/test/java/MockitoMockTest.java b/functional/MockitoTests/src/test/java/MockitoMockTest.java new file mode 100644 index 0000000000..f385185479 --- /dev/null +++ b/functional/MockitoTests/src/test/java/MockitoMockTest.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ +package test.java; + +import java.util.ArrayList; +import org.mockito.Mockito; + +public class MockitoMockTest { + public static void main(String[] args) { + System.out.println("Call Mockito.mock(ArrayList.class)"); + Mockito.mock(ArrayList.class); + } +} \ No newline at end of file