int [] holderForStartAndLength = new int[2]; char[] buf = xpp.getTextCharacters(holderForStartAndLength); if(buf != null) { String s = new String(buf, holderForStartAndLength[0], holderForStartAndLength[1]);  if(xpp.getEventType() != xpp.ENTITY_REF) { assertEquals("getText(holder)", printable(text), printable(s)); } else { assertEquals("getText(holder) ENTITY_REF", printable(name), printable(s)); } } else { assertEquals("getTextCharacters()", null, text);
assertEquals("getDepth()", depth, xpp.getDepth()); assertEquals("getNamespacesCount(getDepth())", nsCount, xpp.getNamespaceCount(depth)); assertEquals("getNamespace()", namespace, xpp.getNamespace());  if(type == xpp.START_TAG) { assertEquals("isEmptyElementTag()", isEmpty, xpp.isEmptyElementTag()); } else { try { xpp.isEmptyElementTag(); fail("isEmptyElementTag() must throw exception if parser not on START_TAG"); } catch(XmlPullParserException ex) {
    public void checkParserStateNs(        XmlPullParser xpp,        int depth,        int type,        String prefix,        int nsCount,        String namespace,        String name,        String text,        boolean isEmpty,        int attribCount    ) throws XmlPullParserException, IOException    {        checkParserStateNs(xpp, depth, type, prefix, nsCount, namespace, name, isEmpty, attribCount);        if(xpp.getEventType() != xpp.START_TAG && xpp.getEventType() != xpp.END_TAG) {            assertEquals("getText()", printable(text), printable(xpp.getText()));            int [] holderForStartAndLength = new int[2];            char[] buf = xpp.getTextCharacters(holderForStartAndLength);            if(buf != null) {                String s = new String(buf, holderForStartAndLength[0], holderForStartAndLength[1]);                // ENTITY_REF is a special case when getText != (getTextCharacters == getName)                if(xpp.getEventType() != xpp.ENTITY_REF) {                    assertEquals("getText(holder)", printable(text), printable(s));                } else {                    assertEquals("getText(holder) ENTITY_REF", printable(name), printable(s));                }            } else {                assertEquals("getTextCharacters()", null, text);            }        }    }