chcchangchc / powermock

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

add createStrictPartialMockForAllMethodsExcept(Class<T> type, Method... methods ) method in PowerMock class #303

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a suggestion.
After I try the PowerMock suite in a few days, I suggest that the PowerMock 
class can add two methods like below:
createStrictPartialMockForAllMethodsExcept(Class<T> type, Method... methods )
createPartialMockForAllMethodsExcept(Class<T> type, Method... methods )

The situation is like this: I have a class named AppaleList has lots of 
methods. The code is like this:
    public String getStr(int length, int width, String str) {
        return getStr(length, width);
    }

    private String getStr(int length, int width) {
        return "str";
    }
Now I want to mock the private getStr method and some other method which didn't 
list in the code, but I cann't use createPartialMockForAllMethodsExcept method 
because this method will mock the both public and private getStr method, So I 
have to find the other methods and use  the createMock(Class<T> type, Method... 
methods) method. It is a painful process.
Thank you.

Original issue reported on code.google.com by cndoublehero@gmail.com on 28 Dec 2010 at 10:49