public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName,
                                                                        Class<?> where, Class<?>[] parameterTypes, Object... arguments) throws Exception {
        if (instance == null) {
            throw new IllegalArgumentException("Instance or class to expect cannot be null.");
        }
        Method[] methods = null;
        if (methodName != null) {
            if (parameterTypes == null) {
                methods = Whitebox.getMethods(where, methodName);
            } else {
                methods = new Method[]{Whitebox.getMethod(where, methodName, parameterTypes)};
            }
        }
        Method methodToExpect;
        if (methods != null && methods.length == 1) {
            methodToExpect = methods[0];
        } else {
            methodToExpect = WhiteboxImpl.findMethodOrThrowException(instance, null, methodName, arguments);
        }

        return doExpectPrivate(instance, methodToExpect, arguments);
    }
public static synchronized < T > IExpectationSetters < T > expectPrivate ( Object instance , String methodName , Class < ? > where , Class < ? > [ ] parameterTypes , Object ... arguments ) throws Exception { if ( instance == null ) { throw new IllegalArgumentException ( "Instance or class to expect cannot be null." ) ; } Method [ ] methods = null ; if ( methodName != null ) { if ( parameterTypes == null ) { methods = Whitebox . getMethods ( where , methodName ) ; } else { methods = new Method [ ] { Whitebox . getMethod ( where , methodName , parameterTypes ) } ; } } Method methodToExpect ; if ( methods != null && methods . length == 1 ) { methodToExpect = methods [ 0 ] ; } else { methodToExpect = WhiteboxImpl . findMethodOrThrowException ( instance , null , methodName , arguments ) ; } return doExpectPrivate ( instance , methodToExpect , arguments ) ; }
Used to specify expectations on methods using the method name at a
specific place in the class hierarchy (specified by the
{@code where} parameter). Works on for example private or package
private methods.
<p/>
Use this for overloaded methods.