public static synchronized < T > T createNicePartialMockForAllMethodsExcept ( Class < T > type , String methodNameToExclude , Class < ? > firstArgumentType , Class < ? > ... moreTypes ) { /* * The reason why we've split the first and "additional types" is * because it should not intervene with the mockAllExcept(type, * String...methodNames) method. */ final Class < ? > [ ] argumentTypes = mergeArgumentTypes ( firstArgumentType , moreTypes ) ; return createNiceMock ( type , WhiteboxImpl . getAllMethodsExcept ( type , methodNameToExclude , argumentTypes ) ) ; }
Mock all methods of a class except for a specific one nicely . Use this method only if you have several overloaded methods .