Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EasyMock- How to populate a ResultSet ?

 
Tiya Khambadkone
Ranch Hand
Posts: 109
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where in the test are you specifying that mockRs.next() should return true?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic