Examples of ConstructorArgs


Examples of org.easymock.ConstructorArgs

    }

    @SuppressWarnings("deprecation")
    @Test
    public void testInterfaceForbidden_PartialMock() throws Exception {
        final ConstructorArgs args = new ConstructorArgs(ArrayList.class.getConstructor(Integer.TYPE), 6);
        final Method[] methods = new Method[] { List.class.getMethod("size", new Class[0]) };

        final IMocksControl ctrl = createControl();

        try {
View Full Code Here

Examples of org.easymock.ConstructorArgs

        builder.withConstructor(int.class).withConstructor(int.class);
    }

    @Test
    public void testWithConstructorConstructorArgs() throws NoSuchMethodException {
        final ConstructorArgs args = new ConstructorArgs(ArrayList.class.getConstructor(int.class), Integer
                .valueOf(-3));
        builder.withConstructor(args);
        try {
            builder.createMock();
            fail("instantiation should fail because of negative");
View Full Code Here

Examples of org.easymock.ConstructorArgs

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

Examples of org.easymock.ConstructorArgs

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

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

Examples of org.easymock.ConstructorArgs

     *            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

Examples of org.easymock.ConstructorArgs

     *            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

Examples of org.easymock.ConstructorArgs

     *            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

Examples of org.easymock.ConstructorArgs

     *            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

Examples of org.easymock.ConstructorArgs

     *            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
TOP
Copyright © 2018 www.massapi.com. 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.