• Post Reply Bookmark Topic Watch Topic
  • New Topic

EasyMock- How to populate a ResultSet ?  RSS feed

 
Tiya Khambadkone
Ranch Hand
Posts: 114
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
Sheriff
Posts: 36446
454
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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!