From: Vincent M. <vm...@pi...> - 2003-05-16 07:29:54
|
Hi, I've just noticed expectNotCalled() has been deprecated in the new DynaMock API. I am wondering why as I've found it quite useful. The javadoc says that "Not required, as if methodName is called, you will get a an exception". I think an example in the javadoc would have been more powerful an explanation. I'm not sure I understand... Here's the current test I am migrating: public void testGetOrderHomeFromCache() throws Exception { // First call to ensure the home is in the cache OrderUtil.getOrderHome(); // Make sure the lookup method is NOT called thus proving the object // is served from the cache jndiTestSetup.getMockContext().expectNotCalled("lookup"); OrderUtil.getOrderHome(); } What should it be now? I liked the expectNotCalled as it expressed very nicely what it means and what the test means. Handling this with an exception seems like a hack to me (and not conveying the test message at all), but I'd like to be proved wrong! :-) Thanks -Vincent |
From: Vincent M. <vm...@pi...> - 2003-05-16 07:49:28
|
Actually, I've understood the comment now but I still think this method should not be deprecated as it explains what the test is trying to do. With no method, you'll need to either document the test or hope that the reader will understand it... What do you think? Thanks -Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > Vincent Massol > Sent: 16 May 2003 09:30 > To: 'Mockobjects-Java-Dev' > Subject: [MO-java-dev] [New DynaMock] expectNotCalled deprecated, why? > > Hi, > > I've just noticed expectNotCalled() has been deprecated in the new > DynaMock API. I am wondering why as I've found it quite useful. The > javadoc says that "Not required, as if methodName is called, you will > get a an exception". I think an example in the javadoc would have been > more powerful an explanation. I'm not sure I understand... Here's the > current test I am migrating: > > public void testGetOrderHomeFromCache() throws Exception > { > // First call to ensure the home is in the cache > OrderUtil.getOrderHome(); > > // Make sure the lookup method is NOT called thus proving the > object > // is served from the cache > jndiTestSetup.getMockContext().expectNotCalled("lookup"); > OrderUtil.getOrderHome(); > } > > What should it be now? > > I liked the expectNotCalled as it expressed very nicely what it means > and what the test means. Handling this with an exception seems like a > hack to me (and not conveying the test message at all), but I'd like to > be proved wrong! :-) > > 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 |
From: Joe W. <jo...@tr...> - 2003-05-16 10:25:49
|
I like that method too. Particularly as I often have an expectation setup for a method in setUp which I later want to override for a specific test. Can we get it back? -j Vincent Massol wrote: >Actually, I've understood the comment now but I still think this method >should not be deprecated as it explains what the test is trying to do. >With no method, you'll need to either document the test or hope that the >reader will understand it... > >What do you think? > >Thanks >-Vincent > > > >>-----Original Message----- >>From: moc...@li... >>[mailto:moc...@li...] On Behalf Of >>Vincent Massol >>Sent: 16 May 2003 09:30 >>To: 'Mockobjects-Java-Dev' >>Subject: [MO-java-dev] [New DynaMock] expectNotCalled deprecated, why? >> >>Hi, >> >>I've just noticed expectNotCalled() has been deprecated in the new >>DynaMock API. I am wondering why as I've found it quite useful. The >>javadoc says that "Not required, as if methodName is called, you will >>get a an exception". I think an example in the javadoc would have been >>more powerful an explanation. I'm not sure I understand... Here's the >>current test I am migrating: >> >> public void testGetOrderHomeFromCache() throws Exception >> { >> // First call to ensure the home is in the cache >> OrderUtil.getOrderHome(); >> >> // Make sure the lookup method is NOT called thus proving the >>object >> // is served from the cache >> jndiTestSetup.getMockContext().expectNotCalled("lookup"); >> OrderUtil.getOrderHome(); >> } >> >>What should it be now? >> >>I liked the expectNotCalled as it expressed very nicely what it means >>and what the test means. Handling this with an exception seems like a >>hack to me (and not conveying the test message at all), but I'd like >> >> >to > > >>be proved wrong! :-) >> >>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 >> >> > > > >------------------------------------------------------- >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 > > |
From: <Vin...@ge...> - 2003-06-02 22:22:12
|
Hi all, I've been playing with the new dynamocks recently and I really like it. Nice job ;-) What's the status on this concern raised by Vincent some time ago? I came accross the same situation recently and I wuold have loved an expectNotCalled method. It makes the test code easier to understand. What is the recommandation here? Thanks, Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > Vincent Massol > Sent: Friday, May 16, 2003 3:30 AM > To: 'Mockobjects-Java-Dev' > Subject: [MO-java-dev] [New DynaMock] expectNotCalled deprecated, why? > > > Hi, > > I've just noticed expectNotCalled() has been deprecated in the new > DynaMock API. I am wondering why as I've found it quite useful. The > javadoc says that "Not required, as if methodName is called, you will > get a an exception". I think an example in the javadoc would have been > more powerful an explanation. I'm not sure I understand... Here's the > current test I am migrating: > > public void testGetOrderHomeFromCache() throws Exception > { > // First call to ensure the home is in the cache > OrderUtil.getOrderHome(); > > // Make sure the lookup method is NOT called thus proving the > object > // is served from the cache > jndiTestSetup.getMockContext().expectNotCalled("lookup"); > OrderUtil.getOrderHome(); > } > > What should it be now? > > I liked the expectNotCalled as it expressed very nicely what it means > and what the test means. Handling this with an exception seems like a > hack to me (and not conveying the test message at all), but > I'd like to > be proved wrong! :-) > > 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 > |