From cfca5478040d11e9e36b2c4a62171a763659d397 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 11 May 2024 23:01:19 +0200 Subject: [PATCH] First try with Java. --- .github/workflows/Java.yml | 23 ++++++++++ .../workflows/{Pipeline.yml => Pipeline.yml_} | 0 examples/Java/JUnitTest/build.xml | 46 +++++++++++++++++++ .../Java/JUnitTest/src/my/pack/MyClass.java | 7 +++ .../JUnitTest/src/my/pack/OtherClass.java | 7 +++ examples/Java/JUnitTest/test/my/AllTests.java | 11 +++++ .../Java/JUnitTest/test/my/pack/AllTests.java | 11 +++++ .../JUnitTest/test/my/pack/MyClassTest.java | 14 ++++++ .../test/my/pack/OtherClassTest.java | 14 ++++++ 9 files changed, 133 insertions(+) create mode 100644 .github/workflows/Java.yml rename .github/workflows/{Pipeline.yml => Pipeline.yml_} (100%) create mode 100644 examples/Java/JUnitTest/build.xml create mode 100644 examples/Java/JUnitTest/src/my/pack/MyClass.java create mode 100644 examples/Java/JUnitTest/src/my/pack/OtherClass.java create mode 100644 examples/Java/JUnitTest/test/my/AllTests.java create mode 100644 examples/Java/JUnitTest/test/my/pack/AllTests.java create mode 100644 examples/Java/JUnitTest/test/my/pack/MyClassTest.java create mode 100644 examples/Java/JUnitTest/test/my/pack/OtherClassTest.java diff --git a/.github/workflows/Java.yml b/.github/workflows/Java.yml new file mode 100644 index 00000000..a1ab3ace --- /dev/null +++ b/.github/workflows/Java.yml @@ -0,0 +1,23 @@ +name: Java + +on: + push: + +jobs: + Ant: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up JDK 11 for x64 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + architecture: x64 + - name: Prepare + run: find / -name "*.jar" 2>/dev/null| grep -P '(junit|hamcrest)' + - name: Run the Ant 'junit' target + run: ant -noinput -buildfile build.xml junit + - name: Debug + run: ls -lAh build diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml_ similarity index 100% rename from .github/workflows/Pipeline.yml rename to .github/workflows/Pipeline.yml_ diff --git a/examples/Java/JUnitTest/build.xml b/examples/Java/JUnitTest/build.xml new file mode 100644 index 00000000..25f77b75 --- /dev/null +++ b/examples/Java/JUnitTest/build.xml @@ -0,0 +1,46 @@ + + + simple example build file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/Java/JUnitTest/src/my/pack/MyClass.java b/examples/Java/JUnitTest/src/my/pack/MyClass.java new file mode 100644 index 00000000..4da935c0 --- /dev/null +++ b/examples/Java/JUnitTest/src/my/pack/MyClass.java @@ -0,0 +1,7 @@ +package my.pack; + +public class MyClass { + boolean returnTrue() { + return false; + } +} diff --git a/examples/Java/JUnitTest/src/my/pack/OtherClass.java b/examples/Java/JUnitTest/src/my/pack/OtherClass.java new file mode 100644 index 00000000..d9063bf5 --- /dev/null +++ b/examples/Java/JUnitTest/src/my/pack/OtherClass.java @@ -0,0 +1,7 @@ +package my.pack; + +public class OtherClass { + int returnThree() { + return 3; + } +} diff --git a/examples/Java/JUnitTest/test/my/AllTests.java b/examples/Java/JUnitTest/test/my/AllTests.java new file mode 100644 index 00000000..6c5732ac --- /dev/null +++ b/examples/Java/JUnitTest/test/my/AllTests.java @@ -0,0 +1,11 @@ +package my; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ my.pack.AllTests.class }) +public class AllTests { + +} diff --git a/examples/Java/JUnitTest/test/my/pack/AllTests.java b/examples/Java/JUnitTest/test/my/pack/AllTests.java new file mode 100644 index 00000000..6fa6afe9 --- /dev/null +++ b/examples/Java/JUnitTest/test/my/pack/AllTests.java @@ -0,0 +1,11 @@ +package my.pack; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ MyClassTest.class, OtherClassTest.class }) +public class AllTests { + +} diff --git a/examples/Java/JUnitTest/test/my/pack/MyClassTest.java b/examples/Java/JUnitTest/test/my/pack/MyClassTest.java new file mode 100644 index 00000000..d1b3dc51 --- /dev/null +++ b/examples/Java/JUnitTest/test/my/pack/MyClassTest.java @@ -0,0 +1,14 @@ +package my.pack; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MyClassTest { + + @Test + public void testReturnTrue() { + assertTrue(new MyClass().returnTrue()); + } + +} diff --git a/examples/Java/JUnitTest/test/my/pack/OtherClassTest.java b/examples/Java/JUnitTest/test/my/pack/OtherClassTest.java new file mode 100644 index 00000000..873edc68 --- /dev/null +++ b/examples/Java/JUnitTest/test/my/pack/OtherClassTest.java @@ -0,0 +1,14 @@ +package my.pack; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class OtherClassTest { + + @Test + public void testReturnThree() { + assertEquals(3, new OtherClass().returnThree()); + } + +}