diff options
author | Sven Gothel <[email protected]> | 2012-03-07 03:26:10 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-07 03:26:10 +0100 |
commit | 5a68344ea254e70d88c754a011fd06d2bb87aaa7 (patch) | |
tree | 281d3358476cfe892cc46ad836e06c4f1487537c /src/junit | |
parent | 67a89a1d9ff17c4d6815e21502c55bf533b62416 (diff) |
android test: Specify 'java.io.tempdir' and add TestJarsInJar.apk / Disable most of tests in TestJarUtil
Diffstat (limited to 'src/junit')
-rw-r--r-- | src/junit/com/jogamp/common/util/TestJarUtil.java | 6 | ||||
-rw-r--r-- | src/junit/com/jogamp/junit/util/JunitTracer.java | 26 |
2 files changed, 26 insertions, 6 deletions
diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java index caaac9c..ea6cebf 100644 --- a/src/junit/com/jogamp/common/util/TestJarUtil.java +++ b/src/junit/com/jogamp/common/util/TestJarUtil.java @@ -43,6 +43,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.GlueGenVersion; +import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.util.cache.TempCacheReg; import com.jogamp.common.util.cache.TempFileCache; import com.jogamp.common.util.cache.TempJarCache; @@ -53,6 +54,11 @@ public class TestJarUtil extends JunitTracer { @BeforeClass public static void init() { + if(AndroidVersion.isAvailable) { + // ClassLoader -> JarURL doesn't work w/ Dalvik + setTestSupported(false); + // we allow basic TempFileCache initialization (test) .. + } // may already been initialized by other test // Assert.assertFalse(TempCacheReg.isTempFileCacheUsed()); Assert.assertTrue(TempFileCache.initSingleton()); diff --git a/src/junit/com/jogamp/junit/util/JunitTracer.java b/src/junit/com/jogamp/junit/util/JunitTracer.java index c175601..befc2ad 100644 --- a/src/junit/com/jogamp/junit/util/JunitTracer.java +++ b/src/junit/com/jogamp/junit/util/JunitTracer.java @@ -28,6 +28,7 @@ package com.jogamp.junit.util; +import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.After; @@ -39,16 +40,23 @@ import org.junit.rules.TestName; public abstract class JunitTracer { @Rule public TestName _unitTestName = new TestName(); + static volatile boolean testSupported = true; + + public static void setTestSupported(boolean v) { + System.err.println("setTestSupported: "+v); + testSupported = v; + } + public final String getTestMethodName() { return _unitTestName.getMethodName(); } - public final String getSimpleTestName() { - return getClass().getSimpleName()+" - "+getTestMethodName(); + public final String getSimpleTestName(String separator) { + return getClass().getSimpleName()+separator+getTestMethodName(); } - public final String getFullTestName() { - return getClass().getName()+" - "+getTestMethodName(); + public final String getFullTestName(String separator) { + return getClass().getName()+separator+getTestMethodName(); } @BeforeClass @@ -64,13 +72,19 @@ public abstract class JunitTracer { @Before public void setUp() { - System.err.println("++++ TestCase.setUp: "+getFullTestName()); + System.err.print("++++ TestCase.setUp: "+getFullTestName(" - ")); + if(!testSupported) { + System.err.println(" - "+unsupportedTestMsg); + Assume.assumeTrue(testSupported); + } + System.err.println(); } @After public void tearDown() { - System.err.println("++++ TestCase.tearDown: "+getFullTestName()); + System.err.println("++++ TestCase.tearDown: "+getFullTestName(" - ")); } + static final String unsupportedTestMsg = "Test not supported on this platform."; } |