SpanAdapter extends TypeAdapter_ImplBase { @Override public List<Pair<LogMessage, AnnotationFS>> validate(CAS aCas) { List<Pair<LogMessage, AnnotationFS>> messages = new ArrayList<>(); for (SpanLayerBehavior behavior : behaviors) { long startTime = currentTimeMillis(); messages.addAll(behavior.onValidate(this, aCas)); log.trace("Validation for [{}] on [{}] took {}ms", behavior.getClass().getSimpleName(), getLayer().getUiName(), currentTimeMillis() - startTime); } return messages; } SpanAdapter(LayerSupportRegistry aLayerSupportRegistry,
            FeatureSupportRegistry aFeatureSupportRegistry,
            ApplicationEventPublisher aEventPublisher, AnnotationLayer aLayer,
            Supplier<Collection<AnnotationFeature>> aFeatures, List<SpanLayerBehavior> aBehaviors); AnnotationFS add(SourceDocument aDocument, String aUsername, CAS aCas, int aBegin,
            int aEnd); AnnotationFS handle(CreateSpanAnnotationRequest aRequest); @Override void delete(SourceDocument aDocument, String aUsername, CAS aCas, VID aVid); @Override List<Pair<LogMessage, AnnotationFS>> validate(CAS aCas);  }
@Test public void thatAdjacentAnnotationsDoNotOverlap() throws AnnotationException { jcas.setDocumentText("Test."); new Sentence(jcas, 0, 5).addToIndexes(); new Token(jcas, 0, 4).addToIndexes(); new Token(jcas, 4, 5).addToIndexes(); new NamedEntity(jcas, 0, 4).addToIndexes(); new NamedEntity(jcas, 4, 5).addToIndexes(); SpanAdapter sut = new SpanAdapter(layerSupportRegistry, featureSupportRegistry, null, neLayer, () -> asList(), behaviors); neLayer.setOverlapMode(NO_OVERLAP); assertThat(sut.validate(jcas.getCas())) .isEmpty(); }