aspose file tools*
The moose likes Testing and the fly likes EasyMock- How to populate a ResultSet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
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: 52
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: 30537
    
150

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://aspose.com/file-tools
 
subject: EasyMock- How to populate a ResultSet ?