Package samples.expectnew

Examples of samples.expectnew.ExpectNewWithMultipleCtorDemo


        assertEquals("HelloHello", actual);
    }

    @Test
    public void whenNewAnyArgumentsWorksInClassesWithMultipleCtors() throws Exception {
        ExpectNewWithMultipleCtorDemo mock1 = mock(ExpectNewWithMultipleCtorDemo.class);
        Service mock2 = mock(Service.class);

        whenNew(ExpectNewWithMultipleCtorDemo.class).withAnyArguments().thenReturn(mock1);
        when(mock1.useService()).thenReturn("message");

        // When
        final String message1 = new ExpectNewWithMultipleCtorDemo(mock2).useService();
        final String message2 = new ExpectNewWithMultipleCtorDemo(mock2, 5).useService();


        assertEquals(message1, "message");
        assertEquals(message2, "message");
    }
View Full Code Here

TOP

Related Classes of samples.expectnew.ExpectNewWithMultipleCtorDemo

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.