From: <ric...@vo...> - 2003-04-22 06:20:50
|
Hi James, I am no expert on mock objects testing, I can only tell how I implemented a workaround. I am not happy with the 'solution', so please comment. I implemented the two sql queries in two methods/classes. If method-query 'A' depends on 'B', generate a mock object for 'B' that is used in 'A'. Use the mock object in the test for 'A' and you're done. This implies that a method only could do one sql query, which is weird and has a big impact on the design. Another developer suggested to solve those issues in the database (stored procedures / views / functions), which was also a solution in another project. I am not very good in database programming, but in our team there is lots of experience. In short: I don't have the answer ;-) Richard den Adel. > -----Original Message----- > From: James Howe [mailto:jw...@al...] > Sent: Monday, April 21, 2003 10:13 PM > To: moc...@li... > Subject: [MO-java-users] Question about MockStatement and > expected query > strings > > > I'm writing a test of a method which needs to make two SQL > queries to get > the result. I can configure a MockStatement to return two different > results, but as far as I can tell, I can't set two expected > query values. > It seems that if a MockStatement can return multiple result sets, you > should be able to associate a specific expected query value with a > particular result set. In my case, I have a query which gets > a count of > something and then uses that count as part of the next query. > I would like > to test that the count query was correct and also test that > the second > query was correct. Has anyone run into this problem before, > and if so, > how did you get around it? > > Thanks. > > -- > James Howe > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users > |