String doc = "Patient suffers from a shattered tibia and facial contusions. Recommend bed rest, aspirin, and ice.";
jcas.setDocumentText(doc);
SimplePipeline.runPipeline(jcas, SimpleSegmentAnnotator.createAnnotatorDescription());
Collection<Segment> segs = JCasUtil.select(jcas, Segment.class);
assertEquals(segs.size(), 1);
Segment seg = segs.toArray(new Segment[]{})[0];
assert(seg.getId().equals("SIMPLE_SEGMENT"));
jcas = JCasFactory.createJCas();
jcas.setDocumentText(doc);
SimplePipeline.runPipeline(jcas, SimpleSegmentAnnotator.createAnnotatorDescription("TestId"));
segs = JCasUtil.select(jcas, Segment.class);
assertEquals(segs.size(), 1);
seg = segs.toArray(new Segment[]{})[0];
assertEquals("Segment ids do not match!", seg.getId(), "TestId");
}