protected void checkCursorResult(ResultCursor<XQItemAccessor> results, String expected) throws Exception { try { Iterator<XQItemAccessor> iter = results.iterator(); assertTrue(iter.hasNext()); if (expected == null) { assertNotNull(iter.next().getObject()); } else { Properties props = new Properties(); props.setProperty("method", "text"); XQItem item = (XQItem) iter.next(); assertEquals(expected, item.getItemAsString(props)); } assertFalse(iter.hasNext()); } finally { results.close(); } }