Examples of ConstructorArgs


Examples of org.easymock.ConstructorArgs

        new ConstructorArgs(A.class.getConstructors()[0], null, 2);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testConstructorArgs_WrongPrimitive() {
        new ConstructorArgs(A.class.getConstructors()[0], "a", 2.0f);
    }
View Full Code Here

Examples of org.easymock.ConstructorArgs

        new ConstructorArgs(A.class.getConstructors()[0], "a", 2.0f);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testConstructorArgs_WrongNumberOfArgs() {
        new ConstructorArgs(A.class.getConstructors()[0], "a");
    }
View Full Code Here

Examples of org.easymock.ConstructorArgs

        new ConstructorArgs(A.class.getConstructors()[0], "a");
    }

    @Test(expected = IllegalArgumentException.class)
    public void testConstructorArgs_TypeExistsButPrivate() {
        new ConstructorArgs(A.class.getConstructors()[0], "a", new A(null, 1));
    }
View Full Code Here

Examples of org.easymock.ConstructorArgs

        new ConstructorArgs(A.class.getConstructors()[0], "a", new A(null, 1));
    }

    @Test(expected = IllegalArgumentException.class)
    public void testConstructorArgs_TypeExistsButNotStatic() {
        new ConstructorArgs(A.class.getConstructors()[0], "a", new ConstructorArgsTest());
    }
View Full Code Here

Examples of org.easymock.ConstructorArgs

    private ConstructorArgs args;

    @Before
    public void setUp() throws Exception {
        foo = ToMock.class.getMethod("foo");
        args = new ConstructorArgs(ToMock.class.getConstructor());
    }
View Full Code Here

Examples of org.easymock.ConstructorArgs

    }

    @Test(expected = RuntimeException.class)
    public void testPartialMock_ConstructorNotFound() throws Exception {
        final Constructor<?> cstr = ArrayList.class.getConstructor(Integer.TYPE);
        final ConstructorArgs constructorArgs = new ConstructorArgs(cstr, 2.0);
        try {
            createMockBuilder(ArrayList.class).withConstructor(Integer.TYPE).withArgs(2.0).createMock();
        } catch (final RuntimeException e) {
            assertEquals("Failed to find constructor for param types", e.getMessage());
            throw e;
View Full Code Here

Examples of org.easymock.ConstructorArgs

    }

    @Test(expected = IllegalArgumentException.class)
    public void testPartialMock_InvalidParams() throws Exception {
        final Constructor<?> cstr = ArrayList.class.getConstructor(Integer.TYPE);
        final ConstructorArgs constructorArgs = new ConstructorArgs(cstr, "test");
        createMockBuilder(ArrayList.class).withConstructor(Integer.TYPE).withArgs("test");
    }
View Full Code Here

Examples of org.easymock.ConstructorArgs

    }

    @Test(expected = RuntimeException.class)
    public void testPartialMock_ExceptionInConstructor() throws Exception {
        final Constructor<?> cstr = ArrayList.class.getConstructor(Integer.TYPE);
        final ConstructorArgs constructorArgs = new ConstructorArgs(cstr, -5);
        try {
            createMockBuilder(ArrayList.class).withConstructor(-5).createMock();
        } catch (final RuntimeException e) {
            assertEquals("Failed to instantiate mock calling constructor: Exception in constructor", e
                    .getMessage());
View Full Code Here

Examples of org.easymock.ConstructorArgs

    @SuppressWarnings("deprecation")
    @Test
    public void testMocksControl_PartialMock_ConstructorCalled() throws Exception {
        final IMocksControl ctrl = createControl();

        final ConstructorArgs args = new ConstructorArgs(A.class.getConstructor(Integer.TYPE), 6);

        final A a = ctrl.createMock(A.class, args, A.class.getMethod("bar", new Class[0]), A.class.getMethod(
                "toString", new Class[0]));

        assertEquals("Constructor called so should be initialized", 6, a.i);
View Full Code Here

Examples of org.easymock.ConstructorArgs

    @SuppressWarnings("deprecation")
    @Test
    public void testMocksControl_NamedPartialMock_ConstructorCalled() throws Exception {
        final IMocksControl ctrl = createControl();

        final ConstructorArgs args = new ConstructorArgs(A.class.getConstructor(Integer.TYPE), 6);

        final A a = ctrl.createMock("myMock", A.class, args, A.class.getMethod("bar", new Class[0]), A.class
                .getMethod("toString", new Class[0]));

        assertEquals("Constructor called so should be initialized", 6, a.i);
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.