You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Sreedevi Aswath <sr...@gmail.com> on 2006/07/18 09:27:47 UTC

JMock support in Shale

Hi,

    Will JMock be supported in Shale in the next version?
    Then it is much easier to mock the components.

Thanks,
Sreedevi

Re: JMock support in Shale

Posted by Matthias Wessendorf <ma...@apache.org>.
Hey,

here the SNAPSHOT-JAR goes
http://people.apache.org/repo/m2-snapshot-repository/org/apache/shale/shale-test/1.0.3-SNAPSHOT/

and here is the java doc
http://shale.apache.org/shale-test/apidocs/org/apache/shale/test/jmock/AbstractJsfTestCase.html

notice the package is:
org.apache.shale.test.jmock

-Matthias

On 7/18/06, Sreedevi Aswath <sr...@gmail.com> wrote:
> Hi,
>
>     Oh that would be great. But where can I find the test case that sets up
> the JMock environment. Under nightly builds I didn't find under the
> shale-framework.
>
> Thanks,
> Sreedevi
>
>
>
> >
> >
>
>


-- 
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: JMock support in Shale

Posted by Sreedevi Aswath <sr...@gmail.com>.
Hi,

    Oh that would be great. But where can I find the test case that sets up
the JMock environment. Under nightly builds I didn't find under the
shale-framework.

Thanks,
Sreedevi



>
>

Re: JMock support in Shale

Posted by Craig McClanahan <cr...@apache.org>.
On 7/20/06, Sreedevi Aswath <sr...@gmail.com> wrote:
>
>
> Hi,
>
>    It would be great if there could be a mock up for the JSF components
> too.
>    That way, the unit tests for managed beans would be easier whenever
> there is  a valuebinding
>     involved.
>


I don't completely understand what you are after here.  Are you trying to
test JSF components themselves, or are you trying to test your application's
backing beans when there is a component tree for the current view already
constructed?

In the latter case, you don't need mock components at all ... just use real
ones.  The default setUp() procedure in AbstractJsfTestCase sets up a view
root for you, and your customized setUp() method can programmatically
construct whatever component tree you need in advance of executing each test
case.

Even in the former case (testing components themselves), I'm a bit fuzzy on
why using the real component classes, instead of mocking them, doesn't
satisfy your needs.

Thanks,
> Sreedevi.
>


Craig

Re: JMock support in Shale

Posted by Matthias Wessendorf <ma...@apache.org>.
Yes you can. See [1].

JMock allows you to say:

Mock mock = createMockUIComponent();
    UIComponent child = (UIComponent) mock.proxy();

    // JavaServer Faces 1.0 Specification, section 2.2.2
    // During the apply-request-values phase,
    // only the processDecodes lifecycle method may be called.
    if (willChildrenBeProcessed(component))
      mock.expects(once()).method("processDecodes");

-Matthias

[1] http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-api/src/test/java/org/apache/myfaces/adf/component/UIComponentTestCase.java?revision=422050&view=markup

On 7/20/06, Sean Schofield <se...@gmail.com> wrote:
> Couldn't you just use JMock for those?
>
> Sean
>
> On 7/20/06, Sreedevi Aswath <sr...@gmail.com> wrote:
> > Hi,
> >
> >    It would be great if there could be a mock up for the JSF components too.
> >    That way, the unit tests for managed beans would be easier whenever there
> > is  a valuebinding
> >     involved.
> >
> > Thanks,
> > Sreedevi.
> >
> >
> >
> > >
> > >
> >
> >
>


-- 
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: JMock support in Shale

Posted by Sean Schofield <se...@gmail.com>.
Couldn't you just use JMock for those?

Sean

On 7/20/06, Sreedevi Aswath <sr...@gmail.com> wrote:
> Hi,
>
>    It would be great if there could be a mock up for the JSF components too.
>    That way, the unit tests for managed beans would be easier whenever there
> is  a valuebinding
>     involved.
>
> Thanks,
> Sreedevi.
>
>
>
> >
> >
>
>

Re: JMock support in Shale

Posted by Sreedevi Aswath <sr...@gmail.com>.
Hi,

   It would be great if there could be a mock up for the JSF components too.
   That way, the unit tests for managed beans would be easier whenever there
is  a valuebinding
    involved.

Thanks,
Sreedevi.



>
>

Re: JMock support in Shale

Posted by Craig McClanahan <cr...@apache.org>.
On 7/18/06, Sreedevi Aswath <sr...@gmail.com> wrote:
>
> Hi,
>
>     Will JMock be supported in Shale in the next version?
>     Then it is much easier to mock the components.


The current nightly builds include a base "test case" class that sets up the
JMock environment, so that will be included.  Is there other specific
support you are interested in?

Thanks,
> Sreedevi


Craig