rafael81 / powermock

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

PowerMock is not finding all inherited methods on ArrayList #512

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
public static void main(String[] args) {

        List<String> test = new ArrayList<String>();
        Method[] methods = WhiteboxImpl.getAllMethods(ArrayList.class);
        for(int i = 0; i < methods.length; i++) {

            if(methods[i].getName().equals("stream")) {
                System.out.println("Stream method found with whitebox");
            }
        }

        Class obj = test.getClass();
        Method[] reflectMethods = obj.getMethods();
        for(int i = 0; i < reflectMethods.length; i++) {

            if(reflectMethods[i].getName().equals("stream")) {
                System.out.println("Stream method found with regular reflect");
            }
        }
    }

What is the expected output? What do you see instead?
I expect both for loops to print their messages.

What version of the product are you using? On what operating system?
PowerMock 1.5.5 on windows 7 64bit

Please provide any additional information below.
The code example above is breaking the problem down to where I could see the 
problem originating. Our code uses the stream() method on an array list to do 
some filtering, the test is a simple test that doesn't specifically mock the 
array list, the class is in the prepare for test annotation (to support some of 
the other tests).

We are trying to update our code from JDK 7 to 8 and can't run our unit tests 
when we try to use some of the new JDK8 features like streams.

Original issue reported on code.google.com by hard...@gmail.com on 12 Aug 2014 at 10:59

GoogleCodeExporter commented 9 years ago
I think this is urgent since we can't seem to run any tests that use the new 
JDK 8 features. 
If this isn't an issue please let me know how to fix our test so they will run.

Original comment by hard...@gmail.com on 12 Aug 2014 at 11:02

GoogleCodeExporter commented 9 years ago
I've submitted a patch/pull request: https://github.com/jayway/powermock/pull/3

Original comment by brad.sta...@gmail.com on 13 Aug 2014 at 5:16

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 28 Aug 2014 at 11:28