#765 fix PinpointJUnit4ClassRunner to work with the updated junit

This commit is contained in:
HyunGil Jeong
2015-07-30 14:37:06 +09:00
parent b5f10c20ad
commit 09dfe0b9aa
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -563,7 +563,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8</version>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
@@ -74,8 +74,8 @@ public final class PinpointJUnit4ClassRunner extends BlockJUnit4ClassRunner {
// Replace test target with a class loaded by TestClassLoader
// Cannot override getTestClass() which is used to get test class by JUnit because it's final.
try {
// PinpointJunit4ClassRunner -> BlockJUnit4ClassRunner -> ParentRunner.fTestClass
Field testClassField = this.getClass().getSuperclass().getSuperclass().getDeclaredField("fTestClass");
// PinpointJunit4ClassRunner -> BlockJUnit4ClassRunner -> ParentRunner.testClass
Field testClassField = this.getClass().getSuperclass().getSuperclass().getDeclaredField("testClass");
testClassField.setAccessible(true);
testClassField.set(this, this.testContext.getTestClass());
} catch (Exception e) {