Program: 53709
Project: 53709
Buggy source:
public void testSetKeyboardSelectedRowChangePage(){
  HasData<String> listView=new MockHasData<String>();
  MockView<String> view=new MockView<String>();
  HasDataPresenter<String> presenter=new HasDataPresenter<String>(listView,view,10,null);
  presenter.setVisibleRange(new Range(10,10));
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(KeyboardPagingPolicy.CHANGE_PAGE,presenter.getKeyboardPagingPolicy());
  assertEquals(0,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRowEmpty();
  presenter.setKeyboardSelectedRow(1,false,false);
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertKeyboardSelectedRow(0,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(1,false,true);
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(9,false,false);
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(9,true);
  assertEquals(10,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(10,false,false);
  populatePresenter(presenter);
  assertNull(presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(0,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertReplaceAllChildrenCalled(10);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(20,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(-1,false,false);
  populatePresenter(presenter);
  assertNull(presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertReplaceAllChildrenCalled(10);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(10,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
}

Fixed version (ground truth):
public void testSetKeyboardSelectedRowChangePage(){
  HasData<String> listView=new MockHasData<String>();
  MockView<String> view=new MockView<String>();
  HasDataPresenter<String> presenter=new HasDataPresenter<String>(listView,view,10,null);
  presenter.setVisibleRange(new Range(10,10));
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(KeyboardPagingPolicy.CHANGE_PAGE,presenter.getKeyboardPagingPolicy());
  assertEquals(0,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRowEmpty();
  presenter.setKeyboardSelectedRow(1,false,false);
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertKeyboardSelectedRow(0,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(1,false,true);
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(9,false,false);
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(9,true);
  assertEquals(10,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(10,false,false);
  populatePresenter(presenter);
  assertNull(presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(0,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertReplaceAllChildrenCalled(10);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(20,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(-1,false,false);
  populatePresenter(presenter);
  assertNull(presenter.getKeyboardSelectedRowValue());
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  assertEquals("String_Node_Str",presenter.getKeyboardSelectedRowValue());
  view.assertReplaceAllChildrenCalled(10);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(10,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
  presenter.setVisibleRange(new Range(3,10));
  presenter.setKeyboardSelectedRow(3,false,false);
  populatePresenter(presenter);
  presenter.flush();
  presenter.setKeyboardSelectedRow(-4,false,false);
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(0,presenter.getKeyboardSelectedRow());
  assertEquals(0,presenter.getVisibleRange().getStart());
  assertEquals(10,presenter.getVisibleRange().getLength());
}