for (int i = 0; i < doc.get(CoreAnnotations.TokensAnnotation.class).size(); ++i) {
CoreLabel tokA = doc.get(CoreAnnotations.TokensAnnotation.class).get(i);
CoreLabel tokB = readDoc.get(CoreAnnotations.TokensAnnotation.class).get(i);
if (!tokA.equals(tokB)) {
for (Class keyA : tokA.keySet()) {
if (!tokB.containsKey(keyA)) {
assertTrue("Read document doesn't have key: " + keyA, false);
} else if (tokA.get(keyA) != null && !tokA.get(keyA).equals(tokB.get(keyA))) {
assertTrue("Documents disagree on key: " + keyA, false);
}
}