Program: 81751
Project: 81751
Buggy source:
public void testSetKeyboardSelectedRowIncreaseRange(){
  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();
  presenter.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
  int pageSize=presenter.getVisibleRange().getLength();
  assertEquals(0,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRowEmpty();
  presenter.setKeyboardSelectedRow(1,false,false);
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRow(0,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(1,false,true);
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(9,false,false);
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(9,true);
  assertEquals(10,presenter.getVisibleRange().getStart());
  assertEquals(pageSize,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(10,false,false);
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(10,presenter.getKeyboardSelectedRow());
  view.assertReplaceAllChildrenCalled(pageSize);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(10,presenter.getVisibleRange().getStart());
  pageSize+=HasDataPresenter.PAGE_INCREMENT;
  assertEquals(pageSize,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(-1,false,false);
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  view.assertReplaceAllChildrenCalled(pageSize);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(0,presenter.getVisibleRange().getStart());
  pageSize+=10;
  assertEquals(pageSize,presenter.getVisibleRange().getLength());
}

Fixed version (ground truth):
public void testSetKeyboardSelectedRowIncreaseRange(){
  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();
  presenter.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
  int pageSize=presenter.getVisibleRange().getLength();
  assertEquals(0,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRowEmpty();
  presenter.setKeyboardSelectedRow(1,false,false);
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRow(0,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(1,false,true);
  presenter.flush();
  assertEquals(1,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(1,true);
  presenter.setKeyboardSelectedRow(9,false,false);
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  view.assertKeyboardSelectedRow(1,false);
  view.assertKeyboardSelectedRow(9,true);
  assertEquals(10,presenter.getVisibleRange().getStart());
  assertEquals(pageSize,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(10,false,false);
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(10,presenter.getKeyboardSelectedRow());
  view.assertReplaceAllChildrenCalled(pageSize);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(10,presenter.getVisibleRange().getStart());
  pageSize+=HasDataPresenter.PAGE_INCREMENT;
  assertEquals(pageSize,presenter.getVisibleRange().getLength());
  presenter.setKeyboardSelectedRow(-1,false,false);
  populatePresenter(presenter);
  presenter.flush();
  assertEquals(9,presenter.getKeyboardSelectedRow());
  view.assertReplaceAllChildrenCalled(pageSize);
  view.assertKeyboardSelectedRowEmpty();
  assertEquals(0,presenter.getVisibleRange().getStart());
  pageSize+=10;
  assertEquals(pageSize,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(13,presenter.getVisibleRange().getLength());
}