Package org.easymock

Examples of org.easymock.ConstructorArgs


     *            certain constructor.
     * @return the mock object.
     */
    public static <T> T createNiceMock(Class<T> type, Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMock(type, false, new NiceMockStrategy(), constructorArgs, (Method[]) null);
    }
View Full Code Here


     *            methods in that class will be mocked).
     * @return the mock object.
     */
    public static <T> T createPartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
            throws Exception {
        return createMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
                Whitebox.getMethods(type, methodNames));
    }
View Full Code Here

     *            methods in that class will be mocked).
     * @return the mock object.
     */
    public static <T> T createNicePartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
            throws Exception {
        return createNiceMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
                Whitebox.getMethods(type, methodNames));
    }
View Full Code Here

     *            methods in that class will be mocked).
     * @return the mock object.
     */
    public static <T> T createStrictPartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
            throws Exception {
        return createStrictMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
                Whitebox.getMethods(type, methodNames));
    }
View Full Code Here

     *            certain constructor. (optional)
     * @return the mock object.
     */
    public static <T> T createPartialMock(Class<T> type, String[] methodNames, Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMock(type, false, new DefaultMockStrategy(), constructorArgs, Whitebox.getMethods(type, methodNames));
    }
View Full Code Here

     *            certain constructor. (optional)
     * @return the mock object.
     */
    public static <T> T createStrictPartialMock(Class<T> type, String[] methodNames, Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMock(type, false, new StrictMockStrategy(), constructorArgs, Whitebox.getMethods(type, methodNames));
    }
View Full Code Here

     *            certain constructor. (optional)
     * @return the mock object.
     */
    public static <T> T createNicePartialMock(Class<T> type, String[] methodNames, Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMock(type, false, new NiceMockStrategy(), constructorArgs, Whitebox.getMethods(type, methodNames));
    }
View Full Code Here

     * @return the mock object.
     */
    public static <T> T createPartialMock(Class<T> type, String methodName, Class<?>[] methodParameterTypes,
                                          Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMockSpecific(type, new DefaultMockStrategy(), new String[] { methodName }, constructorArgs,
                methodParameterTypes);
    }
View Full Code Here

     * @return the mock object.
     */
    public static <T> T createStrictPartialMock(Class<T> type, String methodName, Class<?>[] methodParameterTypes,
                                                Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMockSpecific(type, new StrictMockStrategy(), new String[] { methodName }, constructorArgs,
                methodParameterTypes);
    }
View Full Code Here

     * @return the mock object.
     */
    public static <T> T createNicePartialMock(Class<T> type, String methodName, Class<?>[] methodParameterTypes,
                                              Object... constructorArguments) {
        Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
        ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
        return doMockSpecific(type, new NiceMockStrategy(), new String[] { methodName }, constructorArgs,
                methodParameterTypes);
    }
View Full Code Here

TOP

Related Classes of org.easymock.ConstructorArgs

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.