From: Vincent M. <vm...@pi...> - 2003-05-16 07:13:34
|
FYI > -----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 |