-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failing test to describe general issue behind coverage bugs - child classes are initialized after their parents, so coverage probe is not initialized when parent refers to child in a static initializer block.
- Loading branch information
Showing
2 changed files
with
55 additions
and
32 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
.../test/java/com/example/coverage/execute/samples/simple/ParentChildInitializationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.example.coverage.execute.samples.simple; | ||
|
||
import org.junit.Test; | ||
|
||
public class ParentChildInitializationTest { | ||
@Test | ||
public void test() { | ||
new TesteeChild(); | ||
} | ||
} | ||
|
||
class TesteeParent { | ||
static TesteeChild child = new TesteeChild(); | ||
} | ||
|
||
class TesteeChild extends TesteeParent { | ||
final static Object f = "hello"; | ||
|
||
TesteeChild() { | ||
System.out.println(f); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters