Java Code Examples for com.j256.ormlite.dao.CloseableIterator#remove()
The following examples show how to use
com.j256.ormlite.dao.CloseableIterator#remove() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ormlite-core File: SelectIteratorTest.java License: ISC License | 6 votes |
@Test(expected = IllegalStateException.class) public void testIteratorNextRemoveRemoveNoNext() throws Exception { Dao<Foo, Object> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); assertEquals(1, dao.create(foo2)); CloseableIterator<Foo> iterator = dao.iterator(); try { iterator.next(); iterator.remove(); iterator.remove(); } finally { iterator.close(); } }
Example 2
Source Project: ormlite-core File: SelectIteratorTest.java License: ISC License | 6 votes |
@Test public void testIteratorRemove() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); assertEquals(1, dao.queryForAll().size()); CloseableIterator<Foo> iterator = dao.iterator(); assertTrue(iterator.hasNext()); Foo result = iterator.next(); assertEquals(foo1.id, result.id); iterator.remove(); assertFalse(iterator.hasNext()); assertNull(iterator.nextThrow()); assertEquals(0, dao.queryForAll().size()); iterator.close(); }
Example 3
Source Project: ormlite-core File: SelectIteratorTest.java License: ISC License | 6 votes |
@Test(expected = IllegalStateException.class) public void testIteratorRawResults() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); assertEquals(1, dao.create(foo1)); GenericRawResults<String[]> rawResults = dao.queryRaw("SELECT " + Foo.ID_COLUMN_NAME + " FROM FOO"); CloseableIterator<String[]> iterator = rawResults.closeableIterator(); try { assertTrue(iterator.hasNext()); iterator.next(); iterator.remove(); } finally { iterator.close(); } }
Example 4
Source Project: ormlite-core File: SelectIteratorTest.java License: ISC License | 5 votes |
@Test(expected = IllegalStateException.class) public void testIteratorRemoveNoNext() throws Exception { Dao<Foo, Object> dao = createDao(Foo.class, true); CloseableIterator<Foo> iterator = dao.iterator(); try { iterator.remove(); } finally { iterator.close(); } }