Nat Pryce | 1 Oct 05:47 2007
Picon

Re: Ideal BDD using JMock

Which components are causing you trouble?  Most Swing components
interact with their model through a model interface and listener
interfaces.  What are you trying to mock out?

--Nat

On 27/09/2007, Tom Lanning <tom.lanning@...> wrote:
>    I do a lot of Swing-based development and routinely delegate the
> behavior of Swing components using object injection.  Unfortunately,
> many of the Swing components specify (abstract) delegate objects
> instead of interfaces.  Therefore I routinely need to subclass
> unalterable provided (abstract) classes.  I know I can use JMock with
> ClassImposteriser but I often end up mocking most of the base class'
> behavior to verify my over-ridden methods.
>
>    How do "interface-only purists" handle this problem?  (I don't
> mean any offense by the term "interface-only purist".  I am becoming
> one myself; hence the question.)
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

(Continue reading)

Nat Pryce | 1 Oct 09:37 2007
Picon

Re: 2.3 release?

I pushed the 2.3.0 release this morning.

--Nat

On 28/09/2007, Erick Dovale <edovale@...> wrote:
> Folks,
> Is there a date for the release of 2.3?? What's holding it?
>
> cheers
>
> Erick.
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

ashley.mcconnell | 1 Oct 09:41 2007

RE: 2.3 release?

Hi Nat,

Is there anywhere I can see what is new in this release?

Thanks for your help!
Ash

> -----Original Message-----
> From: Nat Pryce [mailto:nat.pryce@...] 
> Sent: 01 October 2007 08:38
> To: user@...
> Subject: Re: [jmock-user] 2.3 release?
> 
> I pushed the 2.3.0 release this morning.
> 
> --Nat
> 

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

marco.mistroni | 1 Oct 09:50 2007

jMock2 and two expectations on same method


hi all,
 i have following method with this sample code

public void retrieveData() {

       List list = businessManager.retrieveData();
       typeManager.populateListWithTypes(list);
}


so in one method, i have call to two different Managers

in my tests they are both Mock....but i don't know how to write proper code..

i started with this..


context.checking(new Expectations() {{
   one (businessManagerMock).retrieveData();
        will(returnValue(myTestList));
}});


i'll have to do same for typeManagerMock.... is this code correct?

context.checking(new Expectations() {{
   one (businessManagerMock).retrieveData();
        will(returnValue(myTestList));
    one(typeManagerMock).populateList(myTestList);
}});

could anyone help?

thanks and regars
        marco
This communication is confidential, may be privileged and is meant only for the intended recipient. If you are not the intended recipient, please notify the sender by reply and delete this message from your system. Any unauthorised dissemination, distribution or copying hereof is prohibited. BNP Paribas Fund Services UK Limited, BNP Paribas Trust Corporation UK Limited, BNP Paribas UK Limited, BNP Paribas Commodity Futures Ltd and Investment Fund Services Limited are authorised and regulated by the Financial Services Authority. BNP Paribas, BNP Paribas Securities Services and BNP Paribas Private Bank are authorised by the CECEI and AMF. BNP Paribas London Branch, BNP Paribas Securities Services London Branch and BNP Paribas Private Bank London Branch are regulated by the Financial Services Authority for the conduct of their UK business. BNP Paribas Securities Services London Branch is also a member of the London Stock Exchange.
Steve Freeman | 1 Oct 10:15 2007
Picon

Re: jMock2 and two expectations on same method

On 1 Oct 2007, at 08:50, marco.mistroni@... wrote:
> public void retrieveData() {
>
>        List list = businessManager.retrieveData();
>        typeManager.populateListWithTypes(list);
> }
>
> [...]
> i'll have to do same for typeManagerMock.... is this code correct?
>
> context.checking(new Expectations() {{
>     one (businessManagerMock).retrieveData();
>         will(returnValue(myTestList));
>     one(typeManagerMock).populateList(myTestList);
> }});

that should be

   one(typeManagerMock).populateListWithTypes(myTestList)

but yes, if that's the behaviour you want to test.

If you're in Paribas in London, talk to the Sierra team. They should  
have a lot of experience with Mocks.

S.

Steve Freeman
Winner of the Agile Alliance Gordon Pask award 2006

http://www.m3p.co.uk

M3P Limited.
Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
Company registered in England & Wales. Number 03689627

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Wouter Scherphof | 1 Oct 10:26 2007
Picon

Newbie: how do you make a test pass?

One thing keeps puzzling me: when you've specified a test with expectations 
using Mock Objects, then how do you proceed to make the test pass? Following 
the Getting Started with the Publisher and the Subscriber: how do you create a 
Subscriber in the Publisher.publish() method? You don't use jMock stuff here, 
do you? So I'd guess you have to create some implementation of Subscriber 
anyway, and you could use that same implementation in the test case 
alltogether, and what does jMock bring me, then?

Regards, Wouter.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Steve Freeman | 1 Oct 11:08 2007
Picon

Re: Newbie: how do you make a test pass?

I think if you take another look you'll find that the subscriber is  
created outside and then passed to the publisher. We use jMock to  
help us think about the relationships between objects, so what we're  
doing in the example is figuring out what the publisher needs from  
its neighbours.

