Skip to content
Browse files

fixed createEntityWithRandomPk: create collision free PKs

  • Loading branch information...
1 parent 5af7bd4 commit bb522d9719aad055bd78e81b6aaf6f142eb44fd5 @greenrobot committed Jun 10, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 DaoCore/src/de/greenrobot/dao/test/AbstractDaoTestSinglePk.java
View
3 DaoCore/src/de/greenrobot/dao/test/AbstractDaoTestSinglePk.java
@@ -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();
@@ -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. */

0 comments on commit bb522d9

Please sign in to comment.
Something went wrong with that request. Please try again.