Package org.jmock

Examples of org.jmock.Mock.stubs()


  protected Mock createMockUIComponent()
  {
    Mock mock = mock(UIComponent.class);

    mock.stubs().method("getParent").will(returnValue(null));
    mock.stubs().method("setParent");
    mock.stubs().method("getFacetsAndChildren").will(returnIterator(Collections.emptyList()));

    mock.expects(never()).method("processRestoreState");
    mock.expects(never()).method("processDecodes");
    mock.expects(never()).method("processValidators");
View Full Code Here


  {
    Mock mock = mock(UIComponent.class);

    mock.stubs().method("getParent").will(returnValue(null));
    mock.stubs().method("setParent");
    mock.stubs().method("getFacetsAndChildren").will(returnIterator(Collections.emptyList()));

    mock.expects(never()).method("processRestoreState");
    mock.expects(never()).method("processDecodes");
    mock.expects(never()).method("processValidators");
    mock.expects(never()).method("processUpdates");
View Full Code Here

        Constraint[] params = new Constraint[]{eq(PortletActionConstants.ACTION_PARAM), eq("freemarkerDirect")};
        mockResponse.expects(once()).method("setRenderParameter").with(params);
        params = new Constraint[]{eq(PortletActionConstants.MODE_PARAM), eq(PortletMode.VIEW.toString())};
        mockResponse.expects(once()).method("setRenderParameter").with(params);
        mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW));
        mockProxy.stubs().method("getNamespace").will(returnValue(""));

        mockInvocation.stubs().method("getProxy").will(returnValue(mockProxy.proxy()));

        ActionContext ctx = ActionContext.getContext();
View Full Code Here

    assertEquals("input", mapping.getMethod());
  }

  public void testRender_ok() throws Exception {
    final Mock mockResponse = mock(RenderResponse.class);
    mockResponse.stubs().method(ANYTHING);

    PortletMode mode = PortletMode.VIEW;

    Map<String, String[]> requestParams = new HashMap<String, String[]>();
    requestParams.put(PortletActionConstants.ACTION_PARAM, new String[] { "/view/testAction" });
View Full Code Here

        }
  }

  public void testModeChangeUsingPortletWidgets() throws Exception {
    final Mock mockResponse = mock(RenderResponse.class);
    mockResponse.stubs().method(ANYTHING);
    PortletMode mode = PortletMode.EDIT;

    Map<String, String[]> requestParams = new HashMap<String, String[]>();
    requestParams.put(PortletActionConstants.ACTION_PARAM, new String[] { "/view/testAction" });
    requestParams.put(EVENT_ACTION, new String[] { "false" });
View Full Code Here

                return it.next();
            }

        };

        mockRequest.stubs().method("getAttributeNames").will(returnValue(names));
        mockRequest.stubs().method("getAttribute").with(eq("key1")).will(returnValue("value1"));
        mockRequest.stubs().method("getAttribute").with(eq("key2")).will(returnValue("value2"));

        PortletRequestMap map = new PortletRequestMap(req);
        Set entries = map.entrySet();
View Full Code Here

            }

        };

        mockRequest.stubs().method("getAttributeNames").will(returnValue(names));
        mockRequest.stubs().method("getAttribute").with(eq("key1")).will(returnValue("value1"));
        mockRequest.stubs().method("getAttribute").with(eq("key2")).will(returnValue("value2"));

        PortletRequestMap map = new PortletRequestMap(req);
        Set entries = map.entrySet();
View Full Code Here

        };

        mockRequest.stubs().method("getAttributeNames").will(returnValue(names));
        mockRequest.stubs().method("getAttribute").with(eq("key1")).will(returnValue("value1"));
        mockRequest.stubs().method("getAttribute").with(eq("key2")).will(returnValue("value2"));

        PortletRequestMap map = new PortletRequestMap(req);
        Set entries = map.entrySet();

        assertEquals(2, entries.size());
View Full Code Here

    }

    public void testRender_ok() {
        final Mock mockResponse = mock(RenderResponse.class);
        mockResponse.stubs().method(ANYTHING);

        PortletMode mode = PortletMode.VIEW;

        Map requestParams = new HashMap();
        requestParams.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"});
View Full Code Here

        }
    }

    public void testModeChangeUsingPortletWidgets() {
        final Mock mockResponse = mock(RenderResponse.class);
        mockResponse.stubs().method(ANYTHING);
        PortletMode mode = PortletMode.EDIT;

        Map requestParams = new HashMap();
        requestParams.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"});
        requestParams.put(EVENT_ACTION, new String[]{"false"});
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.