@Test
public void thatSpanStackingBehaviorOnRenderGeneratesErrors()
{
neLayer.setAllowStacking(false);
jcas.setDocumentText(StringUtils.repeat("a", 10));
new Sentence(jcas, 0, 10).addToIndexes();
NamedEntity ne1 = new NamedEntity(jcas, 3, 8);
ne1.addToIndexes();
NamedEntity ne2 = new NamedEntity(jcas, 3, 8);
ne2.addToIndexes();
SpanAdapter adapter = new SpanAdapter(featureSupportRegistry, null, neLayer, asList(),
asList(new SpanStackingBehavior()));
SpanRenderer sut = new SpanRenderer(adapter, featureSupportRegistry,
asList(new SpanStackingBehavior()));
VDocument vdoc = new VDocument();
sut.render(jcas, asList(), vdoc, 0, jcas.getDocumentText().length());
assertThat(vdoc.comments())
.usingFieldByFieldElementComparator()
.containsExactlyInAnyOrder(
new VComment(ne1, VCommentType.ERROR, "Stacking is not permitted."),
new VComment(ne2, VCommentType.ERROR, "Stacking is not permitted."));
}
}