Package org.jmock

Examples of org.jmock.Mock.stubs()


        Constraint[] params = new Constraint[]{eq(PortletActionConstants.ACTION_PARAM), eq("renderDirect")};
        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


    UIComponent component,
    String      facetName)
  {
    Mock mockFacetValue = mock(UIComponent.class);
    UIComponent facetValue = (UIComponent) mockFacetValue.proxy();
    mockFacetValue.stubs().method("getParent").will(returnValue(null));
    mockFacetValue.stubs().method("setParent");

    Mock mockPropValue = mock(UIComponent.class);
    UIComponent propValue = (UIComponent) mockPropValue.proxy();
    mockPropValue.stubs().method("getParent").will(returnValue(null));
View Full Code Here

    String      facetName)
  {
    Mock mockFacetValue = mock(UIComponent.class);
    UIComponent facetValue = (UIComponent) mockFacetValue.proxy();
    mockFacetValue.stubs().method("getParent").will(returnValue(null));
    mockFacetValue.stubs().method("setParent");

    Mock mockPropValue = mock(UIComponent.class);
    UIComponent propValue = (UIComponent) mockPropValue.proxy();
    mockPropValue.stubs().method("getParent").will(returnValue(null));
    mockPropValue.stubs().method("setParent");
View Full Code Here

    mockFacetValue.stubs().method("getParent").will(returnValue(null));
    mockFacetValue.stubs().method("setParent");

    Mock mockPropValue = mock(UIComponent.class);
    UIComponent propValue = (UIComponent) mockPropValue.proxy();
    mockPropValue.stubs().method("getParent").will(returnValue(null));
    mockPropValue.stubs().method("setParent");
   
    Map<String, UIComponent> facetMap = component.getFacets();
    try
    {
View Full Code Here

    mockFacetValue.stubs().method("setParent");

    Mock mockPropValue = mock(UIComponent.class);
    UIComponent propValue = (UIComponent) mockPropValue.proxy();
    mockPropValue.stubs().method("getParent").will(returnValue(null));
    mockPropValue.stubs().method("setParent");
   
    Map<String, UIComponent> facetMap = component.getFacets();
    try
    {
      // bean info is cached
View Full Code Here

    {
        super.setUp();

        Mock mockXWiki = mock(XWiki.class, new Class[] {}, new Object[] {});

        mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
        mockXWiki.stubs().method("getXWikiPreferenceAsInt").will(throwException(new NumberFormatException("null")));
        mockXWiki.stubs().method("Param").will(new CustomStub("Implements XWiki.Param")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
View Full Code Here

        super.setUp();

        Mock mockXWiki = mock(XWiki.class, new Class[] {}, new Object[] {});

        mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
        mockXWiki.stubs().method("getXWikiPreferenceAsInt").will(throwException(new NumberFormatException("null")));
        mockXWiki.stubs().method("Param").will(new CustomStub("Implements XWiki.Param")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
                return properties.getProperty((String) invocation.parameterValues.get(0));
View Full Code Here

        Mock mockXWiki = mock(XWiki.class, new Class[] {}, new Object[] {});

        mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
        mockXWiki.stubs().method("getXWikiPreferenceAsInt").will(throwException(new NumberFormatException("null")));
        mockXWiki.stubs().method("Param").will(new CustomStub("Implements XWiki.Param")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
                return properties.getProperty((String) invocation.parameterValues.get(0));
            }
View Full Code Here

            public Object invoke(Invocation invocation) throws Throwable
            {
                return properties.getProperty((String) invocation.parameterValues.get(0));
            }
        });
        mockXWiki.stubs().method("ParamAsLong").will(new CustomStub("Implements XWiki.ParamAsLong")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
                return Long.parseLong(properties.getProperty((String) invocation.parameterValues.get(0)));
            }
View Full Code Here

        this.mockGroupService.stubs().method("getAllGroupsNamesForMember").will(returnValue(Collections.EMPTY_LIST));
        this.mockGroupService.stubs().method("getAllMatchedGroups").will(returnValue(Collections.EMPTY_LIST));

        Mock mockXWiki = mock(XWiki.class, new Class[] {}, new Object[] {});

        mockXWiki.stubs().method("getStore").will(returnValue(mockStore.proxy()));
        mockXWiki.stubs().method("getGroupService").will(returnValue(mockGroupService.proxy()));
        mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
        mockXWiki.stubs().method("getXWikiPreferenceAsInt").will(throwException(new NumberFormatException("null")));
        mockXWiki.stubs().method("getDefaultDocumentSyntax").will(returnValue(Syntax.XWIKI_1_0.toIdString()));
        mockXWiki.stubs().method("Param").will(new CustomStub("Implements XWiki.Param")
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.