From: Vincent M. <vm...@pi...> - 2003-05-16 08:23:32
|
Guys, I need your help! I've been trying to migrate my existing project to the new Dyna Mock for the past few days and I'm stuck... The tests I am trying to migrate are located here: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/junitbook/junitbook/ejb/m ockobjects/ If you are working with Eclipse, the easiest it to import first the repository/ project (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/junitbook/junitbook/repo sitory/) in your workspace, rename it to junitbook-repository (it is imported with the name "repository" by default) and then import the ejb/mockobjects project (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/junitbook/junitbook/ejb/ mockobjects/). (these projects are already Eclipse projects) The CVS information is available on http://sourceforge.net/cvs/?group_id=68011 The tests to look at in priority are: - junitbook.ejb.service3.TestPetstoreEJB - junitbook.ejb.domain.TestOrderUtil The 2 tests demonstrate the issue I have been describing below. Thanks a bunch -Vincent > > -----Original Message----- > > From: Tim Mackinnon [mailto:tim...@po...] > > Sent: 16 May 2003 02:02 > > To: Vincent Massol > > Subject: RE: [MO-java-dev] [new dyna mock] Bug? > > > > Hmmm thats weird? There is no specific test for that as we assume that > > junit > > has independant tests, and there is no global state in the dynamic > stuff > > (it > > folds with the test). The library has also been used quite a bit by > the > > e2x > > guys who have lots of concurrent tests....and not reported this one. > > > > If you can help by debugging or creating a test we can have look. > > > > Tim > > > > > > > -----Original Message----- > > > From: moc...@li... > > > [mailto:moc...@li...]On Behalf > Of > > > Vincent Massol > > > Sent: 15 May 2003 10:08 > > > To: 'Mockobjects-Java-Dev' > > > Subject: [MO-java-dev] [new dyna mock] Bug? > > > > > > > > > Hi, > > > > > > I have the following 2 tests: > > > > > > public void testCreateOrderOk() throws Exception > > > { > > > mockQueueConnectionFactory.expectAndReturn( > > > "createQueueConnection", queueConnection); > > > > > > int orderId = petstore.createOrder(new Date(), "item1"); > > > > > > assertEquals(1234, orderId); > > > } > > > > > > public void testCreateThrowsOrderException() throws Exception > > > { > > > mockQueueConnectionFactory.expectAndThrow( > > > "createQueueConnection", new JMSException("error")); > > > > > > try > > > { > > > petstore.createOrder(new Date(), "item1"); > > > fail("Should have thrown an EJBException"); > > > } > > > catch (EJBException expected) > > > { > > > assertEquals("error", > > > expected.getCausedByException().getMessage()); > > > } > > > } > > > > > > The second test (testCreateThrowsOrderException()) fails with the > > > following error: > > > > > > junit.framework.AssertionFailedError: mockQueueConnectionFactory: > > > Unexpected call: createQueueConnection() > > > Expected one of: > > > createQueueConnection() [called] > > > [...] > > > > > > If I comment out the testCreateOrderOk() method it works... > > > > > > It seems that the 2 tests are overstepping each other and that the > > > second mock expectAndThrow() is not taken into account because the > mock > > > has already been set up by the first test! Glurps.... > > > > > > Any idea? Do we have a test case for this scenario in our test > suite? > > > > > > Thanks > > > -Vincent > > > > > > > > > > > > ------------------------------------------------------- > > > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa > Clara > > > The only event dedicated to issues related to Linux enterprise > solutions > > > www.enterpriselinuxforum.com > > > > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > --- > > > Incoming mail is certified Virus Free. > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 > > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 > > > > > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux enterprise solutions > www.enterpriselinuxforum.com > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |