This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Testing and the fly likes EasyMock- How to populate a ResultSet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Reply Bookmark "EasyMock- How to populate a ResultSet ?" Watch "EasyMock- How to populate a ResultSet ?" New topic
Author

EasyMock- How to populate a ResultSet ?

Tiya Khambadkone
Ranch Hand

Joined: Sep 15, 2011
Posts: 40
EasyMock- How to populate a ResultSet for more than 1 row ?

This is how I am populating for a single row.

mockControl.expectAndReturn(mockRS.getString(1), "EmployeeId", 1);
mockControl.expectAndReturn(mockRS.getString(2), "EmployeeName", 1);
mockRS.next();

I tried this logic for 2nd row :
mockControl.expectAndReturn(mockRS.getString(1), "EmployeeId", 2);
mockControl.expectAndReturn(mockRS.getString(2), "EmployeeName", 2);
mockRS.next();

When inside the class-under-test,
while(rs.next())

excutes only once .

So, How to populate a ResultSet for more than 1 row ?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26138
    
  66

Where in the test are you specifying that mockRs.next() should return true?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: EasyMock- How to populate a ResultSet ?
 
Similar Threads
Sorting problem with HibernateSqlQuery with Websphere
generating pdf report some field are hiding in pdf
JDBC Newbie
Optimisation
h:selectOneMenu - setting the correct value