Package org.apache.deltaspike.test.testcontrol.mock.shared

Examples of org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean


    private DynamicMockManager mockManager;

    @Test
    public void manualMock1()
    {
        mockManager.addMock(new RequestScopedBean()
        {
            @Override
            public int getCount()
            {
                return 7;
View Full Code Here


    }

    @Test
    public void manualMock2() //same test with different mock
    {
        mockManager.addMock(new RequestScopedBean()
        {
            @Override
            public int getCount()
            {
                return 14;
View Full Code Here

    private DynamicMockManager mockManager;

    @Test
    public void mockitoMock1()
    {
        RequestScopedBean mockedRequestScopedBean = mock(RequestScopedBean.class);
        when(mockedRequestScopedBean.getCount()).thenReturn(7);
        mockManager.addMock(mockedRequestScopedBean);

        Assert.assertEquals(7, requestScopedBean.getCount());
        requestScopedBean.increaseCount();
        Assert.assertEquals(7, requestScopedBean.getCount());
View Full Code Here

    }

    @Test
    public void mockitoMock2() //same test with different mock
    {
        RequestScopedBean mockedRequestScopedBean = mock(RequestScopedBean.class);
        when(mockedRequestScopedBean.getCount()).thenReturn(14);
        mockManager.addMock(mockedRequestScopedBean);

        Assert.assertEquals(14, requestScopedBean.getCount());
        requestScopedBean.increaseCount();
        Assert.assertEquals(14, requestScopedBean.getCount());
View Full Code Here

    {
        SessionScopedBean mockedSessionScopedBean = mock(SessionScopedBean.class);
        when(mockedSessionScopedBean.getCount()).thenReturn(7);
        mockManager.addMock(mockedSessionScopedBean);

        RequestScopedBean mockedRequestScopedBean = new MockedRequestScopedBeanWithInjection();
        BeanProvider.injectFields(mockedRequestScopedBean);
        mockManager.addMock(mockedRequestScopedBean);

        Assert.assertEquals(7, requestScopedBean.getCount());
        requestScopedBean.increaseCount(); //not delegated
View Full Code Here

    {
        SessionScopedBean mockedSessionScopedBean = mock(SessionScopedBean.class);
        when(mockedSessionScopedBean.getCount()).thenReturn(14);
        mockManager.addMock(mockedSessionScopedBean);

        RequestScopedBean mockedRequestScopedBean = new MockedRequestScopedBeanWithInjection();
        BeanProvider.injectFields(mockedRequestScopedBean);
        mockManager.addMock(mockedRequestScopedBean);

        Assert.assertEquals(14, requestScopedBean.getCount());
        requestScopedBean.increaseCount(); //not delegated
View Full Code Here

    private DynamicMockManager mockManager;

    @Test
    public void manualMockWithInjection()
    {
        RequestScopedBean mockedRequestScopedBean = new MockedRequestScopedBeanWithInjection();
        BeanProvider.injectFields(mockedRequestScopedBean);
        mockManager.addMock(mockedRequestScopedBean);

        Assert.assertEquals(0, requestScopedBean.getCount());
        requestScopedBean.increaseCount(); //not delegated
View Full Code Here

TOP

Related Classes of org.apache.deltaspike.test.testcontrol.mock.shared.RequestScopedBean

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.