aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2007-12-04 04:17:40 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2007-12-04 04:17:40 +0000
commit6d8b4e03a880377e2b97d448837252a53ec0b452 (patch)
tree21f987dcbf2ca64efa7a07af7178fc008ea20d05 /test/src/java
parentb873018902c17b24bb581c18694a9f4d43fd3837 (diff)
downloadjackcess-6d8b4e03a880377e2b97d448837252a53ec0b452.tar.gz
jackcess-6d8b4e03a880377e2b97d448837252a53ec0b452.zip
add ids to savepoints in order to verify legitimacy of restore attempts
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@198 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test/src/java')
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/CursorTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/CursorTest.java b/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
index 590b9aa..87210ff 100644
--- a/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
@@ -649,5 +649,43 @@ public class CursorTest extends TestCase {
}
}
+ public void testId() throws Exception
+ {
+ Database db = createTestIndexTable();
+
+ Table table = db.getTable("test");
+ Index idx = table.getIndexes().get(0);
+
+ Cursor tCursor = Cursor.createCursor(table);
+ Cursor iCursor = Cursor.createIndexCursor(table, idx);
+
+ Cursor.Savepoint tSave = tCursor.getSavepoint();
+ Cursor.Savepoint iSave = iCursor.getSavepoint();
+
+ tCursor.restoreSavepoint(tSave);
+ iCursor.restoreSavepoint(iSave);
+
+ try {
+ tCursor.restoreSavepoint(iSave);
+ fail("IllegalArgumentException should have been thrown");
+ } catch(IllegalArgumentException e) {
+ // success
+ }
+
+ try {
+ iCursor.restoreSavepoint(tSave);
+ fail("IllegalArgumentException should have been thrown");
+ } catch(IllegalArgumentException e) {
+ // success
+ }
+
+ Cursor tCursor2 = Cursor.createCursor(table);
+ Cursor iCursor2 = Cursor.createIndexCursor(table, idx);
+
+ tCursor2.restoreSavepoint(tSave);
+ iCursor2.restoreSavepoint(iSave);
+
+ db.close();
+ }
}