### Question:
BagriXQItemAccessor extends BagriXQCloseable implements XQItemAccessor { @Override public URI getNodeUri() throws XQException { Node node = getNode(); try { String base = node.getBaseURI(); if (base == null) { base = ""; } return new URI(base); } catch (URISyntaxException ex) { throw new XQException(ex.getMessage()); } } BagriXQItemAccessor(XQProcessor xqProcessor); @Override boolean getBoolean(); @Override byte getByte(); @Override double getDouble(); @Override float getFloat(); @Override int getInt(); @Override XQItemType getItemType(); @Override String getAtomicValue(); @Override long getLong(); @Override Node getNode(); @Override URI getNodeUri(); @Override Object getObject(); @Override XMLStreamReader getItemAsStream(); @Override String getItemAsString(Properties props); @Override short getShort(); @Override boolean instanceOf(XQItemType type); @Override void writeItem(OutputStream os, Properties props); @Override void writeItem(Writer ow, Properties props); @Override void writeItemToSAX(ContentHandler saxhdlr); @Override void writeItemToResult(Result result);  }### Answer:
@Test public void testGetNodeUri() throws XQException { XQExpression xqe; XQSequence xqs; xqe = xqc.createExpression(); xqs = xqe.executeQuery("'1'"); xqs.next(); try { xqs.getNodeUri(); fail("A-XQIA-5.1: getNodeUri() should fail if current item is not a node"); } catch (XQException e) { } xqe.close(); xqe = xqc.createExpression(); xqs = xqe.executeQuery("<e/>"); try { xqs.getNodeUri(); fail("A-XQIA-5.2: getNodeUri() should fail when not positioned on an item"); } catch (XQException e) { } xqe.close(); xqe = xqc.createExpression(); xqs = xqe.executeQuery("<e/>"); xqs.next(); xqs.close(); try { xqs.getNodeUri(); fail("A-XQIA-5.3: closed item accessor supports getNodeUri()"); } catch (XQException e) { } xqe.close(); xqe = xqc.createExpression(); xqs = xqe.executeQuery("<e/>"); xqs.next(); try { xqs.getNodeUri(); } catch (XQException e) { fail("A-XQIA-5.4: getNodeUri() failed with message: " + e.getMessage()); } xqe.close(); xqe = xqc.createExpression(); xqs = xqe.executeQuery("<e/>"); xqs.next(); XQItem item = xqs.getItem(); try { xqs.getNodeUri(); } catch (XQException e) { fail("A-XQIA-5.5: getNodeUri() failed with message: " + e.getMessage()); } xqe.close(); }