Of course, sometime later we'd create an implementation of a  
subscriber and test that separately (and together in an integration  
test).

S.

On 1 Oct 2007, at 09:26, Wouter Scherphof wrote:
> One thing keeps puzzling me: when you've specified a test with  
> expectations
> using Mock Objects, then how do you proceed to make the test pass?  
> Following
> the Getting Started with the Publisher and the Subscriber: how do  
> you create a
> Subscriber in the Publisher.publish() method? You don't use jMock  
> stuff here,
> do you? So I'd guess you have to create some implementation of  
> Subscriber
> anyway, and you could use that same implementation in the test case
> alltogether, and what does jMock bring me, then?

Steve Freeman
Winner of the Agile Alliance Gordon Pask award 2006

http://www.m3p.co.uk

M3P Limited.
Registered office. 2 Church Street, Burnham, Bucks, SL1 7HZ.
Company registered in England & Wales. Number 03689627

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Erick Dovale | 1 Oct 17:08 2007
Picon

Re: 2.3 release?

Thanks Nat.

On 10/1/07, ashley.mcconnell-5Ybtn9MHkAA@public.gmane.org <ashley.mcconnell-5Ybtn9MHkAA@public.gmane.org > wrote:
Hi Nat,

Is there anywhere I can see what is new in this release?

Thanks for your help!
Ash

> -----Original Message-----
> From: Nat Pryce [mailto:nat.pryce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
> Sent: 01 October 2007 08:38
> To: user-sXN/XchZ9OexIXFVlbCvtR2eb7JE58TQ@public.gmane.org
> Subject: Re: [jmock-user] 2.3 release?
>
> I pushed the 2.3.0 release this morning.
>
> --Nat
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Erick Dovale | 1 Oct 19:11 2007
Picon

Re: 2.3 release?

Any idea as to when it'll be pushed to the maven repositories?

On 10/1/07, Erick Dovale <edovale-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:
Thanks Nat.


On 10/1/07, ashley.mcconnell-5Ybtn9MHkAA@public.gmane.org < ashley.mcconnell-5Ybtn9MHkAA@public.gmane.org > wrote:
Hi Nat,

Is there anywhere I can see what is new in this release?

Thanks for your help!
Ash

> -----Original Message-----
> From: Nat Pryce [mailto:nat.pryce-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org ]
> Sent: 01 October 2007 08:38
> To: user-sXN/XchZ9OexIXFVlbCvtR2eb7JE58TQ@public.gmane.org
> Subject: Re: [jmock-user] 2.3 release?
>
> I pushed the 2.3.0 release this morning.
>
> --Nat
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email



Tom Lanning | 1 Oct 20:17 2007
Picon

Re: Ideal BDD using JMock

   Thanks Steve and Nat for your interest.

   There are several variations of this problem, but the an "easy  
one" to describe is the use of TableCellRenderer (http://java.sun.com/ 
javase/6/docs/api/javax/swing/table/TableCellRenderer.html).

   TableCellRenderer describes an interface that returns a properly  
configured Component that a JTable uses to "paint" its cells.   
Although the table cell renderer is specified as an interface, two  
important collaborators, the component and the table, are not.  From  
a JMock point-of-view I want to ensure that appropriate query methods  
are invoked on the JTable and appropriate configuration methods are  
invoked on the Component.  Notice that like all Swing components,  
JTable and the relatively abstract Component, are not defined as  
interfaces.  Since the collaborators are declared as objects I am  
forced to mock objects not interfaces.

   Another example is a group of classes used to implement drag-and- 
drop behavior on JComponents.  The class TransferHandler (http:// 
java.sun.com/javase/6/docs/api/javax/swing/TransferHandler.html)  
collaborates with a variety of objects that are not specified as  
interfaces.  Aside from JComponent, it uses the TransferSupport  
class, a family of classes descended from DropLocation, and the  
DataFlavor class.  I have found it very difficult to test (specify)  
the behavior drag-and-drop classes and I don't think that even what I  
have accomplished is possible without mocking objects.

   Again thanks for taking time to think about these problems.  Any  
insight is welcome.

On Sep 30, 2007, at 11:47 PM, Nat Pryce wrote:

> Which components are causing you trouble?  Most Swing components
> interact with their model through a model interface and listener
> interfaces.  What are you trying to mock out?
>
> --Nat
>
> On 27/09/2007, Tom Lanning <tom.lanning@...> wrote:
>>    I do a lot of Swing-based development and routinely delegate the
>> behavior of Swing components using object injection.  Unfortunately,
>> many of the Swing components specify (abstract) delegate objects
>> instead of interfaces.  Therefore I routinely need to subclass
>> unalterable provided (abstract) classes.  I know I can use JMock with
>> ClassImposteriser but I often end up mocking most of the base class'
>> behavior to verify my over-ridden methods.
>>
>>    How do "interface-only purists" handle this problem?  (I don't
>> mean any offense by the term "interface-only purist".  I am becoming
>> one myself; hence the question.)
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Gmane