Package org.jmock

Examples of org.jmock.Mock.stubs()


                return getDocument(
                    localEntityReferenceSerializer.serialize((EntityReference) invocation.parameterValues.get(0)))
                    .getXClass();
            }
        });
        mockXWiki.stubs().method("search").will(returnValue(Collections.EMPTY_LIST));

        this.userClass.setName(USER_XCLASS);
        this.userClass.addTextField("first_name", "First Name", 30);
        this.userClass.addTextField("last_name", "Last Name", 30);
        this.userClass.addTextField("email", "e-Mail", 30);
View Full Code Here


        this.userClass.addTextField("last_name", "Last Name", 30);
        this.userClass.addTextField("email", "e-Mail", 30);
        this.userClass.addPasswordField("password", "Password", 10);
        this.userClass.addTextField("customproperty", "Custom property", 10);

        mockXWiki.stubs().method("getUserClass").will(returnValue(this.userClass));

        this.groupClass.setName(GROUP_XCLASS);
        this.groupClass.addTextField("member", "Member", 30);

        mockXWiki.stubs().method("getGroupClass").will(returnValue(this.groupClass));
View Full Code Here

        mockXWiki.stubs().method("getUserClass").will(returnValue(this.userClass));

        this.groupClass.setName(GROUP_XCLASS);
        this.groupClass.addTextField("member", "Member", 30);

        mockXWiki.stubs().method("getGroupClass").will(returnValue(this.groupClass));

        mockXWiki.stubs().method("createUser").will(new CustomStub("Implements XWiki.createUser")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
View Full Code Here

        this.groupClass.setName(GROUP_XCLASS);
        this.groupClass.addTextField("member", "Member", 30);

        mockXWiki.stubs().method("getGroupClass").will(returnValue(this.groupClass));

        mockXWiki.stubs().method("createUser").will(new CustomStub("Implements XWiki.createUser")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
                XWikiDocument document = new XWikiDocument();
                document.setFullName("XWiki." + invocation.parameterValues.get(0));
View Full Code Here

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

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

        PortletMode mode = PortletMode.VIEW;

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

   */
  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");
View Full Code Here

  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

  protected Mock createMockUIComponent()
  {
    // the BreadCrumbs is allowed to call getId and setId on its child
    Mock mock = super.createMockUIComponent();
   
    mock.stubs().method("getId");
    mock.stubs().method("setId");
       
    return mock;
  }
}
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.