if (expectedNode != null) {
assertTrue("has NodeAttribute", t.hasAttribute(NodeAttribute.class));
nodeAtt = t.getAttribute(NodeAttribute.class);
}
PositionAttribute posAtt = null;
if (expectedPos != null) {
assertTrue("has PositionAttribute", t.hasAttribute(PositionAttribute.class));
posAtt = t.getAttribute(PositionAttribute.class);
}
for (int i = 0; i < expectedImages.length; i++) {
assertTrue("token "+i+" exists", t.incrementToken());
assertEquals("i=" + i, expectedImages[i], termAtt.toString());
if (expectedTypes != null) {
assertEquals(expectedTypes[i], typeAtt.type());
}
if (expectedPosIncrs != null) {
assertEquals(expectedPosIncrs[i], posIncrAtt.getPositionIncrement());
}
if (expectedNode != null) {
assertEquals(expectedNode[i], nodeAtt.node());
}
if (expectedPos != null) {
assertEquals(expectedPos[i], posAtt.position());
}
}
assertFalse("end of stream, received token " + termAtt.toString(), t.incrementToken());
t.end();