You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2009/06/03 18:42:11 UTC
svn commit: r781467 -
/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
Author: twgoetz
Date: Wed Jun 3 16:42:11 2009
New Revision: 781467
URL: http://svn.apache.org/viewvc?rev=781467&view=rev
Log:
Jira UIMA-1352: add test case, which however fails to reproduce the issue (i.e., works as designed). Will ask issue reporter for better test case.
https://issues.apache.org/jira/browse/UIMA-1352
Modified:
incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java?rev=781467&r1=781466&r2=781467&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java Wed Jun 3 16:42:11 2009
@@ -31,6 +31,7 @@
import org.apache.uima.UIMAFramework;
import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASException;
import org.apache.uima.cas.CASRuntimeException;
import org.apache.uima.cas.FSIndex;
import org.apache.uima.cas.FSIndexRepository;
@@ -42,6 +43,7 @@
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.internal.util.IntVector;
+import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.ResourceSpecifier;
import org.apache.uima.test.junit_extension.JUnitExtension;
@@ -171,7 +173,7 @@
public void testGetIndexes() {
Iterator<FSIndex> it = this.cas.getIndexRepository().getIndexes();
while (it.hasNext()) {
- assertTrue(it.next() instanceof FSIndex);
+ assertNotNull(it.next());
}
}
@@ -269,6 +271,24 @@
while (javaIt.hasNext()) {
assertEquals(javaIt.next().hashCode(), v.get(current++));
}
+
+ // test find()
+ AnnotationFS annot = (AnnotationFS) setIndex.iterator().get();
+ assertNotNull(setIndex.find(annot));
+ assertNull(setIndex.find(this.cas.createAnnotation(this.annotationType, -1, -1)));
+
+ // do same for JCas
+ JCas jcas = null;
+ try {
+ jcas = this.cas.getJCas();
+ } catch (CASException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ assertTrue(false);
+ }
+ FSIndex jcasSetIndex = jcas.getJFSIndexRepository().getIndex(CASTestSetup.ANNOT_SET_INDEX);
+ assertNotNull(jcasSetIndex.find(annot));
+ assertNull(jcasSetIndex.find(this.cas.createAnnotation(this.annotationType, -1, -1)));
// /////////////////////////////////////////////////////////////////////////
// Test fast fail.
@@ -344,7 +364,7 @@
for (int i = 0; i < list.size(); i++) {
// System.out.println("Iteration: " + i);
it.moveToFirst();
- it.moveTo((FeatureStructure) list.get(i));
+ it.moveTo(list.get(i));
assertTrue(((AnnotationFS) it.get()).getBegin() == ((AnnotationFS) list.get(i)).getBegin());
assertTrue(((AnnotationFS) it.get()).getEnd() == ((AnnotationFS) list.get(i)).getEnd());
}