Hi Marshall,
I have a unit test that fails on uimaj-core 2.7.0-SNAPSHOT but not on
uimaj-core 2.6.0.
Apparently, some features structures no longer appear multiple times in the
index
if they are added multiple times.
I'm not sure if this was an intentional change or not, so I didn't open an
issue yet.
However, here is a minimalized and purified version of my test. With
2.7.0-SNAPSHOT,
the second assert fails because count() returns 1.
@Test
public void tooManyAnnotationsTest()
throws Exception
{
CAS cas = CasCreationUtils.createCas((TypeSystemDescription) null,
null, null);
AnnotationFS documentAnnotation = cas.getDocumentAnnotation();
assertEquals(1, count(cas, documentAnnotation.getType()));
// Add a second time to the indexes
cas.addFsToIndexes(documentAnnotation);
assertEquals(2, count(cas, documentAnnotation.getType()));
}
private int count(CAS aCas, Type aType) {
FSIterator<FeatureStructure> i =
aCas.getIndexRepository().getAllIndexedFS(aType);
int n = 0;
while (i.hasNext()) {
n++;
i.next();
}
return n;
}
Cheers,
-- Richard