### Question:
BagriXQItemAccessor extends BagriXQCloseable implements XQItemAccessor { @Override public boolean instanceOf(XQItemType type) throws XQException { checkState(ex_item_closed); if (!positioned) { throw new XQException("not positioned on the Item"); } if (type == null) { throw new XQException("Provided type is null"); } return this.type.equals(type); } 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 testInstanceOf() throws XQException { XQItemType xqstringtype = xqc.createAtomicType(XQItemType.XQBASETYPE_STRING); XQItemType xqinttype = xqc.createAtomicType(XQItemType.XQBASETYPE_INT); XQExpression xqe = xqc.createExpression(); XQSequence xqs = xqe.executeQuery("'Hello world!'"); xqs.next(); try { assertEquals("A-XQIA-7.3: instanceOf failed", true, xqs.instanceOf(xqstringtype)); } catch (XQException e) { fail("A-XQIA-7.3: instanceOf() failed with message: " + e.getMessage()); } try { assertEquals("A-XQIA-7.4: instanceOf failed", false, xqs.instanceOf(xqinttype)); } catch (XQException e) { fail("A-XQIA-7.4: instanceOf() failed with message: " + e.getMessage()); } xqe.close(); }