Skip to content

Commit

Permalink
fixed createEntityWithRandomPk: create collision free PKs
Browse files Browse the repository at this point in the history
  • Loading branch information
greenrobot committed Jun 10, 2012
1 parent 5af7bd4 commit bb522d9
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ protected Cursor queryWithDummyColumnsInFront(int dummyCount, String valueForCol
return cursor;
}

/** Provides a collision free PK () not returned before in the current test. */
protected K nextPk() {
for (int i = 0; i < 100000; i++) {
K pk = createRandomPk();
Expand All @@ -299,7 +300,7 @@ protected K nextPk() {
}

protected T createEntityWithRandomPk() {
return createEntity(createRandomPk());
return createEntity(nextPk());
}

/** K does not have to be collision free, check nextPk for collision free PKs. */
Expand Down

0 comments on commit bb522d9

Please sign in to comment.