You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/09/12 19:56:44 UTC
svn commit: r1808151 -
/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java
Author: schor
Date: Tue Sep 12 19:56:44 2017
New Revision: 1808151
URL: http://svn.apache.org/viewvc?rev=1808151&view=rev
Log:
no Jira, add test case for iterator over sets
Modified:
uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java
Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java?rev=1808151&r1=1808150&r2=1808151&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java Tue Sep 12 19:56:44 2017
@@ -475,6 +475,34 @@ public class IndexComparitorTest extends
}
+ /*
+ * test set index:
+ * put the same FS (by set comparator) into type and typeSub1
+ * See if index contains both
+ * see if moveTo finds both
+ * see if iterator returns both
+ */
+ public void testSetUsesType() throws Exception {
+ cas.reset();
+
+ ir.addFS(createFs(type1, 1, 1));
+ ir.addFS(createFs(type1Sub1, 1, 1)); // same fs keys, different type
+ FeatureStructure testprobe = createFs(type1Sub1, 1, 1); // not in index, used only for key values
+ FeatureStructure testprobe2 = createFs(type1, 1, 1);
+
+ assertEquals(2, sortedType1.size());
+ assertEquals(2, setType1.size());
+
+ FSIterator<FeatureStructure> it = setType1.iterator();
+ it.moveTo(testprobe);
+ assertEquals("Type1", it.get().getType().getShortName());
+ it.moveTo(testprobe2);
+ assertEquals("Type1", it.get().getType().getShortName());
+ it.moveToFirst();
+ assertEquals("Type1", it.next().getType().getShortName());
+ assertEquals("Type1Sub1", it.next().getType().getShortName());
+ }
+
// note: this test is here because the setup is done
public void testProtectIndex() throws Exception {
FSIterator<FeatureStructure> it = sortedType1.iterator();