bsugitayasa / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 0 forks source link

Fix in PowerMockMockito 1.6.1 doesn't work for junit 4.12 as version id is 4.12-SNAPSHOT #540

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. If you use PowerMock with junit 4.12 it will throw a 
org.powermock.reflect.exceptions.FieldNotFoundException  when the test is 
starting

What is the expected output? What do you see instead?
PowerMock 1.6.1

What version of the product are you using? On what operating system?

Please provide any additional information below.
In https://github.com/junit-team/junit/releases, the version is 4.12-SNAPSHOT. 
Hence the fix 
static {
        if(JUnitVersion.isGreaterThanOrEqualTo("4.12")) {
            TEST_CLASS_FIELD = "testClass";
            CLASS_UNDER_TEST_FIELD = "klass";
            ERRORS_FIELD = "errors";
        }
        else {
            TEST_CLASS_FIELD = "fTestClass";
            CLASS_UNDER_TEST_FIELD = "fClass";
            ERRORS_FIELD = "fErrors";
        }
    }
doesn't apply to this version as JUnitVersion.isGreaterThanOrEqualTo("4.12") 
gives false in this case.

Hence it still throws Field 'fTestClass' was not found in class 
org.junit.internal.runners.MethodValidator exception as mentioned in 
https://code.google.com/p/powermock/issues/detail?can=2&start=0&num=100&q=&colsp
ec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id
=531

Original issue reported on code.google.com by reshm...@gmail.com on 11 Feb 2015 at 3:02