aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2007-12-02 04:52:09 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2007-12-02 04:52:09 +0000
commit0501abfcdbf2bbf67d1811c1208bcaa26ca626e1 (patch)
treea8e726e984905cc69cfd6168d7c2d120562bfee1
parentbca9319ef7c3fba0ee234d2ba8152de6fe0d1329 (diff)
downloadjackcess-0501abfcdbf2bbf67d1811c1208bcaa26ca626e1.tar.gz
jackcess-0501abfcdbf2bbf67d1811c1208bcaa26ca626e1.zip
more cursor tests
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@195 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/CursorTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/CursorTest.java b/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
index 6b67892..751c6cc 100644
--- a/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/CursorTest.java
@@ -276,6 +276,13 @@ public class CursorTest extends TestCase {
"value", "data" + 5),
Cursor.findRow(table, index,
createExpectedRow("id", 5)));
+
+ assertNull(Cursor.findValue(table, index,
+ table.getColumn("value"),
+ table.getColumn("id"),
+ -17));
+ assertNull(Cursor.findRow(table, index,
+ createExpectedRow("id", 13)));
}
}
@@ -396,6 +403,44 @@ public class CursorTest extends TestCase {
assertEquals(expectedNextRow, cursor3.getNextRow());
assertEquals(expectedPrevRow, cursor3.getPreviousRow());
+
+ assertTrue(cursor3.moveToNextRow());
+ cursor3.deleteCurrentRow();
+ assertTrue(cursor3.isCurrentRowDeleted());
+
+ firstValue += 2;
+ expectedNextRow =
+ createExpectedRow("id", firstValue, "value", "data" + firstValue);
+ assertTrue(cursor3.moveToNextRow());
+ assertEquals(expectedNextRow, cursor3.getNextRow());
+
+ cursor1.beforeFirst();
+ assertTrue(cursor1.moveToNextRow());
+ cursor1.deleteCurrentRow();
+ assertFalse(cursor1.isBeforeFirst());
+ assertFalse(cursor1.isAfterLast());
+ assertFalse(cursor1.moveToPreviousRow());
+ assertTrue(cursor1.isBeforeFirst());
+ assertFalse(cursor1.isAfterLast());
+
+ cursor1.afterLast();
+ assertTrue(cursor1.moveToPreviousRow());
+ cursor1.deleteCurrentRow();
+ assertFalse(cursor1.isBeforeFirst());
+ assertFalse(cursor1.isAfterLast());
+ assertFalse(cursor1.moveToNextRow());
+ assertFalse(cursor1.isBeforeFirst());
+ assertTrue(cursor1.isAfterLast());
+
+ cursor1.beforeFirst();
+ while(cursor1.moveToNextRow()) {
+ cursor1.deleteCurrentRow();
+ }
+
+ assertTrue(cursor1.isAfterLast());
+ assertTrue(cursor2.isCurrentRowDeleted());
+ assertTrue(cursor3.isCurrentRowDeleted());
+ assertTrue(cursor4.isCurrentRowDeleted());
}
public void testSimpleIndex() throws Exception {