From: Vincent M. <vm...@pi...> - 2003-05-18 08:21:06
|
After looking at the source code, it seems the behavior is correctly implemented. There must be some other error in my test... debugging now... Thanks and sorry for the false alarm :-) -Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > Vincent Massol > Sent: 18 May 2003 08:59 > To: 'Mockobjects-Java-Dev' > Subject: [MO-java-dev] [DynaMock] Very difficult to factorize matches... > > Hi, > > It is currently very difficult to write common setUp using the new Dyna > Mock API (it was easy with the previous DynaMock API). The main reason > is that you cannot write something like that: > > public void setUp() > { > mock.matchAndReturn("create", C.ANY_ARGS, whatever); > } > > public void test1() > { > [...] > } > > public void test2() > { > [...] > } > > public void testException() > { > mock.expectAndThrow("create", C.ANY_ARGS, > new CreateException("error")); > [...] > } > > The testException() test will fail with: > > junit.framework.AssertionFailedError: mockOrderLocalHome: create(<ANY>) > was expected but not called > > I think that it would be a normal behavior that expectations override > matches. > > What do you think? > > Thanks > -Vincent > > > > ------------------------------------------------------- > This SF.net email is sponsored by: If flattening out C++ or Java > code to make your application fit in a relational database is painful, > don't do it! Check out ObjectStore. Now part of Progress Software. > http://www.objectstore.net/sourceforge > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |