Hi Richard,

I was in the middle of reporting the issue in JIra, when I received your mail. 
The test fails in my project, but it passes when I do like you do. Don’t know 
what the difference is, except that we use uiamFIT in our project. I also tried 
to define SubType manually outside the XML type description, and it worked in 
this case in my project as well, e.g. just added this static class to the test 
class.


public static class SubType extends Annotation {

  public SubType(JCas jcas, int begin, int end) {
    super(jcas, begin, end);
  }

}

I actually don’t have a clue why I am seeing this difference in behaviour.

Cheers
Mario


On 3 Nov 2020, at 13.03, Richard Eckart de Castilho 
<r...@apache.org<mailto:r...@apache.org>> wrote:

External email – Do not click links or open attachments unless you recognize 
the sender and know that the content is safe.


On 3. Nov 2020, at 11:42, Richard Eckart de Castilho 
<r...@apache.org<mailto:r...@apache.org>> wrote:

I checked out the latest from master and installed it, but the unit test still 
fails in the same way.

roger, I'll check it out.

If you want to do me a favor, please open an issue on Jira and put your test 
case code there.

I removed the uimaFIT references from your code and dropped it into the
org.apache.uima.cas.impl.SelectFsTest test class in uimaj-core of the
master branch. Instead of the SubType type, I used the "x.y.z.Token" type
which is already available in the uimaj-core test code (inherits from 
Annotation).

For me, the test runs...

Did I accidentally mutilate your test?

-- Richard


 @Test
 public void verify_selectCovered() throws Exception {
   JCas jCas = cas.getJCas();
    Annotation[] fixture = new Annotation[] {
            new Annotation(jCas, 5, 10),
            new Annotation(jCas, 5, 15),
            new Annotation(jCas, 0, 10),
            new Annotation(jCas, 0, 15),
            new Annotation(jCas, 5, 7),
            new Annotation(jCas, 8, 10),
            new Annotation(jCas, 6, 9),
            new Annotation(jCas, 5, 10)
    };
    Stream.of(fixture).forEach(Annotation::addToIndexes);

    List<Annotation> selection1 = jCas.select(Annotation.class)
            .coveredBy(fixture[0])
            .collect(Collectors.toList());

    assertEquals(4, selection1.size());

    Token subType = new Token(jCas, 5, 10);
    subType.addToIndexes();

    List<Annotation> selection2 = jCas.select(Annotation.class)
            .coveredBy(subType)
            .collect(Collectors.toList());

    assertEquals(5, selection2.size()); // Fails!
 }


________________________________
Disclaimer:
This email and any files transmitted with it are confidential and directed 
solely for the use of the intended addressee or addressees and may contain 
information that is legally privileged, confidential, and exempt from 
disclosure. If you have received this email in error, please notify the sender 
by telephone, fax, or return email and immediately delete this email and any 
files transmitted along with it. Unintended recipients are not authorized to 
disclose, disseminate, distribute, copy or take any action in reliance on 
information contained in this email and/or any files attached thereto, in any 
manner other than to notify the sender; any unauthorized use is subject to 
legal prosecution.

Reply via email to