diff --git a/test/java/foundation/pEp/jniadapter/test/framework/examples/testsuite/Makefile b/test/java/foundation/pEp/jniadapter/test/framework/examples/testsuite/Makefile new file mode 100644 index 0000000..326b17b --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/framework/examples/testsuite/Makefile @@ -0,0 +1,25 @@ +include ../Makefile.conf + +TEST_UNIT_NAME=testsuite + +JAVA_CLASSES = \ + TestMain.class \ + +# Use the test framework +JAVA_CLASSES += $(JAVA_CLASSES_FRAMEWORK) + +.PHONY: compile run test clean + +all: compile + $(MAKE) run + +run: compile + cd $(JAVA_CWD);$(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestMain + +compile: $(JAVA_CLASSES) + +%.class: %.java + cd $(JAVA_CWD);pwd;javac $(JAVA_PKG_BASEPATH)/$(TEST_UNIT_NAME)/$< + +clean: + rm -f $(JAVA_CLASSES) diff --git a/test/java/foundation/pEp/jniadapter/test/framework/examples/testsuite/TestMain.java b/test/java/foundation/pEp/jniadapter/test/framework/examples/testsuite/TestMain.java new file mode 100644 index 0000000..80cc074 --- /dev/null +++ b/test/java/foundation/pEp/jniadapter/test/framework/examples/testsuite/TestMain.java @@ -0,0 +1,34 @@ +package foundation.pEp.jniadapter.test.framework.examples.testsuite; +import static foundation.pEp.jniadapter.test.framework.TestLogger.*; +import foundation.pEp.jniadapter.test.framework.*; + +class TestSuiteTestContext extends AbstractTestContext { + String name; + + @Override + public void init() throws Throwable { + name = "UnitTestFrameWorkWithoutAName"; + } +} + +class TestMain { + public static void main(String[] args) throws Exception { + TestSuite.setVerbose(true); + + new TestUnit("Unit Test 1", new TestSuiteTestContext(), ctx -> { + log("Unit Test 1 " + ctx.name); + ctx.name = "new name"; + }).add(); + + new TestUnit("Unit Test 2", new TestSuiteTestContext(), ctx -> { + log("Unit Test 2 " + ctx.name); + }).add(); + + new TestUnit("Unit Test 3", new TestSuiteTestContext(), ctx -> { + log("Unit Test 3 Failing " + ctx.name); + int x = 4 / 0; + }).add(); + + TestSuite.run(); + } +} \ No newline at end of file