aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2018-08-02 21:56:26 +0200
committerEvgeny Mandrikov <Godin@users.noreply.github.com>2018-08-02 21:56:26 +0200
commitb2c5ff73d24cc0c57f308f046de008568068b4c8 (patch)
treeede5f93173e1a7f9fc7fe8300b2ba94040a8a46c /org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java
parent65d1aea1bd0f85f8be9bbc5076b7191515fe5f39 (diff)
downloadjacoco-b2c5ff73d24cc0c57f308f046de008568068b4c8.tar.gz
Reorganize validation test packages (#716)
* Use module names as package names * Merge previously separate filter validation tests * Move non-version specific tests to org.jacoco.core.test
Diffstat (limited to 'org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java')
-rw-r--r--org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java
new file mode 100644
index 00000000..b9f0a469
--- /dev/null
+++ b/org.jacoco.core.test.validation.java8/src/org/jacoco/core/test/validation/java8/BadCycleInterfaceTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2018 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:
+ * Evgeny Mandrikov - initial API and implementation
+ *
+ *******************************************************************************/
+package org.jacoco.core.test.validation.java8;
+
+import org.jacoco.core.analysis.ICounter;
+import org.jacoco.core.test.validation.ValidationTestBase;
+import org.jacoco.core.test.validation.java8.targets.BadCycleInterfaceTarget;
+import org.junit.Test;
+
+/**
+ * Test of "bad cycles" with interfaces.
+ */
+public class BadCycleInterfaceTest extends ValidationTestBase {
+
+ public BadCycleInterfaceTest() throws Exception {
+ super(BadCycleInterfaceTarget.class);
+ }
+
+ @Test
+ public void test() throws Exception {
+ if (JAVA_VERSION.isBefore("1.8.0_152")) {
+ // Incorrect interpetation of JVMS 5.5 in JDK 8 causes a default
+ // method to be called before the static initializer of an interface
+ // (see JDK-8098557 and JDK-8164302):
+ assertLine("baseclinit", ICounter.FULLY_COVERED);
+ assertLine("childdefault", ICounter.FULLY_COVERED);
+
+ assertLogEvents("baseclinit", "childdefaultmethod", "childclinit",
+ "childstaticmethod");
+ } else {
+ // This shouldn't happen with JDK 9 (see also JDK-8043275)
+ // and starting with JDK 8u152 (see JDK-8167607):
+ assertLine("baseclinit", ICounter.EMPTY);
+ assertLine("childdefault", ICounter.NOT_COVERED);
+ assertLogEvents("childclinit", "childstaticmethod");
+ }
+ assertLine("childclinit", ICounter.FULLY_COVERED);
+ assertLine("childstatic", ICounter.FULLY_COVERED);
+ }
+
+}