aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test/src/org/jacoco/core/runtime
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2010-10-05 14:00:50 +0000
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2010-10-05 14:00:50 +0000
commita8b8da9c048c4b1c7b6120520764b4f0063de521 (patch)
tree38a6b6bf4b9f9500e3855bcacd5f353dd150251b /org.jacoco.core.test/src/org/jacoco/core/runtime
parent1b885c7bc666c215c3947ad4d12099273a5f533f (diff)
downloadjacoco-a8b8da9c048c4b1c7b6120520764b4f0063de521.tar.gz
Another IRuntime alternative based on a custom URLStreamHandler.
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core/runtime')
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java14
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/runtime/URLStreamHandlerRuntimeTest.java27
2 files changed, 35 insertions, 6 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java b/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java
index e65b2c32..195fec43 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/runtime/RuntimeTestBase.java
@@ -114,7 +114,7 @@ public abstract class RuntimeTestBase {
}
@Test
- public void testSessionInfo() {
+ public void testSessionInfo() throws Exception {
final SessionInfo[] info = new SessionInfo[1];
final ISessionInfoVisitor visitor = new ISessionInfoVisitor() {
public void visitSessionInfo(SessionInfo i) {
@@ -123,19 +123,21 @@ public abstract class RuntimeTestBase {
};
runtime.setSessionId("test-session");
final long t1 = System.currentTimeMillis();
+ runtime.startup();
runtime.collect(storage, visitor, true);
+ final long t2 = System.currentTimeMillis();
assertNotNull(info[0]);
assertEquals("test-session", info[0].getId());
- assertTrue(info[0].getStartTimeStamp() <= t1);
- assertTrue(info[0].getDumpTimeStamp() >= t1);
+ assertTrue(info[0].getStartTimeStamp() >= t1);
+ assertTrue(info[0].getDumpTimeStamp() <= t2);
info[0] = null;
- final long t2 = System.currentTimeMillis();
runtime.collect(storage, visitor, true);
+ final long t3 = System.currentTimeMillis();
assertNotNull(info[0]);
assertEquals("test-session", info[0].getId());
- assertTrue(info[0].getStartTimeStamp() >= t1);
- assertTrue(info[0].getDumpTimeStamp() >= t2);
+ assertTrue(info[0].getStartTimeStamp() >= t2);
+ assertTrue(info[0].getDumpTimeStamp() <= t3);
}
@Test
diff --git a/org.jacoco.core.test/src/org/jacoco/core/runtime/URLStreamHandlerRuntimeTest.java b/org.jacoco.core.test/src/org/jacoco/core/runtime/URLStreamHandlerRuntimeTest.java
new file mode 100644
index 00000000..e5cfb3d8
--- /dev/null
+++ b/org.jacoco.core.test/src/org/jacoco/core/runtime/URLStreamHandlerRuntimeTest.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Mountainminds GmbH & Co. KG and Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.runtime;
+
+/**
+ * Unit tests for {@link URLStreamHandlerRuntime}.
+ *
+ * @author Marc R. Hoffmann
+ * @version $qualified.bundle.version$
+ */
+public class URLStreamHandlerRuntimeTest extends RuntimeTestBase {
+
+ @Override
+ IRuntime createRuntime() {
+ return new URLStreamHandlerRuntime();
+ }
+
+}